bindata 0.9.1 → 0.9.2

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/ChangeLog CHANGED
@@ -1,5 +1,13 @@
1
1
  = BinData Changelog
2
2
 
3
+ == Version 0.9.2 (2008-07-18)
4
+
5
+ * Added lazy instantiation to allow recursive definitions.
6
+ * Array elements can be appended at any position.
7
+ * Deprecated the :readwrite parameter.
8
+ * Removed feature where Struct fields names could be nil.
9
+ * Reworked sanitizing system.
10
+
3
11
  == Version 0.9.1 (2008-06-15)
4
12
 
5
13
  * Implemented bit fields.
data/TODO CHANGED
@@ -1,9 +1,3 @@
1
1
  * Think how offset_of should work.
2
2
 
3
- * Need optional parameter for fields
4
-
5
- * Should I add seek capability?
6
-
7
3
  * Add (Multi|Single)Value.custom_parameters
8
-
9
- * BitFields
data/lib/bindata.rb CHANGED
@@ -18,5 +18,5 @@ require 'bindata/struct'
18
18
  # A declarative way to read and write structured binary data.
19
19
  #
20
20
  module BinData
21
- VERSION = "0.9.1"
21
+ VERSION = "0.9.2"
22
22
  end
data/lib/bindata/array.rb CHANGED
@@ -60,7 +60,7 @@ module BinData
60
60
  class << self
61
61
  # Returns a sanitized +params+ that is of the form expected
62
62
  # by #initialize.
63
- def sanitize_parameters(params, endian = nil)
63
+ def sanitize_parameters(sanitizer, params)
64
64
  params = params.dup
65
65
 
66
66
  unless params.has_key?(:initial_length) or params.has_key?(:read_until)
@@ -68,19 +68,16 @@ module BinData
68
68
  params[:initial_length] = 0
69
69
  end
70
70
 
71
+ if params.has_key?(:read_length)
72
+ warn ":read_length is not used with arrays. You probably want to change this to :initial_length"
73
+ end
74
+
71
75
  if params.has_key?(:type)
72
76
  type, el_params = params[:type]
73
- klass = lookup(type, endian)
74
- raise TypeError, "unknown type '#{type}' for #{self}" if klass.nil?
75
- params[:type] = [klass, SanitizedParameters.new(klass, el_params, endian)]
77
+ params[:type] = sanitizer.sanitize(type, el_params)
76
78
  end
77
79
 
78
- super(params, endian)
79
- end
80
-
81
- # An array has no fields.
82
- def all_possible_field_names(sanitized_params)
83
- []
80
+ super(sanitizer, params)
84
81
  end
85
82
  end
86
83
 
@@ -104,7 +101,7 @@ module BinData
104
101
  elements.each { |f| return false if not f.clear? }
105
102
  true
106
103
  else
107
- elements[index].clear?
104
+ (index < elements.length) ? elements[index].clear? : true
108
105
  end
109
106
  end
110
107
 
@@ -116,7 +113,7 @@ module BinData
116
113
  # do nothing as the array is already clear
117
114
  elsif index.nil?
118
115
  @element_list = nil
119
- else
116
+ elsif index < elements.length
120
117
  elements[index].clear
121
118
  end
122
119
  end
@@ -127,16 +124,6 @@ module BinData
127
124
  return false
128
125
  end
129
126
 
130
- # An array has no fields.
131
- def field_names
132
- []
133
- end
134
-
135
- # Returns a snapshot of the data in this array.
136
- def snapshot
137
- elements.collect { |e| e.snapshot }
138
- end
139
-
140
127
  # To be called after calling #do_read.
141
128
  def done_read
142
129
  elements.each { |f| f.done_read }
@@ -146,15 +133,39 @@ module BinData
146
133
  # single_values then the +value+ may be provided to the call.
147
134
  # Returns the appended object, or value in the case of single_values.
148
135
  def append(value = nil)
136
+ # TODO: deprecate #append as it can be replaced with #push
149
137
  append_new_element
150
138
  self[-1] = value unless value.nil?
151
139
  self.last
152
140
  end
153
141
 
142
+ # Pushes the given object(s) on to the end of this array.
143
+ # This expression returns the array itself, so several appends may
144
+ # be chained together.
145
+ def push(*args)
146
+ args.each do |arg|
147
+ if @element_klass == arg.class
148
+ # TODO: need to modify arg.env to add_variable(:index) and
149
+ # to link arg.env to self.env
150
+ elements.push(arg)
151
+ else
152
+ append(arg)
153
+ end
154
+ end
155
+ self
156
+ end
157
+
154
158
  # Returns the element at +index+. If the element is a single_value
155
159
  # then the value of the element is returned instead.
156
- def [](*index)
157
- data = elements[*index]
160
+ def [](*args)
161
+ if args.length == 1 and ::Integer === args[0]
162
+ # extend array automatically
163
+ while args[0] >= elements.length
164
+ append_new_element
165
+ end
166
+ end
167
+
168
+ data = elements[*args]
158
169
  if data.respond_to?(:each)
159
170
  data.collect { |el| (el && el.single_value?) ? el.value : el }
160
171
  else
@@ -166,8 +177,14 @@ module BinData
166
177
  # Sets the element at +index+. If the element is a single_value
167
178
  # then the value of the element is set instead.
168
179
  def []=(index, value)
180
+ # extend array automatically
181
+ while index >= elements.length
182
+ append_new_element
183
+ end
184
+
169
185
  obj = elements[index]
170
186
  unless obj.single_value?
187
+ # TODO: allow setting objects, not just values
171
188
  raise NoMethodError, "undefined method `[]=' for #{self}", caller
172
189
  end
173
190
  obj.value = value
@@ -186,7 +203,12 @@ module BinData
186
203
  # form returns an empty array.
187
204
  def first(n = nil)
188
205
  if n.nil?
