bindata 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bindata might be problematic. Click here for more details.
- data/.gitignore +1 -0
- data/ChangeLog.rdoc +7 -0
- data/Gemfile +2 -0
- data/README.md +1 -1
- data/Rakefile +6 -13
- data/bindata.gemspec +32 -0
- data/{manual.haml → doc/manual.haml} +1 -1
- data/{manual.md → doc/manual.md} +0 -0
- data/lib/a.rb +24 -0
- data/lib/bindata.rb +1 -3
- data/lib/bindata/array.rb +1 -1
- data/lib/bindata/base_primitive.rb +1 -5
- data/lib/bindata/bits.rb +5 -5
- data/lib/bindata/choice.rb +1 -1
- data/lib/bindata/deprecated.rb +1 -1
- data/lib/bindata/dsl.rb +5 -40
- data/lib/bindata/io.rb +19 -27
- data/lib/bindata/lazy.rb +3 -3
- data/lib/bindata/stringz.rb +13 -16
- data/lib/bindata/version.rb +3 -0
- data/lib/bindata/virtual.rb +47 -0
- data/spec/choice_spec.rb +12 -0
- data/spec/deprecated_spec.rb +1 -1
- data/tasks/manual.rake +4 -4
- metadata +99 -77
- data/tasks/pkg.rake +0 -48
- data/tasks/rdoc.rake +0 -8
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Gemfile.lock
|
data/ChangeLog.rdoc
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
= BinData Changelog
|
2
2
|
|
3
|
+
== Version 1.5.1 (2013-08-16)
|
4
|
+
|
5
|
+
* Rework build system and include .gemspec. Requested by Simon Shortman.
|
6
|
+
* Fixed bug when Choice#clear didn't clear everything. Thanks to Simon
|
7
|
+
Shortman for the bug report.
|
8
|
+
* Moved BinData::VERSION into its own file. Thanks to John Van Enk.
|
9
|
+
|
3
10
|
== Version 1.5.0 (2013-05-21)
|
4
11
|
|
5
12
|
* Moved to github.
|
data/Gemfile
ADDED
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,19 +1,12 @@
|
|
1
|
-
|
1
|
+
require 'bundler'
|
2
|
+
Bundler.setup
|
3
|
+
Bundler::GemHelper.install_tasks
|
2
4
|
|
3
|
-
require 'bindata'
|
4
5
|
require 'rake/clean'
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
"[A-Z]*",
|
10
|
-
"examples/**/*",
|
11
|
-
"{spec,lib}/**/*.rb",
|
12
|
-
"tasks/**/*.rake",
|
13
|
-
"setup.rb",
|
14
|
-
"manual.haml",
|
15
|
-
"manual.md"
|
16
|
-
]
|
7
|
+
task :clobber do
|
8
|
+
rm_rf 'pkg'
|
9
|
+
end
|
17
10
|
|
18
11
|
task :default => :spec
|
19
12
|
|
data/bindata.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
2
|
+
require 'bindata/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'bindata'
|
6
|
+
s.version = BinData::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.summary = 'A declarative way to read and write binary file formats'
|
9
|
+
s.author = 'Dion Mendel'
|
10
|
+
s.email = 'dion@lostrealm.com'
|
11
|
+
s.homepage = 'http://github.com/dmendel/bindata'
|
12
|
+
s.rubyforge_project = 'bindata'
|
13
|
+
s.require_path = 'lib'
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.extra_rdoc_files = ['NEWS.rdoc']
|
16
|
+
s.rdoc_options << '--main' << 'NEWS.rdoc'
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
|
19
|
+
s.add_development_dependency('rake')
|
20
|
+
s.add_development_dependency('rspec', [">= 2.10.0"])
|
21
|
+
s.add_development_dependency('haml', ["< 4.0.0"])
|
22
|
+
s.add_development_dependency('maruku')
|
23
|
+
s.add_development_dependency('syntax')
|
24
|
+
s.description = <<-END.gsub(/^ +/, "")
|
25
|
+
BinData is a declarative way to read and write binary file formats.
|
26
|
+
|
27
|
+
This means the programmer specifies *what* the format of the binary
|
28
|
+
data is, and BinData works out *how* to read and write data in this
|
29
|
+
format. It is an easier ( and more readable ) alternative to
|
30
|
+
ruby's #pack and #unpack methods.
|
31
|
+
END
|
32
|
+
end
|
data/{manual.md → doc/manual.md}
RENAMED
File without changes
|
data/lib/a.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'bindata'
|
2
|
+
|
3
|
+
class A < BinData::Choice
|
4
|
+
int8 1
|
5
|
+
uint8 :default
|
6
|
+
end
|
7
|
+
|
8
|
+
a = A.new(:selection => 1)
|
9
|
+
|
10
|
+
p a.class
|
11
|
+
|
12
|
+
class BinData::Choice
|
13
|
+
def selected_object
|
14
|
+
current_choice
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
case a.selected_object
|
19
|
+
when BinData::Int8
|
20
|
+
p "int8"
|
21
|
+
else
|
22
|
+
p "else"
|
23
|
+
end
|
24
|
+
|
data/lib/bindata.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# BinData -- Binary data manipulator.
|
2
2
|
# Copyright (c) 2007 - 2013 Dion Mendel.
|
3
3
|
|
4
|
+
require 'bindata/version'
|
4
5
|
require 'bindata/array'
|
5
6
|
require 'bindata/bits'
|
6
7
|
require 'bindata/choice'
|
@@ -30,6 +31,3 @@ require 'bindata/deprecated'
|
|
30
31
|
# BinData is released under the same license as Ruby.
|
31
32
|
#
|
32
33
|
# Copyright (c) 2007 - 2013 Dion Mendel.
|
33
|
-
module BinData
|
34
|
-
VERSION = "1.5.0"
|
35
|
-
end
|
data/lib/bindata/array.rb
CHANGED
data/lib/bindata/bits.rb
CHANGED
@@ -8,7 +8,7 @@ module BinData
|
|
8
8
|
class << self
|
9
9
|
def define_class(nbits, endian)
|
10
10
|
name = "Bit#{nbits}"
|
11
|
-
name
|
11
|
+
name << "le" if endian == :little
|
12
12
|
unless BinData.const_defined?(name)
|
13
13
|
BinData.module_eval <<-END
|
14
14
|
class #{name} < BinData::BasePrimitive
|
@@ -51,14 +51,14 @@ module BinData
|
|
51
51
|
def create_clamp_code(nbits)
|
52
52
|
min = 0
|
53
53
|
max = (1 << nbits) - 1
|
54
|
-
clamp = "
|
54
|
+
clamp = "(val < #{min}) ? #{min} : (val > #{max}) ? #{max} : val"
|
55
55
|
|
56
56
|
if nbits == 1
|
57
57
|
# allow single bits to be used as booleans
|
58
|
-
|
59
|
-
else
|
60
|
-
clamp
|
58
|
+
clamp = "(val == true) ? 1 : (not val) ? 0 : #{clamp}"
|
61
59
|
end
|
60
|
+
|
61
|
+
"val = #{clamp}"
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
data/lib/bindata/choice.rb
CHANGED
data/lib/bindata/deprecated.rb
CHANGED
data/lib/bindata/dsl.rb
CHANGED
@@ -72,8 +72,7 @@ module BinData
|
|
72
72
|
def fields
|
73
73
|
unless defined? @fields
|
74
74
|
fields = parent_attribute(:fields, nil)
|
75
|
-
|
76
|
-
@fields = klass.new(endian)
|
75
|
+
@fields = SanitizedFields.new(endian)
|
77
76
|
@fields.copy_fields(fields) if fields
|
78
77
|
end
|
79
78
|
|
@@ -113,13 +112,13 @@ module BinData
|
|
113
112
|
def options
|
114
113
|
case @parser_type
|
115
114
|
when :struct
|
116
|
-
[:multiple_fields, :optional_fieldnames, :
|
115
|
+
[:multiple_fields, :optional_fieldnames, :hidden_fields]
|
117
116
|
when :array
|
118
|
-
[:multiple_fields, :optional_fieldnames
|
117
|
+
[:multiple_fields, :optional_fieldnames]
|
119
118
|
when :choice
|
120
|
-
[:multiple_fields, :all_or_none_fieldnames, :
|
119
|
+
[:multiple_fields, :all_or_none_fieldnames, :fieldnames_are_values]
|
121
120
|
when :primitive
|
122
|
-
[:multiple_fields, :optional_fieldnames
|
121
|
+
[:multiple_fields, :optional_fieldnames]
|
123
122
|
else
|
124
123
|
raise "unknown parser type #{parser_type}"
|
125
124
|
end
|
@@ -309,39 +308,5 @@ module BinData
|
|
309
308
|
result
|
310
309
|
end
|
311
310
|
end
|
312
|
-
|
313
|
-
# An array containing a field definition of the form
|
314
|
-
# expected by BinData::Struct.
|
315
|
-
class UnSanitizedField < ::Array
|
316
|
-
def initialize(type, name, params)
|
317
|
-
super()
|
318
|
-
self << type << name << params
|
319
|
-
end
|
320
|
-
def type
|
321
|
-
self[0]
|
322
|
-
end
|
323
|
-
def name
|
324
|
-
self[1]
|
325
|
-
end
|
326
|
-
def params
|
327
|
-
self[2]
|
328
|
-
end
|
329
|
-
end
|
330
|
-
|
331
|
-
class UnSanitizedFields < ::Array
|
332
|
-
def initialize(endian)
|
333
|
-
@endian = endian
|
334
|
-
end
|
335
|
-
|
336
|
-
def add_field(type, name, params)
|
337
|
-
normalized_endian = @endian.respond_to?(:endian) ? @endian.endian : @endian
|
338
|
-
normalized_type = RegisteredClasses.normalize_name(type, normalized_endian)
|
339
|
-
self << UnSanitizedField.new(normalized_type, name, params)
|
340
|
-
end
|
341
|
-
|
342
|
-
def copy_fields(other)
|
343
|
-
concat(other)
|
344
|
-
end
|
345
|
-
end
|
346
311
|
end
|
347
312
|
end
|
data/lib/bindata/io.rb
CHANGED
@@ -5,6 +5,9 @@ module BinData
|
|
5
5
|
# interface for BinData objects to use when accessing the IO.
|
6
6
|
class IO
|
7
7
|
|
8
|
+
# The underlying IO is unseekable
|
9
|
+
class Unseekable < StandardError; end
|
10
|
+
|
8
11
|
# Creates a StringIO around +str+.
|
9
12
|
def self.create_string_io(str = "")
|
10
13
|
if str.respond_to?(:force_encoding)
|
@@ -41,7 +44,7 @@ module BinData
|
|
41
44
|
@raw_io = io
|
42
45
|
|
43
46
|
# initial stream position if stream supports positioning
|
44
|
-
@initial_pos =
|
47
|
+
@initial_pos = current_position rescue 0
|
45
48
|
|
46
49
|
# bits when reading
|
47
50
|
@rnbits = 0
|
@@ -60,25 +63,21 @@ module BinData
|
|
60
63
|
# Returns the current offset of the io stream. The exact value of
|
61
64
|
# the offset when reading bitfields is not defined.
|
62
65
|
def offset
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
0
|
67
|
-
end
|
66
|
+
current_position - @initial_pos
|
67
|
+
rescue Unseekable
|
68
|
+
0
|
68
69
|
end
|
69
70
|
|
70
71
|
# The number of bytes remaining in the input stream.
|
71
72
|
def num_bytes_remaining
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
0
|
81
|
-
end
|
73
|
+
pos = current_position
|
74
|
+
@raw_io.seek(0, ::IO::SEEK_END)
|
75
|
+
bytes_remaining = current_position - pos
|
76
|
+
@raw_io.seek(pos, ::IO::SEEK_SET)
|
77
|
+
|
78
|
+
bytes_remaining
|
79
|
+
rescue Unseekable
|
80
|
+
0
|
82
81
|
end
|
83
82
|
|
84
83
|
# Seek +n+ bytes from the current position in the io stream.
|
@@ -128,7 +127,6 @@ module BinData
|
|
128
127
|
# Discards any read bits so the stream becomes aligned at the
|
129
128
|
# next byte boundary.
|
130
129
|
def reset_read_bits
|
131
|
-
raise "Internal state error nbits = #{@rnbits}" if @rnbits >= 8
|
132
130
|
@rnbits = 0
|
133
131
|
@rval = 0
|
134
132
|
end
|
@@ -170,16 +168,10 @@ module BinData
|
|
170
168
|
#---------------
|
171
169
|
private
|
172
170
|
|
173
|
-
def
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
true
|
178
|
-
rescue NoMethodError, Errno::ESPIPE
|
179
|
-
false
|
180
|
-
end
|
181
|
-
end
|
182
|
-
@positioning_supported
|
171
|
+
def current_position
|
172
|
+
@raw_io.pos
|
173
|
+
rescue NoMethodError, Errno::ESPIPE
|
174
|
+
raise Unseekable
|
183
175
|
end
|
184
176
|
|
185
177
|
def skipbytes(n)
|
data/lib/bindata/lazy.rb
CHANGED
@@ -84,11 +84,11 @@ module BinData
|
|
84
84
|
obj_parent = @obj.parent
|
85
85
|
|
86
86
|
if obj_parent.has_parameter?(symbol)
|
87
|
-
|
87
|
+
obj_parent.get_parameter(symbol)
|
88
88
|
elsif obj_parent.safe_respond_to?(symbol)
|
89
|
-
|
89
|
+
obj_parent.__send__(symbol, *args)
|
90
90
|
else
|
91
|
-
|
91
|
+
symbol
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
data/lib/bindata/stringz.rb
CHANGED
@@ -66,33 +66,30 @@ module BinData
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def trim_and_zero_terminate(str)
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
append_zero_byte_if_needed(
|
69
|
+
result = binary_string(str)
|
70
|
+
truncate_after_first_zero_byte!(result)
|
71
|
+
trim_to!(result, eval_parameter(:max_length))
|
72
|
+
append_zero_byte_if_needed!(result)
|
73
|
+
result
|
73
74
|
end
|
74
75
|
|
75
|
-
def truncate_after_first_zero_byte(str)
|
76
|
-
str.sub(/([^\0]*\0).*/, '\1')
|
76
|
+
def truncate_after_first_zero_byte!(str)
|
77
|
+
str.sub!(/([^\0]*\0).*/, '\1')
|
77
78
|
end
|
78
79
|
|
79
|
-
def trim_to(str, max_length = nil)
|
80
|
-
result = str
|
80
|
+
def trim_to!(str, max_length = nil)
|
81
81
|
if max_length
|
82
82
|
max_length = 1 if max_length < 1
|
83
|
-
|
84
|
-
if
|
85
|
-
|
83
|
+
str.slice!(max_length)
|
84
|
+
if str.length == max_length and str[-1, 1] != "\0"
|
85
|
+
str[-1, 1] = "\0"
|
86
86
|
end
|
87
87
|
end
|
88
|
-
result
|
89
88
|
end
|
90
89
|
|
91
|
-
def append_zero_byte_if_needed(str)
|
90
|
+
def append_zero_byte_if_needed!(str)
|
92
91
|
if str.length == 0 or str[-1, 1] != "\0"
|
93
|
-
str
|
94
|
-
else
|
95
|
-
str
|
92
|
+
str << "\0"
|
96
93
|
end
|
97
94
|
end
|
98
95
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require "bindata/base_primitive"
|
2
|
+
|
3
|
+
module BinData
|
4
|
+
# A virtual field is one that is neither read, written nor occupies space.
|
5
|
+
# It is used to make assertions or as a convenient label for determining
|
6
|
+
# offsets.
|
7
|
+
#
|
8
|
+
# require 'bindata'
|
9
|
+
#
|
10
|
+
# class A < BinData::Record
|
11
|
+
# string :a, :read_length => 5
|
12
|
+
# string :b, :read_length => 5
|
13
|
+
# virtual :c, :assert => lambda { a == b }
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# obj = A.read("abcdeabcde")
|
17
|
+
# obj.a #=> "abcde"
|
18
|
+
# obj.b.offset #=> 10
|
19
|
+
#
|
20
|
+
class Virtual < BinData::BasePrimitive
|
21
|
+
|
22
|
+
default_parameter :onlyif => false
|
23
|
+
|
24
|
+
class << self
|
25
|
+
def sanitize_parameters!(params) #:nodoc:
|
26
|
+
if params.has_parameter?(:assert_value)
|
27
|
+
fail ":assert_value can not be used on virtual field"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
#---------------
|
33
|
+
private
|
34
|
+
|
35
|
+
def value_to_binary_string(val)
|
36
|
+
""
|
37
|
+
end
|
38
|
+
|
39
|
+
def read_and_return_value(io)
|
40
|
+
""
|
41
|
+
end
|
42
|
+
|
43
|
+
def sensible_default
|
44
|
+
""
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/spec/choice_spec.rb
CHANGED
@@ -163,6 +163,18 @@ describe BinData::Choice, "with single values" do
|
|
163
163
|
subject.should be_zero
|
164
164
|
end
|
165
165
|
|
166
|
+
it "clears all possible choices" do
|
167
|
+
subject.choice = 3
|
168
|
+
subject.assign(10)
|
169
|
+
subject.choice = 5
|
170
|
+
subject.assign(11)
|
171
|
+
|
172
|
+
subject.clear
|
173
|
+
|
174
|
+
subject.choice = 3
|
175
|
+
subject.should be_zero
|
176
|
+
end
|
177
|
+
|
166
178
|
it "is clear on initialisation" do
|
167
179
|
subject.choice = 3
|
168
180
|
|
data/spec/deprecated_spec.rb
CHANGED
data/tasks/manual.rake
CHANGED
@@ -22,15 +22,15 @@ rescue LoadError
|
|
22
22
|
end
|
23
23
|
|
24
24
|
unless load_failed
|
25
|
-
file "manual.html" => ["manual.md", "manual.haml"] do |t|
|
25
|
+
file "doc/manual.html" => ["doc/manual.md", "doc/manual.haml"] do |t|
|
26
26
|
require 'haml/exec'
|
27
27
|
|
28
|
-
opts = Haml::Exec::Haml.new(["manual.haml", "manual.html"])
|
28
|
+
opts = Haml::Exec::Haml.new(["doc/manual.haml", "doc/manual.html"])
|
29
29
|
opts.parse!
|
30
30
|
end
|
31
31
|
|
32
|
-
CLOBBER.include("manual.html")
|
32
|
+
CLOBBER.include("doc/manual.html")
|
33
33
|
|
34
34
|
desc "Build the reference manual"
|
35
|
-
task :manual => "manual.html"
|
35
|
+
task :manual => "doc/manual.html"
|
36
36
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bindata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 1.5.
|
9
|
+
- 1
|
10
|
+
version: 1.5.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dion Mendel
|
@@ -15,12 +15,25 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-
|
18
|
+
date: 2013-08-16 00:00:00 +08:00
|
19
|
+
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
|
-
name: rspec
|
22
|
-
prerelease: false
|
23
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
name: rake
|
32
|
+
version_requirements: *id001
|
33
|
+
prerelease: false
|
34
|
+
type: :development
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
24
37
|
none: false
|
25
38
|
requirements:
|
26
39
|
- - ">="
|
@@ -31,26 +44,28 @@ dependencies:
|
|
31
44
|
- 10
|
32
45
|
- 0
|
33
46
|
version: 2.10.0
|
47
|
+
name: rspec
|
48
|
+
version_requirements: *id002
|
49
|
+
prerelease: false
|
34
50
|
type: :development
|
35
|
-
version_requirements: *id001
|
36
51
|
- !ruby/object:Gem::Dependency
|
37
|
-
|
38
|
-
prerelease: false
|
39
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
53
|
none: false
|
41
54
|
requirements:
|
42
|
-
- -
|
55
|
+
- - <
|
43
56
|
- !ruby/object:Gem::Version
|
44
|
-
hash:
|
57
|
+
hash: 63
|
45
58
|
segments:
|
59
|
+
- 4
|
46
60
|
- 0
|
47
|
-
|
61
|
+
- 0
|
62
|
+
version: 4.0.0
|
63
|
+
name: haml
|
64
|
+
version_requirements: *id003
|
65
|
+
prerelease: false
|
48
66
|
type: :development
|
49
|
-
version_requirements: *id002
|
50
67
|
- !ruby/object:Gem::Dependency
|
51
|
-
|
52
|
-
prerelease: false
|
53
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
54
69
|
none: false
|
55
70
|
requirements:
|
56
71
|
- - ">="
|
@@ -59,12 +74,12 @@ dependencies:
|
|
59
74
|
segments:
|
60
75
|
- 0
|
61
76
|
version: "0"
|
77
|
+
name: maruku
|
78
|
+
version_requirements: *id004
|
79
|
+
prerelease: false
|
62
80
|
type: :development
|
63
|
-
version_requirements: *id003
|
64
81
|
- !ruby/object:Gem::Dependency
|
65
|
-
|
66
|
-
prerelease: false
|
67
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
82
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
68
83
|
none: false
|
69
84
|
requirements:
|
70
85
|
- - ">="
|
@@ -73,8 +88,10 @@ dependencies:
|
|
73
88
|
segments:
|
74
89
|
- 0
|
75
90
|
version: "0"
|
91
|
+
name: syntax
|
92
|
+
version_requirements: *id005
|
93
|
+
prerelease: false
|
76
94
|
type: :development
|
77
|
-
version_requirements: *id004
|
78
95
|
description: |
|
79
96
|
BinData is a declarative way to read and write binary file formats.
|
80
97
|
|
@@ -91,74 +108,79 @@ extensions: []
|
|
91
108
|
extra_rdoc_files:
|
92
109
|
- NEWS.rdoc
|
93
110
|
files:
|
94
|
-
-
|
95
|
-
- COPYING
|
96
|
-
- README.md
|
111
|
+
- .gitignore
|
97
112
|
- BSDL
|
98
|
-
-
|
113
|
+
- COPYING
|
99
114
|
- ChangeLog.rdoc
|
115
|
+
- Gemfile
|
100
116
|
- INSTALL
|
117
|
+
- NEWS.rdoc
|
118
|
+
- README.md
|
119
|
+
- Rakefile
|
120
|
+
- bindata.gemspec
|
121
|
+
- doc/manual.haml
|
122
|
+
- doc/manual.md
|
123
|
+
- examples/NBT.txt
|
124
|
+
- examples/gzip.rb
|
101
125
|
- examples/ip_address.rb
|
102
126
|
- examples/list.rb
|
103
|
-
- examples/gzip.rb
|
104
|
-
- examples/NBT.txt
|
105
127
|
- examples/nbt.rb
|
106
|
-
-
|
107
|
-
-
|
108
|
-
-
|
109
|
-
-
|
110
|
-
-
|
111
|
-
-
|
112
|
-
-
|
113
|
-
-
|
114
|
-
- spec/rest_spec.rb
|
115
|
-
- spec/struct_spec.rb
|
116
|
-
- spec/record_spec.rb
|
117
|
-
- spec/deprecated_spec.rb
|
118
|
-
- spec/alignment_spec.rb
|
119
|
-
- spec/system_spec.rb
|
120
|
-
- spec/base_primitive_spec.rb
|
121
|
-
- spec/array_spec.rb
|
122
|
-
- spec/int_spec.rb
|
123
|
-
- spec/choice_spec.rb
|
124
|
-
- spec/string_spec.rb
|
125
|
-
- spec/base_spec.rb
|
126
|
-
- spec/registry_spec.rb
|
127
|
-
- spec/skip_spec.rb
|
128
|
-
- spec/float_spec.rb
|
128
|
+
- lib/a.rb
|
129
|
+
- lib/bindata.rb
|
130
|
+
- lib/bindata/alignment.rb
|
131
|
+
- lib/bindata/array.rb
|
132
|
+
- lib/bindata/base.rb
|
133
|
+
- lib/bindata/base_primitive.rb
|
134
|
+
- lib/bindata/bits.rb
|
135
|
+
- lib/bindata/choice.rb
|
129
136
|
- lib/bindata/count_bytes_remaining.rb
|
137
|
+
- lib/bindata/deprecated.rb
|
138
|
+
- lib/bindata/dsl.rb
|
139
|
+
- lib/bindata/float.rb
|
140
|
+
- lib/bindata/int.rb
|
141
|
+
- lib/bindata/io.rb
|
130
142
|
- lib/bindata/lazy.rb
|
143
|
+
- lib/bindata/offset.rb
|
144
|
+
- lib/bindata/params.rb
|
145
|
+
- lib/bindata/primitive.rb
|
146
|
+
- lib/bindata/record.rb
|
147
|
+
- lib/bindata/registry.rb
|
131
148
|
- lib/bindata/rest.rb
|
132
|
-
- lib/bindata/int.rb
|
133
|
-
- lib/bindata/array.rb
|
134
149
|
- lib/bindata/sanitize.rb
|
135
|
-
- lib/bindata/params.rb
|
136
|
-
- lib/bindata/string.rb
|
137
150
|
- lib/bindata/skip.rb
|
138
|
-
- lib/bindata/
|
139
|
-
- lib/bindata/
|
140
|
-
- lib/bindata/registry.rb
|
141
|
-
- lib/bindata/deprecated.rb
|
142
|
-
- lib/bindata/primitive.rb
|
143
|
-
- lib/bindata/base_primitive.rb
|
151
|
+
- lib/bindata/string.rb
|
152
|
+
- lib/bindata/stringz.rb
|
144
153
|
- lib/bindata/struct.rb
|
145
|
-
- lib/bindata/bits.rb
|
146
|
-
- lib/bindata/offset.rb
|
147
|
-
- lib/bindata/record.rb
|
148
|
-
- lib/bindata/dsl.rb
|
149
|
-
- lib/bindata/float.rb
|
150
|
-
- lib/bindata/choice.rb
|
151
|
-
- lib/bindata/base.rb
|
152
154
|
- lib/bindata/trace.rb
|
153
|
-
- lib/bindata/
|
154
|
-
- lib/bindata.rb
|
155
|
-
- tasks/rspec.rake
|
156
|
-
- tasks/manual.rake
|
157
|
-
- tasks/rdoc.rake
|
158
|
-
- tasks/pkg.rake
|
155
|
+
- lib/bindata/version.rb
|
156
|
+
- lib/bindata/virtual.rb
|
159
157
|
- setup.rb
|
160
|
-
-
|
161
|
-
-
|
158
|
+
- spec/alignment_spec.rb
|
159
|
+
- spec/array_spec.rb
|
160
|
+
- spec/base_primitive_spec.rb
|
161
|
+
- spec/base_spec.rb
|
162
|
+
- spec/bits_spec.rb
|
163
|
+
- spec/choice_spec.rb
|
164
|
+
- spec/count_bytes_remaining_spec.rb
|
165
|
+
- spec/deprecated_spec.rb
|
166
|
+
- spec/example.rb
|
167
|
+
- spec/float_spec.rb
|
168
|
+
- spec/int_spec.rb
|
169
|
+
- spec/io_spec.rb
|
170
|
+
- spec/lazy_spec.rb
|
171
|
+
- spec/primitive_spec.rb
|
172
|
+
- spec/record_spec.rb
|
173
|
+
- spec/registry_spec.rb
|
174
|
+
- spec/rest_spec.rb
|
175
|
+
- spec/skip_spec.rb
|
176
|
+
- spec/spec_common.rb
|
177
|
+
- spec/string_spec.rb
|
178
|
+
- spec/stringz_spec.rb
|
179
|
+
- spec/struct_spec.rb
|
180
|
+
- spec/system_spec.rb
|
181
|
+
- tasks/manual.rake
|
182
|
+
- tasks/rspec.rake
|
183
|
+
has_rdoc: true
|
162
184
|
homepage: http://github.com/dmendel/bindata
|
163
185
|
licenses: []
|
164
186
|
|
@@ -189,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
211
|
requirements: []
|
190
212
|
|
191
213
|
rubyforge_project: bindata
|
192
|
-
rubygems_version: 1.
|
214
|
+
rubygems_version: 1.6.2
|
193
215
|
signing_key:
|
194
216
|
specification_version: 3
|
195
217
|
summary: A declarative way to read and write binary file formats
|
data/tasks/pkg.rake
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'rubygems'
|
3
|
-
require 'rubygems/package_task'
|
4
|
-
|
5
|
-
SPEC = Gem::Specification.new do |s|
|
6
|
-
s.name = 'bindata'
|
7
|
-
s.version = CURRENT_VERSION
|
8
|
-
s.platform = Gem::Platform::RUBY
|
9
|
-
s.summary = 'A declarative way to read and write binary file formats'
|
10
|
-
s.author = 'Dion Mendel'
|
11
|
-
s.email = 'dion@lostrealm.com'
|
12
|
-
s.homepage = 'http://github.com/dmendel/bindata'
|
13
|
-
s.rubyforge_project = 'bindata'
|
14
|
-
s.require_path = 'lib'
|
15
|
-
s.has_rdoc = true
|
16
|
-
s.extra_rdoc_files = ['NEWS.rdoc']
|
17
|
-
s.rdoc_options << '--main' << 'NEWS.rdoc'
|
18
|
-
s.files = PKG_FILES
|
19
|
-
s.add_development_dependency('rspec', [">= 2.10.0"])
|
20
|
-
s.add_development_dependency('haml')
|
21
|
-
s.add_development_dependency('maruku')
|
22
|
-
s.add_development_dependency('syntax')
|
23
|
-
s.description = <<-END.gsub(/^ +/, "")
|
24
|
-
BinData is a declarative way to read and write binary file formats.
|
25
|
-
|
26
|
-
This means the programmer specifies *what* the format of the binary
|
27
|
-
data is, and BinData works out *how* to read and write data in this
|
28
|
-
format. It is an easier ( and more readable ) alternative to
|
29
|
-
ruby's #pack and #unpack methods.
|
30
|
-
END
|
31
|
-
end
|
32
|
-
|
33
|
-
Gem::PackageTask.new(SPEC) do |pkg|
|
34
|
-
pkg.need_tar_gz = true
|
35
|
-
end
|
36
|
-
|
37
|
-
file "bindata.gemspec" => ["Rakefile", "lib/bindata.rb"] do |t|
|
38
|
-
require 'yaml'
|
39
|
-
open(t.name, "w") { |f| f.puts SPEC.to_yaml }
|
40
|
-
end
|
41
|
-
|
42
|
-
CLOBBER.include("bindata.gemspec")
|
43
|
-
|
44
|
-
desc "Create a stand-alone gemspec"
|
45
|
-
task :gemspec => "bindata.gemspec"
|
46
|
-
rescue LoadError
|
47
|
-
puts "RubyGems must be installed to build the package"
|
48
|
-
end
|