bindata 0.11.1 → 1.0.0
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 +11 -4
- data/NEWS +11 -0
- data/README +1054 -211
- data/Rakefile +1 -0
- data/TODO +0 -16
- data/examples/ip_address.rb +23 -0
- data/lib/bindata.rb +9 -1
- data/lib/bindata/array.rb +5 -7
- data/lib/bindata/base.rb +29 -17
- data/lib/bindata/base_primitive.rb +5 -5
- data/lib/bindata/bits.rb +1 -1
- data/lib/bindata/choice.rb +7 -15
- data/lib/bindata/deprecated.rb +4 -135
- data/lib/bindata/float.rb +1 -1
- data/lib/bindata/int.rb +1 -1
- data/lib/bindata/io.rb +11 -1
- data/lib/bindata/params.rb +11 -2
- data/lib/bindata/primitive.rb +12 -11
- data/lib/bindata/record.rb +9 -8
- data/lib/bindata/sanitize.rb +3 -1
- data/lib/bindata/string.rb +8 -3
- data/lib/bindata/stringz.rb +7 -2
- data/lib/bindata/struct.rb +11 -13
- data/lib/bindata/wrapper.rb +10 -17
- data/manual.haml +301 -0
- data/spec/array_spec.rb +1 -1
- data/spec/base_primitive_spec.rb +6 -6
- data/spec/base_spec.rb +6 -29
- data/spec/choice_spec.rb +2 -2
- data/spec/deprecated_spec.rb +4 -73
- data/spec/io_spec.rb +1 -1
- data/spec/record_spec.rb +43 -11
- data/spec/struct_spec.rb +1 -1
- data/tasks/manual.rake +36 -0
- data/tasks/pkg.rake +2 -2
- data/tasks/rdoc.rake +2 -2
- metadata +7 -5
- data/TUTORIAL +0 -949
data/lib/bindata/float.rb
CHANGED
data/lib/bindata/int.rb
CHANGED
data/lib/bindata/io.rb
CHANGED
@@ -1,8 +1,18 @@
|
|
1
|
+
require 'stringio'
|
2
|
+
|
1
3
|
module BinData
|
2
4
|
# A wrapper around an IO object. The wrapper provides a consistent
|
3
5
|
# interface for BinData objects to use when accessing the IO.
|
4
6
|
class IO
|
5
7
|
|
8
|
+
# Creates a StringIO around +str+.
|
9
|
+
def self.create_string_io(str = "")
|
10
|
+
if RUBY_VERSION >= "1.9"
|
11
|
+
str = str.dup.force_encoding(Encoding::BINARY)
|
12
|
+
end
|
13
|
+
StringIO.new(str)
|
14
|
+
end
|
15
|
+
|
6
16
|
# Create a new IO wrapper around +io+. +io+ must support #read if used
|
7
17
|
# for reading, #write if used for writing, #pos if reading the current
|
8
18
|
# stream position and #seek if setting the current stream position. If
|
@@ -25,7 +35,7 @@ module BinData
|
|
25
35
|
|
26
36
|
# wrap strings in a StringIO
|
27
37
|
if io.respond_to?(:to_str)
|
28
|
-
io =
|
38
|
+
io = BinData::IO.create_string_io(io.to_str)
|
29
39
|
end
|
30
40
|
|
31
41
|
@raw_io = io
|
data/lib/bindata/params.rb
CHANGED
@@ -6,6 +6,16 @@ module BinData
|
|
6
6
|
# mandatory, optional, default or mutually exclusive.
|
7
7
|
class AcceptedParameters
|
8
8
|
|
9
|
+
def self.invalid_parameter_names
|
10
|
+
unless defined? @invalid_names
|
11
|
+
all_names = LazyEvaluator.instance_methods(true) + Kernel.methods
|
12
|
+
all_names.collect! { |name| name.to_s }
|
13
|
+
allowed_names = ["type"]
|
14
|
+
@invalid_names = all_names - allowed_names
|
15
|
+
end
|
16
|
+
@invalid_names
|
17
|
+
end
|
18
|
+
|
9
19
|
def initialize(ancestor_params = nil)
|
10
20
|
@mandatory = ancestor_params ? ancestor_params.mandatory : []
|
11
21
|
@optional = ancestor_params ? ancestor_params.optional : []
|
@@ -59,8 +69,7 @@ module BinData
|
|
59
69
|
private
|
60
70
|
|
61
71
|
def ensure_valid_names(names)
|
62
|
-
invalid_names =
|
63
|
-
Kernel.methods - ["type"]
|
72
|
+
invalid_names = self.class.invalid_parameter_names
|
64
73
|
names.each do |name|
|
65
74
|
name = name.to_s
|
66
75
|
if invalid_names.include?(name)
|
data/lib/bindata/primitive.rb
CHANGED
@@ -72,12 +72,13 @@ module BinData
|
|
72
72
|
if [:little, :big].include?(endian)
|
73
73
|
@endian = endian
|
74
74
|
elsif endian != nil
|
75
|
-
raise ArgumentError,
|
75
|
+
raise ArgumentError,
|
76
|
+
"unknown value for endian '#{endian}' in #{self}", caller(1)
|
76
77
|
end
|
77
78
|
@endian
|
78
79
|
end
|
79
80
|
|
80
|
-
def method_missing(symbol, *args)
|
81
|
+
def method_missing(symbol, *args) #:nodoc:
|
81
82
|
name, params = args
|
82
83
|
|
83
84
|
type = symbol
|
@@ -87,7 +88,7 @@ module BinData
|
|
87
88
|
append_field(type, name, params)
|
88
89
|
end
|
89
90
|
|
90
|
-
def sanitize_parameters!(params, sanitizer)
|
91
|
+
def sanitize_parameters!(params, sanitizer) #:nodoc:
|
91
92
|
struct_params = {}
|
92
93
|
struct_params[:fields] = fields
|
93
94
|
struct_params[:endian] = endian unless endian.nil?
|
@@ -110,17 +111,17 @@ module BinData
|
|
110
111
|
ensure_valid_name(name)
|
111
112
|
|
112
113
|
fields.add_field(type, name, params)
|
113
|
-
rescue
|
114
|
-
raise TypeError, "unknown type '#{
|
114
|
+
rescue UnknownTypeError => err
|
115
|
+
raise TypeError, "unknown type '#{err.message}' for #{self}", caller(2)
|
115
116
|
end
|
116
117
|
|
117
118
|
def ensure_valid_name(name)
|
118
119
|
if fields.field_names.include?(name)
|
119
120
|
raise SyntaxError, "duplicate field '#{name}' in #{self}", caller(3)
|
120
121
|
end
|
121
|
-
if self.instance_methods.include?(name)
|
122
|
+
if self.instance_methods.collect { |meth| meth.to_s }.include?(name)
|
122
123
|
raise NameError.new("", name),
|
123
|
-
"field '#{name}' shadows an existing method", caller(3)
|
124
|
+
"field '#{name}' shadows an existing method in #{self}", caller(3)
|
124
125
|
end
|
125
126
|
end
|
126
127
|
end
|
@@ -133,16 +134,16 @@ module BinData
|
|
133
134
|
@struct = BinData::Struct.new(get_parameter(:struct_params), self)
|
134
135
|
end
|
135
136
|
|
136
|
-
def method_missing(symbol, *args, &block)
|
137
|
+
def method_missing(symbol, *args, &block) #:nodoc:
|
137
138
|
@struct.__send__(symbol, *args, &block)
|
138
139
|
end
|
139
140
|
|
140
|
-
def debug_name_of(child)
|
141
|
+
def debug_name_of(child) #:nodoc:
|
141
142
|
debug_name + "-internal-"
|
142
143
|
end
|
143
144
|
|
144
|
-
def offset_of(child)
|
145
|
-
|
145
|
+
def offset_of(child) #:nodoc:
|
146
|
+
@struct.offset_of(child)
|
146
147
|
end
|
147
148
|
|
148
149
|
#---------------
|
data/lib/bindata/record.rb
CHANGED
@@ -56,7 +56,8 @@ module BinData
|
|
56
56
|
if [:little, :big].include?(endian)
|
57
57
|
@endian = endian
|
58
58
|
elsif endian != nil
|
59
|
-
raise ArgumentError,
|
59
|
+
raise ArgumentError,
|
60
|
+
"unknown value for endian '#{endian}' in #{self}", caller(1)
|
60
61
|
end
|
61
62
|
@endian
|
62
63
|
end
|
@@ -67,7 +68,7 @@ module BinData
|
|
67
68
|
@hide
|
68
69
|
end
|
69
70
|
|
70
|
-
def method_missing(symbol, *args)
|
71
|
+
def method_missing(symbol, *args) #:nodoc:
|
71
72
|
name, params = args
|
72
73
|
|
73
74
|
type = symbol
|
@@ -77,7 +78,7 @@ module BinData
|
|
77
78
|
append_field(type, name, params)
|
78
79
|
end
|
79
80
|
|
80
|
-
def sanitize_parameters!(params, sanitizer)
|
81
|
+
def sanitize_parameters!(params, sanitizer) #:nodoc:
|
81
82
|
params[:fields] = fields
|
82
83
|
params[:endian] = endian unless endian.nil?
|
83
84
|
params[:hide] = hide unless hide.empty?
|
@@ -100,21 +101,21 @@ module BinData
|
|
100
101
|
ensure_valid_name(name)
|
101
102
|
|
102
103
|
fields.add_field(type, name, params)
|
103
|
-
rescue
|
104
|
-
raise TypeError, "unknown type '#{
|
104
|
+
rescue UnknownTypeError => err
|
105
|
+
raise TypeError, "unknown type '#{err.message}' for #{self}", caller(2)
|
105
106
|
end
|
106
107
|
|
107
108
|
def ensure_valid_name(name)
|
108
109
|
if fields.field_names.include?(name)
|
109
110
|
raise SyntaxError, "duplicate field '#{name}' in #{self}", caller(3)
|
110
111
|
end
|
111
|
-
if self.instance_methods.include?(name)
|
112
|
+
if self.instance_methods.collect { |meth| meth.to_s }.include?(name)
|
112
113
|
raise NameError.new("", name),
|
113
|
-
"field '#{name}' shadows an existing method", caller(3)
|
114
|
+
"field '#{name}' shadows an existing method in #{self}", caller(3)
|
114
115
|
end
|
115
116
|
if self::RESERVED.include?(name)
|
116
117
|
raise NameError.new("", name),
|
117
|
-
"field '#{name}' is a reserved name", caller(3)
|
118
|
+
"field '#{name}' is a reserved name in #{self}", caller(3)
|
118
119
|
end
|
119
120
|
end
|
120
121
|
end
|
data/lib/bindata/sanitize.rb
CHANGED
@@ -2,6 +2,8 @@ require 'bindata/registry'
|
|
2
2
|
|
3
3
|
module BinData
|
4
4
|
|
5
|
+
class UnknownTypeError < StandardError ; end
|
6
|
+
|
5
7
|
# A BinData object accepts arbitrary parameters. This class sanitizes
|
6
8
|
# those parameters so they can be used by the BinData object.
|
7
9
|
class SanitizedParameters
|
@@ -169,7 +171,7 @@ module BinData
|
|
169
171
|
def lookup_class(type)
|
170
172
|
registered_class = RegisteredClasses.lookup(type, @endian)
|
171
173
|
if registered_class.nil?
|
172
|
-
raise
|
174
|
+
raise UnknownTypeError, type.to_s
|
173
175
|
end
|
174
176
|
registered_class
|
175
177
|
end
|
data/lib/bindata/string.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "bindata/base_primitive"
|
2
2
|
|
3
3
|
module BinData
|
4
|
-
# A String is a sequence of bytes. This is the same as strings in Ruby.
|
4
|
+
# A String is a sequence of bytes. This is the same as strings in Ruby 1.8.
|
5
5
|
# The issue of character encoding is ignored by this class.
|
6
6
|
#
|
7
7
|
# require 'bindata'
|
@@ -56,7 +56,7 @@ module BinData
|
|
56
56
|
|
57
57
|
class << self
|
58
58
|
|
59
|
-
def sanitize_parameters!(params, sanitizer)
|
59
|
+
def sanitize_parameters!(params, sanitizer) #:nodoc:
|
60
60
|
warn_replacement_parameter(params, :initial_length, :read_length)
|
61
61
|
|
62
62
|
if params.has_parameter?(:pad_char)
|
@@ -69,7 +69,7 @@ module BinData
|
|
69
69
|
private
|
70
70
|
|
71
71
|
def sanitized_pad_char(ch)
|
72
|
-
result = ch.
|
72
|
+
result = ch.is_a?(Integer) ? ch.chr : ch.to_s
|
73
73
|
if result.length > 1
|
74
74
|
raise ArgumentError, ":pad_char must not contain more than 1 char"
|
75
75
|
end
|
@@ -80,6 +80,11 @@ module BinData
|
|
80
80
|
#---------------
|
81
81
|
private
|
82
82
|
|
83
|
+
def _assign(val)
|
84
|
+
val = val.dup.force_encoding(Encoding::BINARY) if RUBY_VERSION >= "1.9"
|
85
|
+
super(val)
|
86
|
+
end
|
87
|
+
|
83
88
|
def _snapshot
|
84
89
|
# override to ensure length and optionally trim padding
|
85
90
|
result = super
|
data/lib/bindata/stringz.rb
CHANGED
@@ -34,6 +34,11 @@ module BinData
|
|
34
34
|
#---------------
|
35
35
|
private
|
36
36
|
|
37
|
+
def _assign(val)
|
38
|
+
val = val.dup.force_encoding(Encoding::BINARY) if RUBY_VERSION >= "1.9"
|
39
|
+
super(val)
|
40
|
+
end
|
41
|
+
|
37
42
|
def _snapshot
|
38
43
|
# override to always remove trailing zero bytes
|
39
44
|
result = super
|
@@ -65,12 +70,12 @@ module BinData
|
|
65
70
|
end
|
66
71
|
|
67
72
|
def trim_and_zero_terminate(str)
|
68
|
-
str =
|
73
|
+
str = truncate_after_first_zero_byte(str)
|
69
74
|
str = trim_to(str, eval_parameter(:max_length))
|
70
75
|
append_zero_byte_if_needed(str)
|
71
76
|
end
|
72
77
|
|
73
|
-
def
|
78
|
+
def truncate_after_first_zero_byte(str)
|
74
79
|
str.sub(/([^\0]*\0).*/, '\1')
|
75
80
|
end
|
76
81
|
|
data/lib/bindata/struct.rb
CHANGED
@@ -49,7 +49,7 @@ module BinData
|
|
49
49
|
register(self.name, self)
|
50
50
|
|
51
51
|
# These reserved words may not be used as field names
|
52
|
-
RESERVED = (::Hash.instance_methods +
|
52
|
+
RESERVED = (::Hash.instance_methods.collect { |meth| meth.to_s } +
|
53
53
|
%w{alias and begin break case class def defined do else elsif
|
54
54
|
end ensure false for if in module next nil not or redo
|
55
55
|
rescue retry return self super then true undef unless until
|
@@ -69,7 +69,7 @@ module BinData
|
|
69
69
|
|
70
70
|
class << self
|
71
71
|
|
72
|
-
def sanitize_parameters!(params, sanitizer)
|
72
|
+
def sanitize_parameters!(params, sanitizer) #:nodoc:
|
73
73
|
sanitize_endian(params, sanitizer)
|
74
74
|
sanitize_fields(params, sanitizer)
|
75
75
|
sanitize_hide(params, sanitizer)
|
@@ -116,7 +116,7 @@ module BinData
|
|
116
116
|
end
|
117
117
|
|
118
118
|
def ensure_field_names_are_valid(field_names)
|
119
|
-
instance_methods = self.instance_methods
|
119
|
+
instance_methods = self.instance_methods.collect { |meth| meth.to_s }
|
120
120
|
reserved_names = RESERVED
|
121
121
|
|
122
122
|
field_names.each do |name|
|
@@ -146,11 +146,11 @@ module BinData
|
|
146
146
|
@field_objs = []
|
147
147
|
end
|
148
148
|
|
149
|
-
def clear
|
149
|
+
def clear #:nodoc:
|
150
150
|
@field_objs.each { |f| f.clear unless f.nil? }
|
151
151
|
end
|
152
152
|
|
153
|
-
def clear?
|
153
|
+
def clear? #:nodoc:
|
154
154
|
@field_objs.inject(true) { |all_clear, f| all_clear and (f.nil? or f.clear?) }
|
155
155
|
end
|
156
156
|
|
@@ -166,12 +166,12 @@ module BinData
|
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
169
|
-
def respond_to?(symbol, include_private = false)
|
169
|
+
def respond_to?(symbol, include_private = false) #:nodoc:
|
170
170
|
super(symbol, include_private) ||
|
171
171
|
field_names(true).include?(symbol.to_s.chomp("="))
|
172
172
|
end
|
173
173
|
|
174
|
-
def method_missing(symbol, *args, &block)
|
174
|
+
def method_missing(symbol, *args, &block) #:nodoc:
|
175
175
|
obj = find_obj_for_name(symbol)
|
176
176
|
if obj
|
177
177
|
invoke_field(obj, symbol, args)
|
@@ -180,17 +180,15 @@ module BinData
|
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
183
|
-
def debug_name_of(child)
|
183
|
+
def debug_name_of(child) #:nodoc:
|
184
184
|
field_name = @field_names[find_index_of(child)]
|
185
185
|
"#{debug_name}.#{field_name}"
|
186
186
|
end
|
187
187
|
|
188
|
-
def offset_of(child)
|
188
|
+
def offset_of(child) #:nodoc:
|
189
189
|
instantiate_all_objs
|
190
190
|
sum = sum_num_bytes_below_index(find_index_of(child))
|
191
|
-
|
192
|
-
|
193
|
-
offset + child_offset
|
191
|
+
child.do_num_bytes.is_a?(Integer) ? sum.ceil : sum.floor
|
194
192
|
end
|
195
193
|
|
196
194
|
#---------------
|
@@ -247,7 +245,7 @@ module BinData
|
|
247
245
|
@field_objs.each { |f| f.do_write(io) if include_obj(f) }
|
248
246
|
end
|
249
247
|
|
250
|
-
def _do_num_bytes
|
248
|
+
def _do_num_bytes
|
251
249
|
instantiate_all_objs
|
252
250
|
sum_num_bytes_for_all_fields.ceil
|
253
251
|
end
|
data/lib/bindata/wrapper.rb
CHANGED
@@ -32,19 +32,20 @@ module BinData
|
|
32
32
|
if [:little, :big].include?(endian)
|
33
33
|
@endian = endian
|
34
34
|
elsif endian != nil
|
35
|
-
raise ArgumentError,
|
35
|
+
raise ArgumentError,
|
36
|
+
"unknown value for endian '#{endian}' in #{self}", caller(1)
|
36
37
|
end
|
37
38
|
@endian
|
38
39
|
end
|
39
40
|
|
40
|
-
def method_missing(symbol, *args)
|
41
|
+
def method_missing(symbol, *args) #:nodoc:
|
41
42
|
type = symbol
|
42
43
|
params = args.length == 0 ? {} : args[0]
|
43
44
|
|
44
45
|
set_wrapped(type, params)
|
45
46
|
end
|
46
47
|
|
47
|
-
def sanitize_parameters!(params, sanitizer)
|
48
|
+
def sanitize_parameters!(params, sanitizer) #:nodoc:
|
48
49
|
raise "Nothing to wrap" unless defined? @wrapped
|
49
50
|
|
50
51
|
wrapped_type, wrapped_params = @wrapped
|
@@ -81,27 +82,19 @@ module BinData
|
|
81
82
|
@wrapped = prototype.instantiate(self)
|
82
83
|
end
|
83
84
|
|
84
|
-
def clear
|
85
|
+
def clear #:nodoc:
|
85
86
|
wrapped.clear
|
86
87
|
end
|
87
88
|
|
88
|
-
def clear?
|
89
|
+
def clear? #:nodoc:
|
89
90
|
wrapped.clear?
|
90
91
|
end
|
91
92
|
|
92
|
-
def
|
93
|
-
debug_name
|
94
|
-
end
|
95
|
-
|
96
|
-
def offset_of(child)
|
97
|
-
offset
|
98
|
-
end
|
99
|
-
|
100
|
-
def respond_to?(symbol, include_private = false)
|
93
|
+
def respond_to?(symbol, include_private = false) #:nodoc:
|
101
94
|
super || wrapped.respond_to?(symbol, include_private)
|
102
95
|
end
|
103
96
|
|
104
|
-
def method_missing(symbol, *args, &block)
|
97
|
+
def method_missing(symbol, *args, &block) #:nodoc:
|
105
98
|
wrapped.__send__(symbol, *args, &block)
|
106
99
|
end
|
107
100
|
|
@@ -124,8 +117,8 @@ module BinData
|
|
124
117
|
wrapped.do_write(io)
|
125
118
|
end
|
126
119
|
|
127
|
-
def _do_num_bytes
|
128
|
-
wrapped.do_num_bytes
|
120
|
+
def _do_num_bytes
|
121
|
+
wrapped.do_num_bytes
|
129
122
|
end
|
130
123
|
|
131
124
|
def _assign(val)
|
data/manual.haml
ADDED
@@ -0,0 +1,301 @@
|
|
1
|
+
!!!
|
2
|
+
%html{ :xmlns => "http://www.w3.org/1999/xhtml" }
|
3
|
+
%head
|
4
|
+
%meta{ :content => "text/html; charset=iso-8859-1", "http-equiv" => "Content-Type" }
|
5
|
+
%title
|
6
|
+
BinData Reference Manual
|
7
|
+
:javascript
|
8
|
+
var TINY={};function T$(i){return document.getElementById(i)}function T$$(e,p){return p.getElementsByTagName(e)}TINY.accordion=function(){function slider(n){this.n=n;this.a=[]}slider.prototype.init=function(t,e,m,o,k){var a=T$(t),i=s=0,n=a.childNodes,l=n.length;this.s=k||0;this.m=m||0;for(i;i<l;i++){var v=n[i];if(v.nodeType!=3){this.a[s]={};this.a[s].h=h=T$$(e,v)[0];this.a[s].c=c=T$$('div',v)[0];h.onclick=new Function(this.n+'.pr(0,'+s+')');if(o==s){h.className=this.s;c.style.height='auto';c.d=1}else{c.style.height=0;c.d=-1}s++}}this.l=s};slider.prototype.pr=function(f,d){for(var i=0;i<this.l;i++){var h=this.a[i].h,c=this.a[i].c,k=c.style.height;k=k=='auto'?1:parseInt(k);clearInterval(c.t);if((k!=1&&c.d==-1)&&(f==1||i==d)){c.style.height='';c.m=c.offsetHeight;c.style.height=k+'px';c.d=1;h.className=this.s;su(c,1)}else if(k>0&&(f==-1||this.m||i==d)){c.d=-1;h.className='';su(c,-1)}}};function su(c){c.t=setInterval(function(){sl(c)},20)};function sl(c){var h=c.offsetHeight,d=c.d==1?c.m-h:h;c.style.height=h+(Math.ceil(d/5)*c.d)+'px';c.style.opacity=h/c.m;c.style.filter='alpha(opacity='+h*100/c.m+')';if((c.d==1&&h>=c.m)||(c.d!=1&&h==1)){if(c.d==1){c.style.height='auto'}clearInterval(c.t)}};return{slider:slider}}();
|
9
|
+
|
10
|
+
var menu1, menu2, menu3, menu4, menu5, menu6;
|
11
|
+
var menu7, menu8, menu9, menu10, menu11;
|
12
|
+
|
13
|
+
function init_accordion() {
|
14
|
+
menu1 = new TINY.accordion.slider("menu1"); menu1.init("menu1","a",1,0);
|
15
|
+
menu2 = new TINY.accordion.slider("menu2"); menu2.init("menu2","a",1,-1);
|
16
|
+
menu3 = new TINY.accordion.slider("menu3"); menu3.init("menu3","a",1,-1);
|
17
|
+
menu4 = new TINY.accordion.slider("menu4"); menu4.init("menu4","a",1,-1);
|
18
|
+
menu5 = new TINY.accordion.slider("menu5"); menu5.init("menu5","a",1,-1);
|
19
|
+
menu6 = new TINY.accordion.slider("menu6"); menu6.init("menu6","a",1,-1);
|
20
|
+
menu7 = new TINY.accordion.slider("menu7"); menu7.init("menu7","a",1,-1);
|
21
|
+
menu8 = new TINY.accordion.slider("menu8"); menu8.init("menu8","a",1,-1);
|
22
|
+
menu9 = new TINY.accordion.slider("menu9"); menu9.init("menu9","a",1,-1);
|
23
|
+
menu10 = new TINY.accordion.slider("menu10"); menu10.init("menu10","a",1,-1);
|
24
|
+
menu11 = new TINY.accordion.slider("menu11"); menu11.init("menu11","a",1,-1);
|
25
|
+
};
|
26
|
+
window.onload = init_accordion;
|
27
|
+
|
28
|
+
%style{:type => "text/css", :media => "screen"}
|
29
|
+
:plain
|
30
|
+
body {
|
31
|
+
margin:0; padding:0; border:0;
|
32
|
+
height:100%; max-height:100%;
|
33
|
+
overflow:hidden;
|
34
|
+
background-color:#FFF;
|
35
|
+
}
|
36
|
+
|
37
|
+
#left_frame {
|
38
|
+
position:absolute; overflow:hidden;
|
39
|
+
top:0; bottom:0; left:0;
|
40
|
+
width:240px; height:100%;
|
41
|
+
}
|
42
|
+
|
43
|
+
#main_frame {
|
44
|
+
position:fixed; overflow:auto;
|
45
|
+
top:0; right:0; bottom:0; left:240px;
|
46
|
+
}
|
47
|
+
|
48
|
+
* html body { /*IE6 hack*/
|
49
|
+
padding: 0 0 0 240px;
|
50
|
+
}
|
51
|
+
* html #main_frame { /*IE6 hack*/
|
52
|
+
height: 100%; width: 100%;
|
53
|
+
}
|
54
|
+
|
55
|
+
.menu_top_level {margin:5px;}
|
56
|
+
.menu_top_level ul {list-style:none; margin:0; padding:0;}
|
57
|
+
.menu_top_level li {margin-top:5px;}
|
58
|
+
.menu_top_level .acc-section {overflow:hidden;}
|
59
|
+
.menu_top_level .acc-content {width:100%; margin:0; padding:0; background:#FFF}
|
60
|
+
|
61
|
+
.menu_top_level li a {
|
62
|
+
display:block; cursor:pointer; text-decoration: none;
|
63
|
+
border:1px solid #9BC;
|
64
|
+
padding: 0;
|
65
|
+
font:bold 12px/2 Verdana, Arial, Helvetica;
|
66
|
+
}
|
67
|
+
.menu_top_level li a:link, .menu_top_level li a:visited { color: #131; background:#FFE;}
|
68
|
+
.menu_top_level li a:hover {background: #9C9; color:#FFE;}
|
69
|
+
|
70
|
+
.menu_top_level .level1 li a { padding-left: 15px; }
|
71
|
+
.menu_top_level .level2 li a { padding-left: 30px; }
|
72
|
+
.menu_top_level .level3 li a { padding-left: 45px; }
|
73
|
+
|
74
|
+
#main_content {
|
75
|
+
margin: 20px; padding-left: 3em;
|
76
|
+
width: 40em;
|
77
|
+
font-family: Georgia, Times;
|
78
|
+
}
|
79
|
+
|
80
|
+
#main_content h1 { margin-left: -1em;}
|
81
|
+
#main_content h2 { margin-left: -1em;}
|
82
|
+
|
83
|
+
#main_content pre {
|
84
|
+
margin-left: 2em; padding: 4px;
|
85
|
+
background-color: #EFF;
|
86
|
+
border: solid 1px #BDD;
|
87
|
+
}
|
88
|
+
|
89
|
+
#main_content .ruby .normal {}
|
90
|
+
#main_content .ruby .comment { color: #005; font-style: italic; }
|
91
|
+
#main_content .ruby .keyword { color: #A00; font-weight: bold; }
|
92
|
+
#main_content .ruby .method { color: #077; }
|
93
|
+
#main_content .ruby .class { color: #074; }
|
94
|
+
#main_content .ruby .module { color: #050; }
|
95
|
+
#main_content .ruby .punct { color: #447; font-weight: bold; }
|
96
|
+
#main_content .ruby .symbol { color: #099; }
|
97
|
+
#main_content .ruby .string { color: #944; background: #FFE; }
|
98
|
+
#main_content .ruby .char { color: #F07; }
|
99
|
+
#main_content .ruby .ident { color: #004; }
|
100
|
+
#main_content .ruby .constant { color: #07F; }
|
101
|
+
#main_content .ruby .regex { color: #B66; background: #FEF; }
|
102
|
+
#main_content .ruby .number { color: #F99; }
|
103
|
+
#main_content .ruby .attribute { color: #7BB; }
|
104
|
+
#main_content .ruby .global { color: #7FB; }
|
105
|
+
#main_content .ruby .expr { color: #227; }
|
106
|
+
#main_content .ruby .escape { color: #277; }
|
107
|
+
|
108
|
+
%body
|
109
|
+
#left_frame
|
110
|
+
.menu_top_level
|
111
|
+
%ul.level1#menu1
|
112
|
+
%li
|
113
|
+
%a{ :href => "#bindata" }
|
114
|
+
BinData
|
115
|
+
.acc-section
|
116
|
+
.acc-content
|
117
|
+
%ul.level2#menu2
|
118
|
+
%li
|
119
|
+
%a{ :href => "#what_is_it_for" }
|
120
|
+
What is it for?
|
121
|
+
.acc-section
|
122
|
+
.acc-content
|
123
|
+
%li
|
124
|
+
%a{ :href => "#license" }
|
125
|
+
License
|
126
|
+
.acc-section
|
127
|
+
.acc-content
|
128
|
+
%li
|
129
|
+
%a{ :href => "#overview" }
|
130
|
+
Overview
|
131
|
+
.acc-section
|
132
|
+
.acc-content
|
133
|
+
%li
|
134
|
+
%a{ :href => "#common_operations" }
|
135
|
+
Common Operations
|
136
|
+
.acc-section
|
137
|
+
.acc-content
|
138
|
+
%ul.level2#menu3
|
139
|
+
%li
|
140
|
+
%a{ :href => "#reading_and_writing" }
|
141
|
+
Reading and writing
|
142
|
+
.acc-section
|
143
|
+
.acc-content
|
144
|
+
%li
|
145
|
+
%a{ :href => "#manipulating" }
|
146
|
+
Manipulating
|
147
|
+
.acc-section
|
148
|
+
.acc-content
|
149
|
+
%li
|
150
|
+
%a{ :href => "#inspecting" }
|
151
|
+
Inspecting
|
152
|
+
.acc-section
|
153
|
+
.acc-content
|
154
|
+
%li
|
155
|
+
%a{ :href => "#records" }
|
156
|
+
Records
|
157
|
+
.acc-section
|
158
|
+
.acc-content
|
159
|
+
%ul.level2#menu4
|
160
|
+
%li
|
161
|
+
%a{ :href => "#specifying_default_endian" }
|
162
|
+
Specifying default endian
|
163
|
+
.acc-section
|
164
|
+
.acc-content
|
165
|
+
%li
|
166
|
+
%a{ :href => "#optional_fields" }
|
167
|
+
Optional fields
|
168
|
+
.acc-section
|
169
|
+
.acc-content
|
170
|
+
%li
|
171
|
+
%a{ :href => "#handling_dependencies_between_fields" }
|
172
|
+
Handling dependencies between fields
|
173
|
+
.acc-section
|
174
|
+
.acc-content
|
175
|
+
%li
|
176
|
+
%a{ :href => "#primitive_types" }
|
177
|
+
Primitive Types
|
178
|
+
.acc-section
|
179
|
+
.acc-content
|
180
|
+
%ul.level2#menu5
|
181
|
+
%li
|
182
|
+
%a{ :href => "#numerics" }
|
183
|
+
Numerics
|
184
|
+
.acc-section
|
185
|
+
.acc-content
|
186
|
+
%ul.level3#menu6
|
187
|
+
%li
|
188
|
+
%a{ :href => "#byte_based_integers" }
|
189
|
+
Byte based integers
|
190
|
+
.acc-section
|
191
|
+
.acc-content
|
192
|
+
%li
|
193
|
+
%a{ :href => "#bit_based_integers" }
|
194
|
+
Bit based integers
|
195
|
+
.acc-section
|
196
|
+
.acc-content
|
197
|
+
%li
|
198
|
+
%a{ :href => "#floating_point_numbers" }
|
199
|
+
Floating point numbers
|
200
|
+
.acc-section
|
201
|
+
.acc-content
|
202
|
+
%li
|
203
|
+
%a{ :href => "#example" }
|
204
|
+
Example
|
205
|
+
.acc-section
|
206
|
+
.acc-content
|
207
|
+
%li
|
208
|
+
%a{ :href => "#strings" }
|
209
|
+
Strings
|
210
|
+
.acc-section
|
211
|
+
.acc-content
|
212
|
+
%ul.level3#menu7
|
213
|
+
%li
|
214
|
+
%a{ :href => "#fixed_sized_strings" }
|
215
|
+
Fixed Sized Strings
|
216
|
+
.acc-section
|
217
|
+
.acc-content
|
218
|
+
%li
|
219
|
+
%a{ :href => "#zero_terminated_strings" }
|
220
|
+
Zero Terminated Strings
|
221
|
+
.acc-section
|
222
|
+
.acc-content
|
223
|
+
%li
|
224
|
+
%a{ :href => "#user_defined_primitive_types" }
|
225
|
+
User Defined Primitive Types
|
226
|
+
.acc-section
|
227
|
+
.acc-content
|
228
|
+
%ul.level3#menu8
|
229
|
+
%li
|
230
|
+
%a{ :href => "#advanced_user_defined_primitive_types" }
|
231
|
+
Advanced User Defined Primitive Types
|
232
|
+
.acc-section
|
233
|
+
.acc-content
|
234
|
+
%li
|
235
|
+
%a{ :href => "#arrays" }
|
236
|
+
Arrays
|
237
|
+
.acc-section
|
238
|
+
.acc-content
|
239
|
+
%li
|
240
|
+
%a{ :href => "#choices" }
|
241
|
+
Choices
|
242
|
+
.acc-section
|
243
|
+
.acc-content
|
244
|
+
%li
|
245
|
+
%a{ :href => "#advanced_topics" }
|
246
|
+
Advanced Topics
|
247
|
+
.acc-section
|
248
|
+
.acc-content
|
249
|
+
%ul.level2#menu9
|
250
|
+
%li
|
251
|
+
%a{ :href => "#wrappers" }
|
252
|
+
Wrappers
|
253
|
+
.acc-section
|
254
|
+
.acc-content
|
255
|
+
%li
|
256
|
+
%a{ :href => "#parameterizing_user_defined_types" }
|
257
|
+
Parameterizing User Defined Types
|
258
|
+
.acc-section
|
259
|
+
.acc-content
|
260
|
+
%ul.level3#menu10
|
261
|
+
%li
|
262
|
+
%a{ :href => "#mandatory_parameters" }
|
263
|
+
Mandatory Parameters
|
264
|
+
.acc-section
|
265
|
+
.acc-content
|
266
|
+
%li
|
267
|
+
%a{ :href => "#default_parameters" }
|
268
|
+
Default Parameters
|
269
|
+
.acc-section
|
270
|
+
.acc-content
|
271
|
+
%li
|
272
|
+
%a{ :href => "#debugging" }
|
273
|
+
Debugging
|
274
|
+
.acc-section
|
275
|
+
.acc-content
|
276
|
+
%ul.level3#menu11
|
277
|
+
%li
|
278
|
+
%a{ :href => "#tracing" }
|
279
|
+
Tracing
|
280
|
+
.acc-section
|
281
|
+
.acc-content
|
282
|
+
%li
|
283
|
+
%a{ :href => "#rest" }
|
284
|
+
Rest
|
285
|
+
.acc-section
|
286
|
+
.acc-content
|
287
|
+
%li
|
288
|
+
%a{ :href => "#hidden_fields" }
|
289
|
+
Hidden fields
|
290
|
+
.acc-section
|
291
|
+
.acc-content
|
292
|
+
%li
|
293
|
+
%a{ :href => "#alternatives" }
|
294
|
+
Alternatives
|
295
|
+
.acc-section
|
296
|
+
.acc-content
|
297
|
+
#main_frame
|
298
|
+
#main_content
|
299
|
+
:maruku
|
300
|
+
#{File.read("README")}
|
301
|
+
|