189
- self[0]
206
+ if elements.empty?
207
+ # explicitly return nil as arrays grow automatically
208
+ nil
209
+ else
210
+ self[0]
211
+ end
190
212
  else
191
213
  self[0, n]
192
214
  end
@@ -256,6 +278,11 @@ module BinData
256
278
  end
257
279
  end
258
280
 
281
+ # Returns a snapshot of the data in this array.
282
+ def _snapshot
283
+ elements.collect { |e| e.snapshot }
284
+ end
285
+
259
286
  # Returns the list of all elements in the array. The elements
260
287
  # will be instantiated on the first call to this method.
261
288
  def elements
data/lib/bindata/base.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'bindata/io'
2
2
  require 'bindata/lazy'
3
- require 'bindata/sanitize'
4
3
  require 'bindata/registry'
4
+ require 'bindata/sanitize'
5
5
  require 'stringio'
6
6
 
7
7
  module BinData
@@ -15,11 +15,11 @@ module BinData
15
15
  # Parameters may be provided at initialisation to control the behaviour of
16
16
  # an object. These params are:
17
17
  #
18
- # [<tt>:readwrite</tt>] If false, calls to #read or #write will
19
- # not perform any I/O. Default is true.
20
- # [<tt>:onlyif</tt>] This is an alias for :readwrite. It is generally
21
- # used to indicate a data object is optional.
22
- # not perform any I/O. Default is true.
18
+ # [<tt>:readwrite</tt>] Deprecated. An alias for :onlyif.
19
+ # [<tt>:onlyif</tt>] Used to indicate a data object is optional.
20
+ # if false, calls to #read or #write will not
21
+ # perform any I/O, #num_bytes will return 0 and
22
+ # #snapshot will return nil. Default is true.
23
23
  # [<tt>:check_offset</tt>] Raise an error if the current IO offset doesn't
24
24
  # meet this criteria. A boolean return indicates
25
25
  # success or failure. Any other return is compared
@@ -41,7 +41,8 @@ module BinData
41
41
  @mandatory_parameters = []
42
42
  ancestors[1..-1].each do |parent|
43
43
  if parent.respond_to?(:mandatory_parameters)
44
- @mandatory_parameters.concat(parent.mandatory_parameters)
44
+ pmp = parent.mandatory_parameters
45
+ @mandatory_parameters.concat(pmp)
45
46
  end
46
47
  end
47
48
  end
@@ -61,7 +62,8 @@ module BinData
61
62
  @optional_parameters = []
62
63
  ancestors[1..-1].each do |parent|
63
64
  if parent.respond_to?(:optional_parameters)
64
- @optional_parameters.concat(parent.optional_parameters)
65
+ pop = parent.optional_parameters
66
+ @optional_parameters.concat(pop)
65
67
  end
66
68
  end
67
69
  end
@@ -81,7 +83,8 @@ module BinData
81
83
  @default_parameters = {}
82
84
  ancestors[1..-1].each do |parent|
83
85
  if parent.respond_to?(:default_parameters)
84
- @default_parameters = @default_parameters.merge(parent.default_parameters)
86
+ pdp = parent.default_parameters
87
+ @default_parameters = @default_parameters.merge(pdp)
85
88
  end
86
89
  end
87
90
  end
@@ -100,7 +103,8 @@ module BinData
100
103
  @mutually_exclusive_parameters = []
101
104
  ancestors[1..-1].each do |parent|
102
105
  if parent.respond_to?(:mutually_exclusive_parameters)
103
- @mutually_exclusive_parameters.concat(parent.mutually_exclusive_parameters)
106
+ pmep = parent.mutually_exclusive_parameters
107
+ @mutually_exclusive_parameters.concat(pmep)
104
108
  end
105
109
  end
106
110
  end
@@ -117,12 +121,13 @@ module BinData
117
121
 
118
122
  # Returns a sanitized +params+ that is of the form expected
119
123
  # by #initialize.
120
- def sanitize_parameters(params, *args)
124
+ def sanitize_parameters(sanitizer, params, *args)
121
125
  params = params.dup
122
126
 
123
- # replace :onlyif with :readwrite
124
- if params.has_key?(:onlyif)
125
- params[:readwrite] = params.delete(:onlyif)
127
+ # replace :readwrite with :onlyif
128
+ if params.has_key?(:readwrite)
129
+ warn ":readwrite is deprecated. Replacing with :onlyif"
130
+ params[:onlyif] = params.delete(:readwrite)
126
131
  end
127
132
 
128
133
  # add default parameters
@@ -163,28 +168,11 @@ module BinData
163
168
  Registry.instance.register(name, klass)
164
169
  end
165
170
  private :register
166
-
167
- # Returns the class matching a previously registered +name+.
168
- def lookup(name, endian = nil)
169
- name = name.to_s
170
- klass = Registry.instance.lookup(name)
171
- if klass.nil? and endian != nil
172
- # lookup failed so attempt endian lookup
173
- if /^u?int\d{1,3}$/ =~ name
174
- new_name = name + ((endian == :little) ? "le" : "be")
175
- klass = Registry.instance.lookup(new_name)
176
- elsif ["float", "double"].include?(name)
177
- new_name = name + ((endian == :little) ? "_le" : "_be")
178
- klass = Registry.instance.lookup(new_name)
179
- end
180
- end
181
- klass
182
- end
183
171
  end
184
172
 
185
173
  # Define the parameters we use in this class.
186
174
  optional_parameters :check_offset, :adjust_offset
187
- default_parameters :readwrite => true
175
+ default_parameters :onlyif => true
188
176
  mutually_exclusive_parameters :check_offset, :adjust_offset
189
177
 
190
178
  # Creates a new data object.
@@ -194,7 +182,7 @@ module BinData
194
182
  # environment that these callable objects are evaluated in.
195
183
  def initialize(params = {}, env = nil)
196
184
  unless SanitizedParameters === params
