binaryparse 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/binaryparse.gemspec +17 -17
  2. data/examples/pms_input_2_test.rb +70 -0
  3. data/lib/blocker.rb +1 -1
  4. metadata +3 -66
  5. data/doc/binaryparse.chm +0 -0
  6. data/doc/bphelp.zip +0 -0
  7. data/doc/classes/BinaryBlocker/BitFieldEncoder.html +0 -328
  8. data/doc/classes/BinaryBlocker/Blocker.html +0 -168
  9. data/doc/classes/BinaryBlocker/CountedArrayEncoder.html +0 -347
  10. data/doc/classes/BinaryBlocker/Encoder.html +0 -526
  11. data/doc/classes/BinaryBlocker/FixedArrayEncoder.html +0 -278
  12. data/doc/classes/BinaryBlocker/FixedStringEncoder.html +0 -177
  13. data/doc/classes/BinaryBlocker/FixedUTF16StringEncoder.html +0 -229
  14. data/doc/classes/BinaryBlocker/GroupEncoder.html +0 -650
  15. data/doc/classes/BinaryBlocker/ListOfEncoder.html +0 -343
  16. data/doc/classes/BinaryBlocker/OneOfEncoder.html +0 -306
  17. data/doc/classes/BinaryBlocker/PackedDateEncoder.html +0 -220
  18. data/doc/classes/BinaryBlocker/PackedDateTimeEncoder.html +0 -220
  19. data/doc/classes/BinaryBlocker/PackedNumberEncoder.html +0 -231
  20. data/doc/classes/BinaryBlocker/SimpleEncoder.html +0 -284
  21. data/doc/classes/BinaryBlocker.html +0 -329
  22. data/doc/classes/BufferedIO.html +0 -324
  23. data/doc/classes/TestBlocker/BBDate.html +0 -120
  24. data/doc/classes/TestBlocker/BBList.html +0 -120
  25. data/doc/classes/TestBlocker/BBPacked.html +0 -120
  26. data/doc/classes/TestBlocker/BBString.html +0 -120
  27. data/doc/classes/TestBlocker/BBSub1.html +0 -120
  28. data/doc/classes/TestBlocker/BBSub2.html +0 -120
  29. data/doc/classes/TestBlocker/BBTest1.html +0 -120
  30. data/doc/classes/TestBlocker/BBTest2.html +0 -120
  31. data/doc/classes/TestBlocker/BBTest3.html +0 -120
  32. data/doc/classes/TestBlocker/BBTest4.html +0 -120
  33. data/doc/classes/TestBlocker/BBTest5.html +0 -120
  34. data/doc/classes/TestBlocker/BBTest6.html +0 -120
  35. data/doc/classes/TestBlocker/BBTest7.html +0 -120
  36. data/doc/classes/TestBlocker/BBTime.html +0 -120
  37. data/doc/classes/TestBlocker/BBUTF16.html +0 -120
  38. data/doc/classes/TestBlocker/ItemA.html +0 -120
  39. data/doc/classes/TestBlocker/ItemB.html +0 -120
  40. data/doc/classes/TestBlocker.html +0 -802
  41. data/doc/contents.hhc +0 -670
  42. data/doc/created.rid +0 -1
  43. data/doc/dot/f_0.dot +0 -208
  44. data/doc/dot/f_0.png +0 -0
  45. data/doc/dot/f_1.dot +0 -23
  46. data/doc/dot/f_1.png +0 -0
  47. data/doc/dot/f_2.dot +0 -32
  48. data/doc/dot/f_2.png +0 -0
  49. data/doc/dot/m_0_0.dot +0 -208
  50. data/doc/dot/m_0_0.png +0 -0
  51. data/doc/files/lib/blocker_rb.html +0 -144
  52. data/doc/files/lib/buffered_io_rb.html +0 -115
  53. data/doc/files/test/test_blocker_rb.html +0 -116
  54. data/doc/fr_class_index.html +0 -60
  55. data/doc/fr_file_index.html +0 -29
  56. data/doc/fr_method_index.html +0 -135
  57. data/doc/index.hhk +0 -599
  58. data/doc/index.html +0 -24
  59. data/doc/rdoc-style.css +0 -208
  60. data/doc/rdoc.hhp +0 -15
