gdiff 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/CHANGELOG +7 -0
  2. data/COPYING.suffix_array +278 -0
  3. data/LICENSE.suffix_array +17 -0
  4. data/README +40 -0
  5. data/README.suffix_array +274 -0
  6. data/bin/gdiff +25 -0
  7. data/bin/gpatch +25 -0
  8. data/doc/classes/Diff.html +117 -0
  9. data/doc/classes/Diff/GDiff.html +120 -0
  10. data/doc/classes/Diff/GDiff/EGdiffError.html +111 -0
  11. data/doc/classes/Diff/GDiff/ENoGdiffStream.html +113 -0
  12. data/doc/classes/Diff/GDiff/EPrematureEndOfStream.html +113 -0
  13. data/doc/classes/Diff/GDiff/Operations.html +156 -0
  14. data/doc/classes/Diff/GDiff/Operations/Copy.html +246 -0
  15. data/doc/classes/Diff/GDiff/Operations/Copy.src/M000014.html +19 -0
  16. data/doc/classes/Diff/GDiff/Operations/Copy.src/M000015.html +39 -0
  17. data/doc/classes/Diff/GDiff/Operations/Copy.src/M000016.html +25 -0
  18. data/doc/classes/Diff/GDiff/Operations/Copy.src/M000017.html +18 -0
  19. data/doc/classes/Diff/GDiff/Operations/Data.html +246 -0
  20. data/doc/classes/Diff/GDiff/Operations/Data.src/M000009.html +18 -0
  21. data/doc/classes/Diff/GDiff/Operations/Data.src/M000010.html +18 -0
  22. data/doc/classes/Diff/GDiff/Operations/Data.src/M000011.html +35 -0
  23. data/doc/classes/Diff/GDiff/Operations/Data.src/M000012.html +29 -0
  24. data/doc/classes/Diff/GDiff/Operations/Data.src/M000013.html +19 -0
  25. data/doc/classes/SAError.html +111 -0
  26. data/doc/classes/SuffixArray.html +342 -0
  27. data/doc/classes/SuffixArray.src/M000001.html +97 -0
  28. data/doc/classes/SuffixArray.src/M000002.html +73 -0
  29. data/doc/classes/SuffixArray.src/M000003.html +102 -0
  30. data/doc/classes/SuffixArray.src/M000004.html +47 -0
  31. data/doc/classes/SuffixArray.src/M000005.html +44 -0
  32. data/doc/classes/SuffixArray.src/M000006.html +33 -0
  33. data/doc/classes/SuffixArray.src/M000007.html +24 -0
  34. data/doc/classes/SuffixArray.src/M000008.html +46 -0
  35. data/doc/created.rid +1 -0
  36. data/doc/files/ext/gdiff/suffix_array/extconf_rb.html +108 -0
  37. data/doc/files/ext/gdiff/suffix_array/lcp_c.html +101 -0
  38. data/doc/files/ext/gdiff/suffix_array/sarray_c.html +101 -0
  39. data/doc/files/ext/gdiff/suffix_array/suffix_array_c.html +101 -0
  40. data/doc/files/lib/gdiff_rb.html +108 -0
  41. data/doc/fr_class_index.html +36 -0
  42. data/doc/fr_file_index.html +31 -0
  43. data/doc/fr_method_index.html +43 -0
  44. data/doc/index.html +24 -0
  45. data/doc/rdoc-style.css +208 -0
  46. data/ext/gdiff/COPYING +278 -0
  47. data/ext/gdiff/LICENSE +17 -0
  48. data/ext/gdiff/README +274 -0
  49. data/ext/gdiff/extconf.rb +3 -0
  50. data/ext/gdiff/lcp.c +97 -0
  51. data/ext/gdiff/sarray.3 +145 -0
  52. data/ext/gdiff/sarray.c +372 -0
  53. data/ext/gdiff/sarray.h +13 -0
  54. data/ext/gdiff/suffix_array.c +510 -0
  55. data/lib/gdiff.rb +255 -0
  56. data/setup.rb +1551 -0
  57. data/test/tc_gdiff.rb +66 -0
  58. metadata +119 -0
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="iso-8859-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>
7
+ <head>
8
+ <title>new (Diff::GDiff::Operations::Copy)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/gdiff.rb, line 104</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">position</span>, <span class="ruby-identifier">length</span>)
15
+ <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">position</span>
16
+ <span class="ruby-ivar">@length</span> = <span class="ruby-identifier">length</span>
17
+ <span class="ruby-keyword kw">end</span></pre>
18
+ </body>
19
+ </html>
@@ -0,0 +1,39 @@
1
+ <?xml version="1.0" encoding="iso-8859-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>
7
+ <head>
8
+ <title>pack (Diff::GDiff::Operations::Copy)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/gdiff.rb, line 110</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pack</span>
15
+ <span class="ruby-identifier">result</span> = <span class="ruby-value str">&quot;&quot;</span>
16
+ <span class="ruby-identifier">l</span> = <span class="ruby-ivar">@length</span>
17
+ <span class="ruby-identifier">p</span> = <span class="ruby-ivar">@position</span>
18
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">l</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
19
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Can't express position&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">p</span> <span class="ruby-operator">&gt;</span> <span class="ruby-constant">LONG</span>[<span class="ruby-value">1</span>]
20
+
21
+ <span class="ruby-identifier">matched</span> = <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-keyword kw">nil</span>) { <span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>, (<span class="ruby-identifier">c</span>, (<span class="ruby-identifier">p_pack</span>, <span class="ruby-identifier">p_max</span>), (<span class="ruby-identifier">l_pack</span>, <span class="ruby-identifier">l_max</span>)) <span class="ruby-operator">|</span>
22
+ <span class="ruby-keyword kw">next</span> <span class="ruby-identifier">r</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">r</span>
23
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">l</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">l_max</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">p</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">p_max</span>
24
+ <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">c</span>, <span class="ruby-identifier">p</span>, <span class="ruby-identifier">l</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-value str">&quot;C&quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">p_pack</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">l_pack</span>)
25
+ <span class="ruby-identifier">p</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">l</span>
26
+ <span class="ruby-identifier">l</span> = <span class="ruby-value">0</span>
27
+ <span class="ruby-keyword kw">end</span>
28
+ }
29
+
30
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">matched</span>
31
+ <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-value">255</span>, <span class="ruby-identifier">p</span>, <span class="ruby-constant">INT</span>[<span class="ruby-value">1</span>]].<span class="ruby-identifier">pack</span>(<span class="ruby-value str">&quot;C&quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">LONG</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">INT</span>[<span class="ruby-value">0</span>])
32
+ <span class="ruby-identifier">p</span> <span class="ruby-operator">+=</span> <span class="ruby-constant">INT</span>[<span class="ruby-value">1</span>]
33
+ <span class="ruby-identifier">l</span> <span class="ruby-operator">-=</span> <span class="ruby-constant">INT</span>[<span class="ruby-value">1</span>]
34
+ <span class="ruby-keyword kw">end</span>
35
+ <span class="ruby-keyword kw">end</span>
36
+ <span class="ruby-identifier">result</span>
37
+ <span class="ruby-keyword kw">end</span></pre>
38
+ </body>
39
+ </html>
@@ -0,0 +1,25 @@
1
+ <?xml version="1.0" encoding="iso-8859-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>
7
+ <head>
8
+ <title>unpack_if_match (Diff::GDiff::Operations::Copy)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/gdiff.rb, line 138</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unpack_if_match</span>(<span class="ruby-identifier">string</span>, <span class="ruby-identifier">position</span>)
15
+ <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> (<span class="ruby-identifier">c</span>, (<span class="ruby-identifier">p_pack</span>, <span class="ruby-identifier">_</span>, <span class="ruby-identifier">p_size</span>), (<span class="ruby-identifier">l_pack</span>, <span class="ruby-identifier">_</span>, <span class="ruby-identifier">l_size</span>)) <span class="ruby-operator">|</span>
16
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">string</span>[<span class="ruby-identifier">position</span>]
17
+ <span class="ruby-identifier">operation</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">string</span>[<span class="ruby-identifier">position</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>, <span class="ruby-identifier">p_size</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">l_size</span>].<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">&quot;&quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">p_pack</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">l_pack</span>))
18
+ <span class="ruby-identifier">position</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">p_size</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">l_size</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
19
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">position</span>, <span class="ruby-identifier">operation</span>
20
+ <span class="ruby-keyword kw">end</span>
21
+ <span class="ruby-keyword kw">end</span>
22
+ <span class="ruby-keyword kw">nil</span>
23
+ <span class="ruby-keyword kw">end</span></pre>
24
+ </body>
25
+ </html>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="iso-8859-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>
7
+ <head>
8
+ <title>to_s (Diff::GDiff::Operations::Copy)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/gdiff.rb, line 150</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
15
+ <span class="ruby-node">&quot;Copy: #{position}, #{length}&quot;</span>
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,246 @@
1
+ <?xml version="1.0" encoding="iso-8859-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>Class: Diff::GDiff::Operations::Data</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>Class</strong></td>
53
+ <td class="class-name-in-header">Diff::GDiff::Operations::Data</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../../files/lib/gdiff_rb.html">
59
+ lib/gdiff.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+ <div id="description">
82
+ <p>
83
+ Insert <a href="Data.html">Data</a> operation
84
+ </p>
85
+ <p>
86
+ Automatically splits itself into multiple operations on pack if neccessary.
87
+ <a href="Data.html#M000011">pack</a> chooses smallest possible
88
+ representation.
89
+ </p>
90
+
91
+ </div>
92
+
93
+
94
+ </div>
95
+
96
+ <div id="method-list">
97
+ <h3 class="section-bar">Methods</h3>
98
+
99
+ <div class="name-list">
100
+ <a href="#M000010">length</a>&nbsp;&nbsp;
101
+ <a href="#M000009">new</a>&nbsp;&nbsp;
102
+ <a href="#M000011">pack</a>&nbsp;&nbsp;
103
+ <a href="#M000013">to_s</a>&nbsp;&nbsp;
104
+ <a href="#M000012">unpack_if_match</a>&nbsp;&nbsp;
105
+ </div>
106
+ </div>
107
+
108
+ </div>
109
+
110
+
111
+ <!-- if includes -->
112
+
113
+ <div id="section">
114
+
115
+
116
+
117
+
118
+
119
+ <div id="attribute-list">
120
+ <h3 class="section-bar">Attributes</h3>
121
+
122
+ <div class="name-list">
123
+ <table>
124
+ <tr class="top-aligned-row context-row">
125
+ <td class="context-item-name">data</td>
126
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
127
+ <td class="context-item-desc"></td>
128
+ </tr>
129
+ </table>
130
+ </div>
131
+ </div>
132
+
133
+
134
+
135
+ <!-- if method_list -->
136
+ <div id="methods">
137
+ <h3 class="section-bar">Public Class methods</h3>
138
+
139
+ <div id="method-M000009" class="method-detail">
140
+ <a name="M000009"></a>
141
+
142
+ <div class="method-heading">
143
+ <a href="Data.src/M000009.html" target="Code" class="method-signature"
144
+ onclick="popupCode('Data.src/M000009.html');return false;">
145
+ <span class="method-name">new</span><span class="method-args">(data)</span>
146
+ </a>
147
+ </div>
148
+
149
+ <div class="method-description">
150
+ <p>
151
+ Create a new <a href="Data.html">Data</a> operation that inserts the given
152
+ data at this point
153
+ </p>
154
+ </div>
155
+ </div>
156
+
157
+ <div id="method-M000012" class="method-detail">
158
+ <a name="M000012"></a>
159
+
160
+ <div class="method-heading">
161
+ <a href="Data.src/M000012.html" target="Code" class="method-signature"
162
+ onclick="popupCode('Data.src/M000012.html');return false;">
163
+ <span class="method-name">unpack_if_match</span><span class="method-args">(string, position)</span>
164
+ </a>
165
+ </div>
166
+
167
+ <div class="method-description">
168
+ <p>
169
+ Takes a string and a position and returns the position after this operation
170
+ and a new operation object if the operation starting at the position is a
171
+ <a href="Data.html">Data</a> operation. Otherwise returns nil.
172
+ </p>
173
+ </div>
174
+ </div>
175
+
176
+ <h3 class="section-bar">Public Instance methods</h3>
177
+
178
+ <div id="method-M000010" class="method-detail">
179
+ <a name="M000010"></a>
180
+
181
+ <div class="method-heading">
182
+ <a href="Data.src/M000010.html" target="Code" class="method-signature"
183
+ onclick="popupCode('Data.src/M000010.html');return false;">
184
+ <span class="method-name">length</span><span class="method-args">()</span>
185
+ </a>
186
+ </div>
187
+
188
+ <div class="method-description">
189
+ <p>
190
+ return the length of the data object to insert
191
+ </p>
192
+ </div>
193
+ </div>
194
+
195
+ <div id="method-M000011" class="method-detail">
196
+ <a name="M000011"></a>
197
+
198
+ <div class="method-heading">
199
+ <a href="Data.src/M000011.html" target="Code" class="method-signature"
200
+ onclick="popupCode('Data.src/M000011.html');return false;">
201
+ <span class="method-name">pack</span><span class="method-args">()</span>
202
+ </a>
203
+ </div>
204
+
205
+ <div class="method-description">
206
+ <p>
207
+ Return a binary representation in gdiff format of the <a
208
+ href="Data.html">Data</a> operation
209
+ </p>
210
+ <p>
211
+ The binary representation may consist of multiple <a
212
+ href="Data.html">Data</a> operations if neccessary.
213
+ </p>
214
+ </div>
215
+ </div>
216
+
217
+ <div id="method-M000013" class="method-detail">
218
+ <a name="M000013"></a>
219
+
220
+ <div class="method-heading">
221
+ <a href="Data.src/M000013.html" target="Code" class="method-signature"
222
+ onclick="popupCode('Data.src/M000013.html');return false;">
223
+ <span class="method-name">to_s</span><span class="method-args">()</span>
224
+ </a>
225
+ </div>
226
+
227
+ <div class="method-description">
228
+ <p>
229
+ Return a readable representation of the operation
230
+ </p>
231
+ </div>
232
+ </div>
233
+
234
+
235
+ </div>
236
+
237
+
238
+ </div>
239
+
240
+
241
+ <div id="validator-badges">
242
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
243
+ </div>
244
+
245
+ </body>
246
+ </html>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="iso-8859-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>
7
+ <head>
8
+ <title>new (Diff::GDiff::Operations::Data)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/gdiff.rb, line 29</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">data</span>)
15
+ <span class="ruby-ivar">@data</span> = <span class="ruby-identifier">data</span>
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="iso-8859-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>
7
+ <head>
8
+ <title>length (Diff::GDiff::Operations::Data)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/gdiff.rb, line 34</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">length</span>
15
+ <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">length</span>
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,35 @@
1
+ <?xml version="1.0" encoding="iso-8859-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>
7
+ <head>
8
+ <title>pack (Diff::GDiff::Operations::Data)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/gdiff.rb, line 42</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pack</span>
15
+ <span class="ruby-identifier">result</span> = <span class="ruby-value str">&quot;&quot;</span>
16
+ <span class="ruby-identifier">d</span> = <span class="ruby-ivar">@data</span>
17
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">d</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
18
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">d</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">246</span>
19
+ <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">d</span>.<span class="ruby-identifier">length</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-value str">&quot;C&quot;</span>) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">d</span>
20
+ <span class="ruby-identifier">d</span> = <span class="ruby-value str">&quot;&quot;</span>
21
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">d</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">USHORT</span>[<span class="ruby-value">1</span>]
22
+ <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-value">247</span>, <span class="ruby-identifier">d</span>.<span class="ruby-identifier">length</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-value str">&quot;C&quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">USHORT</span>[<span class="ruby-value">0</span>]) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">d</span>
23
+ <span class="ruby-identifier">d</span> = <span class="ruby-value str">&quot;&quot;</span>
24
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">d</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">INT</span>[<span class="ruby-value">1</span>]
25
+ <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-value">248</span>, <span class="ruby-identifier">d</span>.<span class="ruby-identifier">length</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-value str">&quot;C&quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">INT</span>[<span class="ruby-value">0</span>]) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">d</span>
26
+ <span class="ruby-identifier">d</span> = <span class="ruby-value str">&quot;&quot;</span>
27
+ <span class="ruby-keyword kw">else</span>
28
+ <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-value">248</span>, <span class="ruby-constant">INT</span>[<span class="ruby-value">1</span>]].<span class="ruby-identifier">pack</span>(<span class="ruby-value str">&quot;C&quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">INT</span>[<span class="ruby-value">0</span>]) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">d</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-constant">INT</span>[<span class="ruby-value">1</span>]]
29
+ <span class="ruby-identifier">d</span> = <span class="ruby-identifier">d</span>[<span class="ruby-constant">INT</span>[<span class="ruby-value">1</span>]<span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
30
+ <span class="ruby-keyword kw">end</span>
31
+ <span class="ruby-keyword kw">end</span>
32
+ <span class="ruby-identifier">result</span>
33
+ <span class="ruby-keyword kw">end</span></pre>
34
+ </body>
35
+ </html>
@@ -0,0 +1,29 @@
1
+ <?xml version="1.0" encoding="iso-8859-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>
7
+ <head>
8
+ <title>unpack_if_match (Diff::GDiff::Operations::Data)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/gdiff.rb, line 66</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unpack_if_match</span>(<span class="ruby-identifier">string</span>, <span class="ruby-identifier">position</span>)
15
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">string</span>[<span class="ruby-identifier">position</span>] <span class="ruby-operator">&lt;</span> <span class="ruby-value">245</span>
16
+ <span class="ruby-identifier">length</span> = <span class="ruby-identifier">string</span>[<span class="ruby-identifier">position</span>]
17
+ <span class="ruby-identifier">operation</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">string</span>[<span class="ruby-identifier">position</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>, <span class="ruby-identifier">length</span>])
18
+ <span class="ruby-identifier">position</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">length</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
19
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">position</span>, <span class="ruby-identifier">operation</span>
20
+ <span class="ruby-keyword kw">elsif</span> (<span class="ruby-identifier">type</span> = {<span class="ruby-value">247</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">USHORT</span>, <span class="ruby-value">248</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">INT</span>})[<span class="ruby-identifier">string</span>[<span class="ruby-identifier">position</span>]]
21
+ <span class="ruby-identifier">length</span> = <span class="ruby-identifier">string</span>[<span class="ruby-identifier">position</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>, <span class="ruby-identifier">type</span>[<span class="ruby-value">2</span>]].<span class="ruby-identifier">unpack</span>(<span class="ruby-identifier">type</span>[<span class="ruby-value">0</span>])
22
+ <span class="ruby-identifier">operation</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">string</span>[<span class="ruby-identifier">position</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">type</span>[<span class="ruby-value">2</span>], <span class="ruby-identifier">length</span>])
23
+ <span class="ruby-identifier">position</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">operation</span>.<span class="ruby-identifier">data</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">type</span>[<span class="ruby-value">2</span>]
24
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">position</span>, <span class="ruby-identifier">operation</span>
25
+ <span class="ruby-keyword kw">end</span>
26
+ <span class="ruby-keyword kw">nil</span>
27
+ <span class="ruby-keyword kw">end</span></pre>
28
+ </body>
29
+ </html>