197
- params = SanitizedParameters.new(self.class, params)
185
+ params = Sanitizer.sanitize(self, params)
198
186
  end
199
187
 
200
188
  @params = params.accepted_parameters
@@ -221,7 +209,7 @@ module BinData
221
209
  clear
222
210
  check_offset(io)
223
211
 
224
- if eval_param(:readwrite)
212
+ if eval_param(:onlyif)
225
213
  _do_read(io)
226
214
  end
227
215
  end
@@ -240,7 +228,7 @@ module BinData
240
228
  def do_write(io)
241
229
  raise ArgumentError, "io must be a BinData::IO" unless BinData::IO === io
242
230
 
243
- if eval_param(:readwrite)
231
+ if eval_param(:onlyif)
244
232
  _do_write(io)
245
233
  end
246
234
  end
@@ -254,13 +242,23 @@ module BinData
254
242
 
255
243
  # Returns the number of bytes it will take to write this data.
256
244
  def do_num_bytes(what = nil)
257
- if eval_param(:readwrite)
245
+ if eval_param(:onlyif)
258
246
  _do_num_bytes(what)
259
247
  else
260
248
  0
261
249
  end
262
250
  end
263
251
 
252
+ # Returns a snapshot of this data object.
253
+ # Returns nil if :onlyif is false
254
+ def snapshot
255
+ if eval_param(:onlyif)
256
+ _snapshot
257
+ else
258
+ nil
259
+ end
260
+ end
261
+
264
262
  # Returns the string representation of this data object.
265
263
  def to_s
266
264
  io = StringIO.new
@@ -336,14 +334,13 @@ module BinData
336
334
  ###########################################################################
337
335
  # To be implemented by subclasses
338
336
 
339
- # Returns a list of the names of all possible field names for an object
340
- # created with +sanitized_params+.
341
- def self.all_possible_field_names(sanitized_params)
337
+ # Resets the internal state to that of a newly created object.
338
+ def clear
342
339
  raise NotImplementedError
343
340
  end
344
341
 
345
- # Resets the internal state to that of a newly created object.
346
- def clear
342
+ # Returns true if the object has not been changed since creation.
343
+ def clear?(*args)
347
344
  raise NotImplementedError
348
345
  end
349
346
 
@@ -353,17 +350,6 @@ module BinData
353
350
  raise NotImplementedError
354
351
  end
355
352
 
356
- # Returns a list of the names of all fields accessible through this
357
- # object.
358
- def field_names
359
- raise NotImplementedError
360
- end
361
-
362
- # Returns a snapshot of this data object.
363
- def snapshot
364
- raise NotImplementedError
365
- end
366
-
367
353
  # To be called after calling #do_read.
368
354
  def done_read
369
355
  raise NotImplementedError
@@ -384,9 +370,14 @@ module BinData
384
370
  raise NotImplementedError
385
371
  end
386
372
 
373
+ # Returns a snapshot of this data object.
374
+ def _snapshot
375
+ raise NotImplementedError
376
+ end
377
+
387
378
  # Set visibility requirements of methods to implement
388
- public :clear, :single_value?, :field_names, :snapshot, :done_read
389
- private :_do_read, :_do_write, :_do_num_bytes
379
+ public :clear, :clear?, :single_value?, :done_read
380
+ private :_do_read, :_do_write, :_do_num_bytes, :_snapshot
390
381
 
391
382
  # End To be implemented by subclasses
392
383
  ###########################################################################
data/lib/bindata/bits.rb CHANGED
@@ -50,757 +50,757 @@ module BinData
50
50
  end
51
51
 
52
52
  # 1 bit big endian bitfield.
53
- class Bit1 < Single
53
+ class Bit1 < BinData::Single
54
54
  register(self.name, self)
55
55
  BitField.create_methods(self, 1, :big)
56
56
  end
57
57
 
58
58
  # 1 bit little endian bitfield.
59
- class Bit1le < Single
59
+ class Bit1le < BinData::Single
60
60
  register(self.name, self)
61
61
  BitField.create_methods(self, 1, :little)
62
62
  end
63
63
 
64
64
  # 2 bit big endian bitfield.
65
- class Bit2 < Single
65
+ class Bit2 < BinData::Single
66
66
  register(self.name, self)
67
67
  BitField.create_methods(self, 2, :big)
68
68
  end
69
69
 
70
70
  # 2 bit little endian bitfield.
71
- class Bit2le < Single
71
+ class Bit2le < BinData::Single
72
72
  register(self.name, self)
73
73
  BitField.create_methods(self, 2, :little)
74
74
  end
75
75
 
76
76
  # 3 bit big endian bitfield.
77
- class Bit3 < Single
77
+ class Bit3 < BinData::Single
78
78
  register(self.name, self)
79
79
  BitField.create_methods(self, 3, :big)
80
80
  end
81
81
 
82
82
  # 3 bit little endian bitfield.
83
- class Bit3le < Single
83
+ class Bit3le < BinData::Single
84
84
  register(self.name, self)
85
85
  BitField.create_methods(self, 3, :little)
86
86
  end
87
87
 
88
88
  # 4 bit big endian bitfield.
89
- class Bit4 < Single
89
+ class Bit4 < BinData::Single
90
90
  register(self.name, self)
91
91
  BitField.create_methods(self, 4, :big)
92
92
  end
93
93
 
94
94
  # 4 bit little endian bitfield.
95
- class Bit4le < Single
95
+ class Bit4le < BinData::Single
96
96
  register(self.name, self)
97
97
  BitField.create_methods(self, 4, :little)
98
98
  end
99
99
 
100
100
  # 5 bit big endian bitfield.
101
- class Bit5 < Single
101
+ class Bit5 < BinData::Single
102
102
  register(self.name, self)
103
103
  BitField.create_methods(self, 5, :big)
104
104
  end
105
105
 
106
106
  # 5 bit little endian bitfield.
107
- class Bit5le < Single
107
+ class Bit5le < BinData::Single
108
108
  register(self.name, self)