@@ -1,329 +0,0 @@
1
-
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Module: BinaryBlocker</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Module</strong></td>
53
- <td class="class-name-in-header">BinaryBlocker</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/blocker_rb.html">
59
- lib/blocker.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- </table>
66
- </div>
67
- <!-- banner header -->
68
-
69
- <div id="bodyContent">
70
-
71
-
72
-
73
- <div id="contextContent">
74
- <div id="diagram">
75
- <map id="map" name="map">
76
- <area shape="rect" coords="252,146,351,194" href="BinaryBlocker/GroupEncoder.html" alt="GroupEncoder" />
77
- <area shape="rect" coords="27,242,123,290" href="BinaryBlocker/ListOfEncoder.html" alt="ListOfEncoder" />
78
- <area shape="rect" coords="147,242,219,290" href="BinaryBlocker/Blocker.html" alt="Blocker" />
79
- <area shape="rect" coords="243,242,360,290" href="BinaryBlocker/FixedArrayEncoder.html" alt="FixedArrayEncoder" />
80
- <area shape="rect" coords="384,242,517,290" href="BinaryBlocker/CountedArrayEncoder.html" alt="CountedArrayEncoder" />
81
- <area shape="rect" coords="683,50,755,98" href="BinaryBlocker/Encoder.html" alt="Encoder" />
82
- <area shape="rect" coords="605,146,707,194" href="BinaryBlocker/SimpleEncoder.html" alt="SimpleEncoder" />
83
- <area shape="rect" coords="731,146,835,194" href="BinaryBlocker/BitFieldEncoder.html" alt="BitFieldEncoder" />
84
- <area shape="rect" coords="859,146,960,194" href="BinaryBlocker/OneOfEncoder.html" alt="OneOfEncoder" />
85
- <area shape="rect" coords="541,242,683,290" href="BinaryBlocker/PackedNumberEncoder.html" alt="PackedNumberEncoder" />
86
- <area shape="rect" coords="469,338,595,386" href="BinaryBlocker/PackedDateEncoder.html" alt="PackedDateEncoder" />
87
- <area shape="rect" coords="619,338,765,386" href="BinaryBlocker/PackedDateTimeEncoder.html" alt="PackedDateTimeEncoder" />
88
- <area shape="rect" coords="707,242,827,290" href="BinaryBlocker/FixedStringEncoder.html" alt="FixedStringEncoder" />
89
- <area shape="rect" coords="851,242,1005,290" href="BinaryBlocker/FixedUTF16StringEncoder.html" alt="FixedUTF16StringEncoder" />
90
- <area shape="rect" coords="16,16,1016,396" href="BinaryBlocker.html" alt="BinaryBlocker" />
91
- </map>
92
- <img src="../dot/m_0_0.png" usemap="#map" border="0" alt="Module: BinaryBlocker" />
93
- </div>
94
-
95
-
96
-
97
- </div>
98
-
99
- <div id="method-list">
100
- <h3 class="section-bar">Methods</h3>
101
-
102
- <div class="name-list">
103
- <a href="#M000023">klasses</a>&nbsp;&nbsp;
104
- <a href="#M000026">pack_symbols</a>&nbsp;&nbsp;
105
- <a href="#M000024">register_klass</a>&nbsp;&nbsp;
106
- <a href="#M000025">sizeof_format</a>&nbsp;&nbsp;
107
- <a href="#M000027">with_guarded_io_pos</a>&nbsp;&nbsp;
108
- </div>
109
- </div>
110
-
111
- </div>
112
-
113
-
114
- <!-- if includes -->
115
-
116
- <div id="section">
117
-
118
- <div id="class-list">
119
- <h3 class="section-bar">Classes and Modules</h3>
120
-
121
- Class <a href="BinaryBlocker/BitFieldEncoder.html" class="link">BinaryBlocker::BitFieldEncoder</a><br />
122
- Class <a href="BinaryBlocker/Blocker.html" class="link">BinaryBlocker::Blocker</a><br />
123
- Class <a href="BinaryBlocker/CountedArrayEncoder.html" class="link">BinaryBlocker::CountedArrayEncoder</a><br />
124
- Class <a href="BinaryBlocker/Encoder.html" class="link">BinaryBlocker::Encoder</a><br />
125
- Class <a href="BinaryBlocker/FixedArrayEncoder.html" class="link">BinaryBlocker::FixedArrayEncoder</a><br />
126
- Class <a href="BinaryBlocker/FixedStringEncoder.html" class="link">BinaryBlocker::FixedStringEncoder</a><br />
127
- Class <a href="BinaryBlocker/FixedUTF16StringEncoder.html" class="link">BinaryBlocker::FixedUTF16StringEncoder</a><br />
128
- Class <a href="BinaryBlocker/GroupEncoder.html" class="link">BinaryBlocker::GroupEncoder</a><br />
129
- Class <a href="BinaryBlocker/ListOfEncoder.html" class="link">BinaryBlocker::ListOfEncoder</a><br />
130
- Class <a href="BinaryBlocker/OneOfEncoder.html" class="link">BinaryBlocker::OneOfEncoder</a><br />
131
- Class <a href="BinaryBlocker/PackedDateEncoder.html" class="link">BinaryBlocker::PackedDateEncoder</a><br />
132
- Class <a href="BinaryBlocker/PackedDateTimeEncoder.html" class="link">BinaryBlocker::PackedDateTimeEncoder</a><br />
133
- Class <a href="BinaryBlocker/PackedNumberEncoder.html" class="link">BinaryBlocker::PackedNumberEncoder</a><br />
134
- Class <a href="BinaryBlocker/SimpleEncoder.html" class="link">BinaryBlocker::SimpleEncoder</a><br />
135
-
136
- </div>
137
-
138
-
139
-
140
-
141
-
142
-
143
-
144
- <!-- if method_list -->
145
- <div id="methods">
146
- <h3 class="section-bar">Public Class methods</h3>
147
-
148
- <div id="method-M000023" class="method-detail">
149
- <a name="M000023"></a>
150
-
151
- <div class="method-heading">
152
- <a href="#M000023" class="method-signature">
153
- <span class="method-name">klasses</span><span class="method-args">()</span>
154
- </a>
155
- </div>
156
-
157
- <div class="method-description">
158
- <p><a class="source-toggle" href="#"
159
- onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
160
- <div class="method-source-code" id="M000023-source">
161
- <pre>
162
- <span class="ruby-comment cmt"># File lib/blocker.rb, line 15</span>
163
- 15: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">klasses</span>
164
- 16: <span class="ruby-ivar">@klasses</span> <span class="ruby-operator">||=</span> {}
165
- 17: <span class="ruby-keyword kw">end</span>
166
- </pre>
167
- </div>
168
- </div>
169
- </div>
170
-
171
- <div id="method-M000026" class="method-detail">
172
- <a name="M000026"></a>
173
-
174
- <div class="method-heading">
175
- <a href="#M000026" class="method-signature">
176
- <span class="method-name">pack_symbols</span><span class="method-args">()</span>
177
- </a>
178
- </div>
179
-
180
- <div class="method-description">
181
- <p><a class="source-toggle" href="#"
182
- onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
183
- <div class="method-source-code" id="M000026-source">
184
- <pre>
185
- <span class="ruby-comment cmt"># File lib/blocker.rb, line 53</span>
186
- 53: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pack_symbols</span>
187
- 54: {
188
- 55: <span class="ruby-identifier">:int8</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'c'</span>,
189
- 56: <span class="ruby-identifier">:uint8</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'C'</span>,
190
- 57: <span class="ruby-identifier">:int16</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'s'</span>,
191
- 58: <span class="ruby-identifier">:uint16</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'S'</span>,
192
- 59: <span class="ruby-identifier">:int32</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'i'</span>,
193
- 60: <span class="ruby-identifier">:uint32</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'I'</span>,
194
- 61: <span class="ruby-identifier">:int64</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'q'</span>,
195
- 62: <span class="ruby-identifier">:uint64</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Q'</span>
196
- 63: }
197
- 64: <span class="ruby-keyword kw">end</span>
198
- </pre>
199
- </div>
200
- </div>
201
- </div>
202
-
203
- <div id="method-M000024" class="method-detail">
204
- <a name="M000024"></a>
205
-
206
- <div class="method-heading">
207
- <a href="#M000024" class="method-signature">
208
- <span class="method-name">register_klass</span><span class="method-args">(sym, klass)</span>
209
- </a>
210
- </div>
211
-
212
- <div class="method-description">
213
- <p>
214
- To simplify naming of classes and laying out fields in your structures they
215
- can be registered:
216
- </p>
217
- <p>
218
- <a
219
- href="BinaryBlocker.html#M000024">BinaryBlocker.register_klass</a>(:string,
220
- <a href="BinaryBlocker/FixedStringEncoder.html">FixedStringEncoder</a>)
221
- </p>
222
- <p><a class="source-toggle" href="#"
223
- onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
224
- <div class="method-source-code" id="M000024-source">
225
- <pre>
226
- <span class="ruby-comment cmt"># File lib/blocker.rb, line 23</span>
227
- 23: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">register_klass</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-identifier">klass</span>)
228
- 24: <span class="ruby-ivar">@klasses</span> <span class="ruby-operator">||=</span> {}
229
- 25: <span class="ruby-ivar">@klasses</span>[<span class="ruby-identifier">sym</span>] = <span class="ruby-identifier">klass</span>
230
- 26: <span class="ruby-keyword kw">end</span>
231
- </pre>
232
- </div>
233
- </div>
234
- </div>
235
-
236
- <div id="method-M000025" class="method-detail">
237
- <a name="M000025"></a>
238
-
239
- <div class="method-heading">
240
- <a href="#M000025" class="method-signature">
241
- <span class="method-name">sizeof_format</span><span class="method-args">(format)</span>
242
- </a>
243
- </div>
244
-
245
- <div class="method-description">
246
- <p>
247
- Handy helper method that returns the size of a given pack/unpack format
248
- string
249
- </p>
250
- <p><a class="source-toggle" href="#"
251
- onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
252
- <div class="method-source-code" id="M000025-source">
253
- <pre>
254
- <span class="ruby-comment cmt"># File lib/blocker.rb, line 30</span>
255
- 30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sizeof_format</span>(<span class="ruby-identifier">format</span>)
256
- 31: <span class="ruby-identifier">length</span> = <span class="ruby-value">0</span>
257
- 32: <span class="ruby-identifier">format</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/(\S_?)\s*(\d*)/</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">directive</span>,<span class="ruby-identifier">count</span><span class="ruby-operator">|</span>
258
- 33: <span class="ruby-identifier">count</span> = <span class="ruby-identifier">count</span>.<span class="ruby-identifier">to_i</span>
259
- 34: <span class="ruby-identifier">count</span> = <span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">count</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
260
- 35:
261
- 36: <span class="ruby-identifier">length</span> <span class="ruby-operator">+=</span> <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">directive</span>
262
- 37: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'A'</span>, <span class="ruby-value str">'a'</span>, <span class="ruby-value str">'C'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'Z'</span>, <span class="ruby-value str">'x'</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">count</span>
263
- 38: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'B'</span>, <span class="ruby-value str">'b'</span> <span class="ruby-operator">:</span> (<span class="ruby-identifier">count</span> <span class="ruby-operator">/</span> <span class="ruby-value">8.0</span>).<span class="ruby-identifier">ceil</span>
264
- 39: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'D'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'E'</span>, <span class="ruby-value str">'G'</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">count</span> <span class="ruby-operator">*</span> <span class="ruby-value">8</span>
265
- 40: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'e'</span>, <span class="ruby-value str">'F'</span>, <span class="ruby-value str">'f'</span>, <span class="ruby-value str">'g'</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">count</span> <span class="ruby-operator">*</span> <span class="ruby-value">4</span>
266
- 41: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'H'</span>, <span class="ruby-value str">'h'</span> <span class="ruby-operator">:</span> (<span class="ruby-identifier">count</span> <span class="ruby-operator">/</span> <span class="ruby-value">2.0</span>).<span class="ruby-identifier">ceil</span>
267
- 42: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'I'</span>, <span class="ruby-value str">'i'</span>, <span class="ruby-value str">'L'</span>, <span class="ruby-value str">'l'</span>, <span class="ruby-value str">'N'</span>, <span class="ruby-value str">'V'</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">count</span> <span class="ruby-operator">*</span> <span class="ruby-value">4</span>
268
- 43: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'n'</span>, <span class="ruby-value str">'S'</span>, <span class="ruby-value str">'s'</span>, <span class="ruby-value str">'v'</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">count</span> <span class="ruby-operator">*</span> <span class="ruby-value">2</span>
269
- 44: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'Q'</span>, <span class="ruby-value str">'q'</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">count</span> <span class="ruby-operator">*</span> <span class="ruby-value">8</span>
270
- 45: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'X'</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">count</span> <span class="ruby-operator">*</span> <span class="ruby-value">-1</span>
271
- 46: <span class="ruby-keyword kw">else</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{directive} is not supported in sizeof_format&quot;</span>)
272
- 47: <span class="ruby-keyword kw">end</span>
273
- 48: <span class="ruby-keyword kw">end</span>
274
- 49:
275
- 50: <span class="ruby-identifier">length</span>
276
- 51: <span class="ruby-keyword kw">end</span>
277
- </pre>
278
- </div>
279
- </div>
280
- </div>
281
-
282
- <div id="method-M000027" class="method-detail">
283
- <a name="M000027"></a>
284
-
285
- <div class="method-heading">
286
- <a href="#M000027" class="method-signature">
287
- <span class="method-name">with_guarded_io_pos</span><span class="method-args">(io) {|io| ...}</span>
288
- </a>
289
- </div>
290
-
291
- <div class="method-description">
292
- <p>
293
- As we have to process some fields to determine what type they are (that is
294
- we sometimes start and half to backup), this routine takes any io (that can
295
- be repositioned) and yields to a block &#8212; if the block returns not
296
- <em>true</em> it will reset the original position of the io stream. If you
297
- need to use <a href="BinaryBlocker.html">BinaryBlocker</a> with a
298
- non-repositioning stream (like a TCP/IP stream), see the handy <a
299
- href="BufferedIO.html">BufferedIO</a> class.
300
- </p>
301
- <p><a class="source-toggle" href="#"
302
- onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
303
- <div class="method-source-code" id="M000027-source">
304
- <pre>
305
- <span class="ruby-comment cmt"># File lib/blocker.rb, line 72</span>
306
- 72: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">with_guarded_io_pos</span>(<span class="ruby-identifier">io</span>)
307
- 73: <span class="ruby-identifier">pos</span> = <span class="ruby-identifier">io</span>.<span class="ruby-identifier">pos</span>
308
- 74: <span class="ruby-identifier">status</span> = <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">io</span>
309
- 75: <span class="ruby-keyword kw">ensure</span>
310
- 76: <span class="ruby-identifier">io</span>.<span class="ruby-identifier">pos</span> = <span class="ruby-identifier">pos</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">status</span>
311
- 77: <span class="ruby-keyword kw">end</span>
312
- </pre>
313
- </div>
314
- </div>
315
- </div>
316
-
317
-
318
- </div>
319
-
320
-
321
- </div>
322
-
323
-
324
- <div id="validator-badges">
325
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
326
- </div>
327
-
328
- </body>
329
- </html>