109
109
  BitField.create_methods(self, 5, :little)
110
110
  end
111
111
 
112
112
  # 6 bit big endian bitfield.
113
- class Bit6 < Single
113
+ class Bit6 < BinData::Single
114
114
  register(self.name, self)
115
115
  BitField.create_methods(self, 6, :big)
116
116
  end
117
117
 
118
118
  # 6 bit little endian bitfield.
119
- class Bit6le < Single
119
+ class Bit6le < BinData::Single
120
120
  register(self.name, self)
121
121
  BitField.create_methods(self, 6, :little)
122
122
  end
123
123
 
124
124
  # 7 bit big endian bitfield.
125
- class Bit7 < Single
125
+ class Bit7 < BinData::Single
126
126
  register(self.name, self)
127
127
  BitField.create_methods(self, 7, :big)
128
128
  end
129
129
 
130
130
  # 7 bit little endian bitfield.
131
- class Bit7le < Single
131
+ class Bit7le < BinData::Single
132
132
  register(self.name, self)
133
133
  BitField.create_methods(self, 7, :little)
134
134
  end
135
135
 
136
136
  # 8 bit big endian bitfield.
137
- class Bit8 < Single
137
+ class Bit8 < BinData::Single
138
138
  register(self.name, self)
139
139
  BitField.create_methods(self, 8, :big)
140
140
  end
141
141
 
142
142
  # 8 bit little endian bitfield.
143
- class Bit8le < Single
143
+ class Bit8le < BinData::Single
144
144
  register(self.name, self)
145
145
  BitField.create_methods(self, 8, :little)
146
146
  end
147
147
 
148
148
  # 9 bit big endian bitfield.
149
- class Bit9 < Single
149
+ class Bit9 < BinData::Single
150
150
  register(self.name, self)
151
151
  BitField.create_methods(self, 9, :big)
152
152
  end
153
153
 
154
154
  # 9 bit little endian bitfield.
155
- class Bit9le < Single
155
+ class Bit9le < BinData::Single
156
156
  register(self.name, self)
157
157
  BitField.create_methods(self, 9, :little)
158
158
  end
159
159
 
160
160
  # 10 bit big endian bitfield.
161
- class Bit10 < Single
161
+ class Bit10 < BinData::Single
162
162
  register(self.name, self)
163
163
  BitField.create_methods(self, 10, :big)
164
164
  end
165
165
 
166
166
  # 10 bit little endian bitfield.
167
- class Bit10le < Single
167
+ class Bit10le < BinData::Single
168
168
  register(self.name, self)
169
169
  BitField.create_methods(self, 10, :little)
170
170
  end
171
171
 
172
172
  # 11 bit big endian bitfield.
173
- class Bit11 < Single
173
+ class Bit11 < BinData::Single
174
174
  register(self.name, self)
175
175
  BitField.create_methods(self, 11, :big)
176
176
  end
177
177
 
178
178
  # 11 bit little endian bitfield.
179
- class Bit11le < Single
179
+ class Bit11le < BinData::Single
180
180
  register(self.name, self)
181
181
  BitField.create_methods(self, 11, :little)
182
182
  end
183
183
 
184
184
  # 12 bit big endian bitfield.
185
- class Bit12 < Single
185
+ class Bit12 < BinData::Single
186
186
  register(self.name, self)
187
187
  BitField.create_methods(self, 12, :big)
188
188
  end
189
189
 
190
190
  # 12 bit little endian bitfield.
191
- class Bit12le < Single
191
+ class Bit12le < BinData::Single
192
192
  register(self.name, self)
193
193
  BitField.create_methods(self, 12, :little)
194
194
  end
195
195
 
196
196
  # 13 bit big endian bitfield.
197
- class Bit13 < Single
197
+ class Bit13 < BinData::Single
198
198
  register(self.name, self)
199
199
  BitField.create_methods(self, 13, :big)
200
200
  end
201
201
 
202
202
  # 13 bit little endian bitfield.
203
- class Bit13le < Single
203
+ class Bit13le < BinData::Single
204
204
  register(self.name, self)
205
205
  BitField.create_methods(self, 13, :little)
206
206
  end
207
207
 
208
208
  # 14 bit big endian bitfield.
209
- class Bit14 < Single
209
+ class Bit14 < BinData::Single
210
210
  register(self.name, self)
211
211
  BitField.create_methods(self, 14, :big)
212
212
  end
213
213
 
214
214
  # 14 bit little endian bitfield.
215
- class Bit14le < Single
215
+ class Bit14le < BinData::Single
216
216
  register(self.name, self)
217
217
  BitField.create_methods(self, 14, :little)
218
218
  end
219
219
 
220
220
  # 15 bit big endian bitfield.
221
- class Bit15 < Single
221
+ class Bit15 < BinData::Single
222
222
  register(self.name, self)
223
223
  BitField.create_methods(self, 15, :big)
224
224
  end
225
225
 
226
226
  # 15 bit little endian bitfield.
227
- class Bit15le < Single
227
+ class Bit15le < BinData::Single
228
228
  register(self.name, self)
229
229
  BitField.create_methods(self, 15, :little)
230
230
  end
231
231
 
232
232
  # 16 bit big endian bitfield.
233
- class Bit16 < Single
233
+ class Bit16 < BinData::Single
234
234
  register(self.name, self)
235
235
  BitField.create_methods(self, 16, :big)
236
236
  end
237
237
 
238
238
  # 16 bit little endian bitfield.
239
- class Bit16le < Single
239
+ class Bit16le < BinData::Single
240
240
  register(self.name, self)
241
241
  BitField.create_methods(self, 16, :little)
242
242
  end
243
243
 
244
244
  # 17 bit big endian bitfield.
245
- class Bit17 < Single
245
+ class Bit17 < BinData::Single
246
246
  register(self.name, self)
247
247
  BitField.create_methods(self, 17, :big)
248
248
  end
249
249
 
250
250
  # 17 bit little endian bitfield.
251
- class Bit17le < Single
251
+ class Bit17le < BinData::Single
252
252
  register(self.name, self)
253
253
  BitField.create_methods(self, 17, :little)
254
254
  end
255
255
 
256
256
  # 18 bit big endian bitfield.
257
- class Bit18 < Single
257
+ class Bit18 < BinData::Single
258
258
  register(self.name, self)
259
259
  BitField.create_methods(self, 18, :big)
260
260
  end
261
261
 
262
262
  # 18 bit little endian bitfield.
263
- class Bit18le < Single
263
+ class Bit18le < BinData::Single
264
264
  register(self.name, self)
265
265
  BitField.create_methods(self, 18, :little)
266
266
  end
267
267
 
268
268
  # 19 bit big endian bitfield.
269
- class Bit19 < Single
269
+ class Bit19 < BinData::Single
270
270
  register(self.name, self)
271
271
  BitField.create_methods(self, 19, :big)
272
272
  end
273
273
 
274
274
  # 19 bit little endian bitfield.
275
- class Bit19le < Single
275
+ class Bit19le < BinData::Single
276
276
  register(self.name, self)
277
277
  BitField.create_methods(self, 19, :little)
278
278
  end
279
279
 
280
280
  # 20 bit big endian bitfield.
281
- class Bit20 < Single
281
+ class Bit20 < BinData::Single
282
282
  register(self.name, self)
283
283
  BitField.create_methods(self, 20, :big)
284
284
  end
285
285
 
286
286
  # 20 bit little endian bitfield.
287
- class Bit20le < Single
287
+ class Bit20le < BinData::Single
288
288
  register(self.name, self)
289
289
  BitField.create_methods(self, 20, :little)
290
290
  end
291
291
 
292
292
  # 21 bit big endian bitfield.
293
- class Bit21 < Single
293
+ class Bit21 < BinData::Single
294
294
  register(self.name, self)
295
295
  BitField.create_methods(self, 21, :big)
296
296
  end
297
297
 
298
298
  # 21 bit little endian bitfield.
299
- class Bit21le < Single
299
+ class Bit21le < BinData::Single
300
300
  register(self.name, self)
301
301
  BitField.create_methods(self, 21, :little)
302
302
  end
303
303
 
304
304
  # 22 bit big endian bitfield.
305
- class Bit22 < Single
305
+ class Bit22 < BinData::Single
306
306
  register(self.name, self)
307
307
  BitField.create_methods(self, 22, :big)
308
308
  end
309
309
 
310
310
  # 22 bit little endian bitfield.
311
- class Bit22le < Single
311
+ class Bit22le < BinData::Single
312
312
  register(self.name, self)
313
313
  BitField.create_methods(self, 22, :little)
314
314
  end
315
315
 
316
316
  # 23 bit big endian bitfield.
317
- class Bit23 < Single
317
+ class Bit23 < BinData::Single
318
318
  register(self.name, self)
319
319
  BitField.create_methods(self, 23, :big)
320
320
  end
321
321
 
322
322
  # 23 bit little endian bitfield.
323
- class Bit23le < Single
323
+ class Bit23le < BinData::Single
324
324
  register(self.name, self)
325
325
  BitField.create_methods(self, 23, :little)
326
326
  end
327
327
 
328
328
  # 24 bit big endian bitfield.
329
- class Bit24 < Single
329
+ class Bit24 < BinData::Single
330
330
  register(self.name, self)
331
331
  BitField.create_methods(self, 24, :big)
332
332
  end
333
333
 
334
334
  # 24 bit little endian bitfield.
335
- class Bit24le < Single
335
+ class Bit24le < BinData::Single
336
336
  register(self.name, self)
337
337
  BitField.create_methods(self, 24, :little)
338
338
  end
339
339
 
340
340
  # 25 bit big endian bitfield.
341
- class Bit25 < Single
341
+ class Bit25 < BinData::Single
342
342
  register(self.name, self)
343
343
  BitField.create_methods(self, 25, :big)
344
344
  end
345
345
 
346
346
  # 25 bit little endian bitfield.
347
- class Bit25le < Single
347
+ class Bit25le < BinData::Single
348
348
  register(self.name, self)
349
349
  BitField.create_methods(self, 25, :little)
350
350
  end
351
351
 
352
352
  # 26 bit big endian bitfield.
353
- class Bit26 < Single
353
+ class Bit26 < BinData::Single
354
354
  register(self.name, self)
355
355
  BitField.create_methods(self, 26, :big)
356
356
  end
357
357
 
358
358
  # 26 bit little endian bitfield.
359
- class Bit26le < Single
359
+ class Bit26le < BinData::Single
360
360
  register(self.name, self)
361
361
  BitField.create_methods(self, 26, :little)
362
362
  end
363
363
 
364
364
  # 27 bit big endian bitfield.
365
- class Bit27 < Single
365
+ class Bit27 < BinData::Single
366
366
  register(self.name, self)
367
367
  BitField.create_methods(self, 27, :big)
368
368
  end
369
369
 
370
370
  # 27 bit little endian bitfield.
371
- class Bit27le < Single
371
+ class Bit27le < BinData::Single
372
372
  register(self.name, self)
373
373
  BitField.create_methods(self, 27, :little)
374
374
  end
375
375
 
376
376
  # 28 bit big endian bitfield.
377
- class Bit28 < Single
377
+ class Bit28 < BinData::Single
378
378
  register(self.name, self)
379
379
  BitField.create_methods(self, 28, :big)
380
380
  end
381
381
 
382
382
  # 28 bit little endian bitfield.
383
- class Bit28le < Single
383
+ class Bit28le < BinData::Single
384
384
  register(self.name, self)
385
385
  BitField.create_methods(self, 28, :little)
386
386
  end
387
387
 
388
388
  # 29 bit big endian bitfield.
389
- class Bit29 < Single
389
+ class Bit29 < BinData::Single
390
390
  register(self.name, self)
391
391
  BitField.create_methods(self, 29, :big)
392
392
  end
393
393
 
394
394
  # 29 bit little endian bitfield.
395
- class Bit29le < Single
395
+ class Bit29le < BinData::Single
396
396
  register(self.name, self)
397
397
  BitField.create_methods(self, 29, :little)
398
398
  end
399
399
 
400
400
  # 30 bit big endian bitfield.
401
- class Bit30 < Single
401
+ class Bit30 < BinData::Single
402
402
  register(self.name, self)
403
403
  BitField.create_methods(self, 30, :big)
404
404
  end
405
405
 
406
406
  # 30 bit little endian bitfield.
407
- class Bit30le < Single
407
+ class Bit30le < BinData::Single
408
408
  register(self.name, self)
409
409
  BitField.create_methods(self, 30, :little)
410
410
  end
411
411
 
412
412
  # 31 bit big endian bitfield.
413
- class Bit31 < Single
413
+ class Bit31 < BinData::Single
414
414
  register(self.name, self)
415
415
  BitField.create_methods(self, 31, :big)
416
416
  end
417
417
 
418
418
  # 31 bit little endian bitfield.
419
- class Bit31le < Single
419
+ class Bit31le < BinData::Single
420
420
  register(self.name, self)
421
421
  BitField.create_methods(self, 31, :little)
422
422
  end
423
423
 
424
424
  # 32 bit big endian bitfield.
425
- class Bit32 < Single
425
+ class Bit32 < BinData::Single
426
426
  register(self.name, self)
427
427
  BitField.create_methods(self, 32, :big)
428
428
  end
429
429
 
430
430
  # 32 bit little endian bitfield.
431
- class Bit32le < Single
431
+ class Bit32le < BinData::Single
432
432
  register(self.name, self)
433
433
  BitField.create_methods(self, 32, :little)
434
434
  end
435
435
 
436
436
  # 33 bit big endian bitfield.
437
- class Bit33 < Single
437
+ class Bit33 < BinData::Single
438
438
  register(self.name, self)
439
439
  BitField.create_methods(self, 33, :big)
440
440
  end
441
441
 
442
442
  # 33 bit little endian bitfield.
443
- class Bit33le < Single
443
+ class Bit33le < BinData::Single
444
444
  register(self.name, self)
445
445
  BitField.create_methods(self, 33, :little)
446
446
  end
447
447
 
448
448
  # 34 bit big endian bitfield.
449
- class Bit34 < Single
449
+ class Bit34 < BinData::Single
450
450
  register(self.name, self)
451
451
  BitField.create_methods(self, 34, :big)
452
452
  end
453
453
 
454
454
  # 34 bit little endian bitfield.
455
- class Bit34le < Single
455
+ class Bit34le < BinData::Single
456
456
  register(self.name, self)
457
457
  BitField.create_methods(self, 34, :little)
458
458
  end
459
459
 
460
460
  # 35 bit big endian bitfield.
461
- class Bit35 < Single
461
+ class Bit35 < BinData::Single
462
462
  register(self.name, self)
463
463
  BitField.create_methods(self, 35, :big)
464
464
  end
465
465
 
466
466
  # 35 bit little endian bitfield.
467
- class Bit35le < Single
467
+ class Bit35le < BinData::Single
468
468
  register(self.name, self)
469
469
  BitField.create_methods(self, 35, :little)
470
470
  end
471
471
 
472
472
  # 36 bit big endian bitfield.
473
- class Bit36 < Single
473
+ class Bit36 < BinData::Single
474
474
  register(self.name, self)
475
475
  BitField.create_methods(self, 36, :big)
476
476
  end
477
477
 
478
478
  # 36 bit little endian bitfield.
479
- class Bit36le < Single
479
+ class Bit36le < BinData::Single
480
480
  register(self.name, self)
481
481
  BitField.create_methods(self, 36, :little)
482
482
  end
483
483
 
484
484
  # 37 bit big endian bitfield.
485
- class Bit37 < Single
485
+ class Bit37 < BinData::Single
486
486
  register(self.name, self)
487
487
  BitField.create_methods(self, 37, :big)
488
488
  end
489
489
 
490
490
  # 37 bit little endian bitfield.
491
- class Bit37le < Single
491
+ class Bit37le < BinData::Single
492
492
  register(self.name, self)
493
493
  BitField.create_methods(self, 37, :little)
494
494
  end
495
495
 
496
496
  # 38 bit big endian bitfield.
497
- class Bit38 < Single
497
+ class Bit38 < BinData::Single
498
498
  register(self.name, self)
499
499
  BitField.create_methods(self, 38, :big)
500
500
  end
501
501
 
502
502
  # 38 bit little endian bitfield.
503
- class Bit38le < Single
503
+ class Bit38le < BinData::Single
504
504
  register(self.name, self)
505
505
  BitField.create_methods(self, 38, :little)
506
506
  end
507
507
 
508
508
  # 39 bit big endian bitfield.
509
- class Bit39 < Single
509
+ class Bit39 < BinData::Single
510
510
  register(self.name, self)
511
511
  BitField.create_methods(self, 39, :big)
512
512
  end
513
513
 
514
514
  # 39 bit little endian bitfield.
515
- class Bit39le < Single
515
+ class Bit39le < BinData::Single
516
516
  register(self.name, self)
517
517
  BitField.create_methods(self, 39, :little)
518
518
  end
519
519
 
520
520
  # 40 bit big endian bitfield.
521
- class Bit40 < Single
521
+ class Bit40 < BinData::Single
522
522
  register(self.name, self)
523
523
  BitField.create_methods(self, 40, :big)
524
524
  end
525
525
 
526
526
  # 40 bit little endian bitfield.
527
- class Bit40le < Single
527
+ class Bit40le < BinData::Single
528
528
  register(self.name, self)
529
529
  BitField.create_methods(self, 40, :little)
530
530
  end
531
531
 
532
532
  # 41 bit big endian bitfield.
533
- class Bit41 < Single
533
+ class Bit41 < BinData::Single
534
534
  register(self.name, self)
535
535
  BitField.create_methods(self, 41, :big)
536
536
  end
537
537
 
538
538
  # 41 bit little endian bitfield.
539
- class Bit41le < Single
539
+ class Bit41le < BinData::Single
540
540
  register(self.name, self)
541
541
  BitField.create_methods(self, 41, :little)
542
542
  end
543
543
 
544
544
  # 42 bit big endian bitfield.
545
- class Bit42 < Single
545
+ class Bit42 < BinData::Single
546
546
  register(self.name, self)
547
547
  BitField.create_methods(self, 42, :big)
548
548
  end
549
549
 
550
550
  # 42 bit little endian bitfield.
551
- class Bit42le < Single
551
+ class Bit42le < BinData::Single
552
552
  register(self.name, self)
553
553
  BitField.create_methods(self, 42, :little)
554
554
  end
555
555
 
556
556
  # 43 bit big endian bitfield.
557
- class Bit43 < Single
557
+ class Bit43 < BinData::Single
558
558
  register(self.name, self)
559
559
  BitField.create_methods(self, 43, :big)
560
560
  end
561
561
 
562
562
  # 43 bit little endian bitfield.
563
- class Bit43le < Single
563
+ class Bit43le < BinData::Single
564
564
  register(self.name, self)
565
565
  BitField.create_methods(self, 43, :little)
566
566
  end
567
567
 
568
568
  # 44 bit big endian bitfield.
569
- class Bit44 < Single
569
+ class Bit44 < BinData::Single
570
570
  register(self.name, self)
571
571
  BitField.create_methods(self, 44, :big)
572
572
  end
573
573
 
574
574
  # 44 bit little endian bitfield.
575
- class Bit44le < Single
575
+ class Bit44le < BinData::Single
576
576
  register(self.name, self)
577
577
  BitField.create_methods(self, 44, :little)
578
578
  end
579
579
 
580
580
  # 45 bit big endian bitfield.
581
- class Bit45 < Single
581
+ class Bit45 < BinData::Single
582
582
  register(self.name, self)
583
583
  BitField.create_methods(self, 45, :big)
584
584
  end
585
585
 
586
586
  # 45 bit little endian bitfield.
587
- class Bit45le < Single
587
+ class Bit45le < BinData::Single
588
588
  register(self.name, self)
589
589
  BitField.create_methods(self, 45, :little)
590
590
  end
591
591
 
592
592
  # 46 bit big endian bitfield.
593
- class Bit46 < Single
593
+ class Bit46 < BinData::Single
594
594
  register(self.name, self)
595
595
  BitField.create_methods(self, 46, :big)
596
596
  end
597
597
 
598
598
  # 46 bit little endian bitfield.
599
- class Bit46le < Single
599
+ class Bit46le < BinData::Single
600
600
  register(self.name, self)
601
601
  BitField.create_methods(self, 46, :little)
602
602
  end
603
603
 
604
604
  # 47 bit big endian bitfield.
605
- class Bit47 < Single
605
+ class Bit47 < BinData::Single
606
606
  register(self.name, self)
607
607
  BitField.create_methods(self, 47, :big)
608
608
  end
609
609
 
610
610
  # 47 bit little endian bitfield.
611
- class Bit47le < Single
611
+ class Bit47le < BinData::Single
612
612
  register(self.name, self)
613
613
  BitField.create_methods(self, 47, :little)
614
614
  end
615
615
 
616
616
  # 48 bit big endian bitfield.
617
- class Bit48 < Single
617
+ class Bit48 < BinData::Single
618
618
  register(self.name, self)
619
619
  BitField.create_methods(self, 48, :big)
620
620
  end
621
621
 
622
622
  # 48 bit little endian bitfield.
623
- class Bit48le < Single
623
+ class Bit48le < BinData::Single
624
624
  register(self.name, self)
625
625
  BitField.create_methods(self, 48, :little)
626
626
  end
627
627
 
628
628
  # 49 bit big endian bitfield.
629
- class Bit49 < Single
629
+ class Bit49 < BinData::Single
630
630
  register(self.name, self)
631
631
  BitField.create_methods(self, 49, :big)
632
632
  end
633
633
 
634
634
  # 49 bit little endian bitfield.
635
- class Bit49le < Single
635
+ class Bit49le < BinData::Single
636
636
  register(self.name, self)
637
637
  BitField.create_methods(self, 49, :little)
638
638
  end
639
639
 
640
640
  # 50 bit big endian bitfield.
641
- class Bit50 < Single
641
+ class Bit50 < BinData::Single
642
642
  register(self.name, self)
643
643
  BitField.create_methods(self, 50, :big)
644
644
  end
645
645
 
646
646
  # 50 bit little endian bitfield.
647
- class Bit50le < Single
647
+ class Bit50le < BinData::Single
648
648
  register(self.name, self)
649
649
  BitField.create_methods(self, 50, :little)
650
650
  end
651
651
 
652
652
  # 51 bit big endian bitfield.
653
- class Bit51 < Single
653
+ class Bit51 < BinData::Single
654
654
  register(self.name, self)
655
655
  BitField.create_methods(self, 51, :big)
656
656
  end
657
657
 
658
658
  # 51 bit little endian bitfield.
659
- class Bit51le < Single
659
+ class Bit51le < BinData::Single
660
660
  register(self.name, self)
661
661
  BitField.create_methods(self, 51, :little)
662
662
  end
663
663
 
664
664
  # 52 bit big endian bitfield.
665
- class Bit52 < Single
665
+ class Bit52 < BinData::Single
666
666
  register(self.name, self)
667
667
  BitField.create_methods(self, 52, :big)
668
668
  end
669
669
 
670
670
  # 52 bit little endian bitfield.
671
- class Bit52le < Single
671
+ class Bit52le < BinData::Single
672
672
  register(self.name, self)
673
673
  BitField.create_methods(self, 52, :little)
674
674
  end
675
675
 
676
676
  # 53 bit big endian bitfield.
677
- class Bit53 < Single
677
+ class Bit53 < BinData::Single
678
678
  register(self.name, self)
679
679
  BitField.create_methods(self, 53, :big)
680
680
  end
681
681
 
682
682
  # 53 bit little endian bitfield.
683
- class Bit53le < Single
683
+ class Bit53le < BinData::Single
684
684
  register(self.name, self)
685
685
  BitField.create_methods(self, 53, :little)
686
686
  end
687
687
 
688
688
  # 54 bit big endian bitfield.
689
- class Bit54 < Single
689
+ class Bit54 < BinData::Single
690
690
  register(self.name, self)
691
691
  BitField.create_methods(self, 54, :big)
692
692
  end
693
693
 
694
694
  # 54 bit little endian bitfield.
695
- class Bit54le < Single
695
+ class Bit54le < BinData::Single
696
696
  register(self.name, self)
697
697
  BitField.create_methods(self, 54, :little)
698
698
  end
699
699
 
700
700
  # 55 bit big endian bitfield.
701
- class Bit55 < Single
701
+ class Bit55 < BinData::Single
702
702
  register(self.name, self)
703
703
  BitField.create_methods(self, 55, :big)
704
704
  end
705
705
 
706
706
  # 55 bit little endian bitfield.
707
- class Bit55le < Single
707
+ class Bit55le < BinData::Single
708
708
  register(self.name, self)
709
709
  BitField.create_methods(self, 55, :little)
710
710
  end
711
711
 
712
712
  # 56 bit big endian bitfield.
713
- class Bit56 < Single
713
+ class Bit56 < BinData::Single
714
714
  register(self.name, self)
715
715
  BitField.create_methods(self, 56, :big)
716
716
  end
717
717
 
718
718
  # 56 bit little endian bitfield.
719
- class Bit56le < Single
719
+ class Bit56le < BinData::Single
720
720
  register(self.name, self)
721
721
  BitField.create_methods(self, 56, :little)
722
722
  end
723
723
 
724
724
  # 57 bit big endian bitfield.
725
- class Bit57 < Single
725
+ class Bit57 < BinData::Single
726
726
  register(self.name, self)
727
727
  BitField.create_methods(self, 57, :big)
728
728
  end
729
729
 
730
730
  # 57 bit little endian bitfield.
731
- class Bit57le < Single
731
+ class Bit57le < BinData::Single
732
732
  register(self.name, self)
733
733
  BitField.create_methods(self, 57, :little)
734
734
  end
735
735
 
736
736
  # 58 bit big endian bitfield.
737
- class Bit58 < Single
737
+ class Bit58 < BinData::Single
738
738
  register(self.name, self)
739
739
  BitField.create_methods(self, 58, :big)
740
740
  end
741
741
 
742
742
  # 58 bit little endian bitfield.
743
- class Bit58le < Single
743
+ class Bit58le < BinData::Single
744
744
  register(self.name, self)
745
745
  BitField.create_methods(self, 58, :little)
746
746
  end
747
747
 
748
748
  # 59 bit big endian bitfield.
749
- class Bit59 < Single
749
+ class Bit59 < BinData::Single
750
750
  register(self.name, self)
751
751
  BitField.create_methods(self, 59, :big)
752
752
  end
753
753
 
754
754
  # 59 bit little endian bitfield.
755
- class Bit59le < Single
755
+ class Bit59le < BinData::Single
756
756
  register(self.name, self)
757
757
  BitField.create_methods(self, 59, :little)
758
758
  end
759
759
 
760
760
  # 60 bit big endian bitfield.
761
- class Bit60 < Single
761
+ class Bit60 < BinData::Single
762
762
  register(self.name, self)
763
763
  BitField.create_methods(self, 60, :big)
764
764
  end
765
765
 
766
766
  # 60 bit little endian bitfield.
767
- class Bit60le < Single
767
+ class Bit60le < BinData::Single
768
768
  register(self.name, self)
769
769
  BitField.create_methods(self, 60, :little)
770
770
  end
771
771
 
772
772
  # 61 bit big endian bitfield.
773
- class Bit61 < Single
773
+ class Bit61 < BinData::Single
774
774
  register(self.name, self)
775
775
  BitField.create_methods(self, 61, :big)
776
776
  end
777
777
 
778
778
  # 61 bit little endian bitfield.
779
- class Bit61le < Single
779
+ class Bit61le < BinData::Single
780
780
  register(self.name, self)
781
781
  BitField.create_methods(self, 61, :little)
782
782
  end
783
783
 
784
784
  # 62 bit big endian bitfield.
785
- class Bit62 < Single
785
+ class Bit62 < BinData::Single
786
786
  register(self.name, self)
787
787
  BitField.create_methods(self, 62, :big)
788
788
  end
789
789
 
790
790
  # 62 bit little endian bitfield.
791
- class Bit62le < Single
791
+ class Bit62le < BinData::Single
792
792
  register(self.name, self)
793
793
  BitField.create_methods(self, 62, :little)
794
794
  end
795
795
 
796
796
  # 63 bit big endian bitfield.
797
- class Bit63 < Single
797
+ class Bit63 < BinData::Single
798
798
  register(self.name, self)
799
799
  BitField.create_methods(self, 63, :big)
800
800
  end
801
801
 
802
802
  # 63 bit little endian bitfield.
803
- class Bit63le < Single
803
+ class Bit63le < BinData::Single
804
804
  register(self.name, self)
805
805
  BitField.create_methods(self, 63, :little)
806
806
  end