autoc 0.8 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README +15 -4
- data/doc/AutoC.html +245 -0
- data/doc/AutoC/Code.html +520 -0
- data/doc/AutoC/Collection.html +923 -0
- data/doc/AutoC/HashMap.html +1161 -0
- data/doc/AutoC/HashSet.html +1122 -0
- data/doc/AutoC/List.html +1002 -0
- data/doc/AutoC/Module.html +951 -0
- data/doc/AutoC/Module/File.html +412 -0
- data/doc/AutoC/Module/Header.html +432 -0
- data/doc/AutoC/Module/Source.html +704 -0
- data/doc/AutoC/Priority.html +138 -0
- data/doc/AutoC/Queue.html +1167 -0
- data/doc/AutoC/Type.html +1152 -0
- data/doc/AutoC/UserDefinedType.html +655 -0
- data/doc/AutoC/Vector.html +856 -0
- data/doc/_index.html +299 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +112 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +112 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +178 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +605 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/autoc.rb +35 -12
- data/lib/autoc/{code_builder.rb → code.rb} +230 -247
- data/lib/autoc/collection.rb +137 -0
- data/lib/autoc/collection/hash_map.rb +388 -0
- data/lib/autoc/collection/hash_set.rb +433 -0
- data/lib/autoc/collection/list.rb +410 -0
- data/lib/autoc/collection/queue.rb +514 -0
- data/lib/autoc/collection/vector.rb +295 -0
- data/lib/autoc/type.rb +198 -0
- data/test/test.c +921 -396
- data/test/test.h +41 -0
- data/test/test.rb +21 -26
- data/test/test_auto.c +2630 -3961
- data/test/test_auto.h +449 -560
- metadata +50 -17
- data/lib/autoc/data_struct_builder.rb +0 -1794
- data/lib/autoc/type_builder.rb +0 -24
- data/manual/manual.pdf +0 -0
data/doc/AutoC/List.html
ADDED
@@ -0,0 +1,1002 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: AutoC::List
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.4
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!AutoC/List.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (L)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../AutoC.html" title="AutoC (module)">AutoC</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">List</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: AutoC::List
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName"><span class='object_link'><a href="Collection.html" title="AutoC::Collection (class)">Collection</a></span></span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next"><span class='object_link'><a href="Code.html" title="AutoC::Code (class)">Code</a></span></li>
|
82
|
+
|
83
|
+
<li class="next"><span class='object_link'><a href="Type.html" title="AutoC::Type (class)">Type</a></span></li>
|
84
|
+
|
85
|
+
<li class="next"><span class='object_link'><a href="Collection.html" title="AutoC::Collection (class)">Collection</a></span></li>
|
86
|
+
|
87
|
+
<li class="next">AutoC::List</li>
|
88
|
+
|
89
|
+
</ul>
|
90
|
+
<a href="#" class="inheritanceTree">show all</a>
|
91
|
+
|
92
|
+
</dd>
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
<dt class="r2 last">Defined in:</dt>
|
103
|
+
<dd class="r2 last">lib/autoc/collection/list.rb</dd>
|
104
|
+
|
105
|
+
</dl>
|
106
|
+
<div class="clear"></div>
|
107
|
+
|
108
|
+
<h2>Overview</h2><div class="docstring">
|
109
|
+
<div class="discussion">
|
110
|
+
<div class="paragraph">
|
111
|
+
<p>List is an ordered unidirectional sequence container.
|
112
|
+
List supports submission/polling operations at one end hence it can be used as a LIFO container.</p>
|
113
|
+
</div>
|
114
|
+
<div class="paragraph">
|
115
|
+
<p>The collection’s C++ counterpart is <code>std::forward_list<></code> template class.</p>
|
116
|
+
</div>
|
117
|
+
<div class="sect1">
|
118
|
+
<h2 id="_generated_c_interface">Generated C interface</h2>
|
119
|
+
<div class="sectionbody">
|
120
|
+
<div class="sect2">
|
121
|
+
<h3 id="_collection_management">Collection management</h3>
|
122
|
+
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
123
|
+
<colgroup>
|
124
|
+
<col style="width:50%;">
|
125
|
+
<col style="width:50%;">
|
126
|
+
</colgroup>
|
127
|
+
<tbody>
|
128
|
+
<tr>
|
129
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Copy(<strong><em>Type</em></strong> * <code>dst</code>, <strong><em>Type</em></strong> * <code>src</code>)</p></td>
|
130
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new list <code>dst</code> filled with the contents of <code>src</code>.
|
131
|
+
A copy operation is performed on every element in <code>src</code>.
|
132
|
+
</p><p class="tableblock">NOTE: Previous contents of <code>dst</code> is overwritten.</p></td>
|
133
|
+
</tr>
|
134
|
+
<tr>
|
135
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Ctor(<strong><em>Type</em></strong> * <code>self</code>)</p></td>
|
136
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new empty list <code>self</code>.
|
137
|
+
</p><p class="tableblock">NOTE: Previous contents of <code>self</code> is overwritten.</p></td>
|
138
|
+
</tr>
|
139
|
+
<tr>
|
140
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Dtor(<strong><em>Type</em></strong> * <code>self</code>)</p></td>
|
141
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Destroy list <code>self</code>.
|
142
|
+
Stored elements are destroyed as well by calling the respective destructors.</p></td>
|
143
|
+
</tr>
|
144
|
+
<tr>
|
145
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>Equal(<strong><em>Type</em></strong> * <code>lt</code>, <strong><em>Type</em></strong> * <code>rt</code>)</p></td>
|
146
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return non-zero value if lists <code>lt</code> and <code>rt</code> are considered equal by contents and zero value otherwise.</p></td>
|
147
|
+
</tr>
|
148
|
+
<tr>
|
149
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>size_t</em></strong> <sub>type</sub>Identify(<strong><em>Type</em></strong> * <code>self</code>)</p></td>
|
150
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return hash code for list <code>self</code>.</p></td>
|
151
|
+
</tr>
|
152
|
+
</tbody>
|
153
|
+
</table>
|
154
|
+
|
155
|
+
</div>
|
156
|
+
<div class="sect2">
|
157
|
+
<h3 id="_basic_operations">Basic operations</h3>
|
158
|
+
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
159
|
+
<colgroup>
|
160
|
+
<col style="width:50%;">
|
161
|
+
<col style="width:50%;">
|
162
|
+
</colgroup>
|
163
|
+
<tbody>
|
164
|
+
<tr>
|
165
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>Contains(<strong><em>Type</em></strong> * <code>self</code>, <strong><em>E</em></strong> <code>what</code>)</p></td>
|
166
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return non-zero value if list <code>self</code> contains (at least) one element considered equal to <code>what</code> and zero value otherwise.</p></td>
|
167
|
+
</tr>
|
168
|
+
<tr>
|
169
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>Empty(<strong><em>Type</em></strong> * <code>self</code>)</p></td>
|
170
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return non-zero value if list <code>self</code> contains no elements and zero value otherwise.</p></td>
|
171
|
+
</tr>
|
172
|
+
<tr>
|
173
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>E</em></strong> <sub>type</sub>Find(<strong><em>Type</em></strong> * <code>self</code>, <strong><em>E</em></strong> <code>what</code>)</p></td>
|
174
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return the <em>first</em> element of stored in <code>self</code> which is considered equal to <code>what</code>.
|
175
|
+
</p><p class="tableblock">WARNING: <code>self</code> <strong>must</strong> contain such element otherwise the behavior is undefined. See <sub>type</sub>Contains().</p></td>
|
176
|
+
</tr>
|
177
|
+
<tr>
|
178
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>E</em></strong> <sub>type</sub>Peek(<strong><em>Type</em></strong> * <code>self</code>)</p></td>
|
179
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return a <em>copy</em> of the head element of <code>self</code>.
|
180
|
+
</p><p class="tableblock">WARNING: <code>self</code> <strong>must not</strong> be empty otherwise the behavior is undefined. See <sub>type</sub>Empty().</p></td>
|
181
|
+
</tr>
|
182
|
+
<tr>
|
183
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>E</em></strong> <sub>type</sub>Pop(<strong><em>Type</em></strong> * <code>self</code>)</p></td>
|
184
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Remove head element of <code>self</code> <strong>and</strong> return it.
|
185
|
+
</p><p class="tableblock">NOTE: The function returns the element itself, <strong>not</strong> a copy.
|
186
|
+
</p><p class="tableblock">WARNING: <code>self</code> <strong>must not</strong> be empty otherwise the behavior is undefined. See <sub>type</sub>Empty().</p></td>
|
187
|
+
</tr>
|
188
|
+
<tr>
|
189
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Purge(<strong><em>Type</em></strong> * <code>self</code>)</p></td>
|
190
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Remove and destroy all elements stored in <code>self</code>.</p></td>
|
191
|
+
</tr>
|
192
|
+
<tr>
|
193
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Push(<strong><em>Type</em></strong> * <code>self</code>, <strong><em>E</em></strong> <code>what</code>)</p></td>
|
194
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Place a <em>copy</em> of the element <code>what</code> to the head of <code>self</code>.</p></td>
|
195
|
+
</tr>
|
196
|
+
<tr>
|
197
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>Replace(<strong><em>Type</em></strong> * <code>self</code>, <strong><em>E</em></strong> <code>with</code>)</p></td>
|
198
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Find the <em>first</em> occurrence of <code>with</code> in <code>self</code> and replace it with a <em>copy</em> of the element <code>with</code>.
|
199
|
+
Replaced element is destroyed.
|
200
|
+
</p><p class="tableblock">Return non-zero value on successful replacement and zero value if no suitable element was found.</p></td>
|
201
|
+
</tr>
|
202
|
+
<tr>
|
203
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>ReplaceAll(<strong><em>Type</em></strong> * <code>self</code>, <strong><em>E</em></strong> <code>with</code>)</p></td>
|
204
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Find <em>all</em> occurrences of <code>with</code> in <code>self</code> and replace them with <em>copies</em> of the element <code>with</code>.
|
205
|
+
All replaced elements are destroyed.
|
206
|
+
</p><p class="tableblock">Return number of successful replacements.</p></td>
|
207
|
+
</tr>
|
208
|
+
<tr>
|
209
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>ReplaceEx(<strong><em>Type</em></strong> * <code>self</code>, <strong><em>E</em></strong> <code>with</code>, <strong><em>int</em></strong> count)</p></td>
|
210
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Find at most <code>count</code> occurrences of <code>with</code> in <code>self</code> and replace them with <em>copies</em> of the element <code>with</code>.
|
211
|
+
If <code>count</code> is negative, <em>all</em> occurrences are replaced instead.
|
212
|
+
All replaced elements are destroyed.
|
213
|
+
</p><p class="tableblock">Return number of successful replacements.</p></td>
|
214
|
+
</tr>
|
215
|
+
<tr>
|
216
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>Remove(<strong><em>Type</em></strong> * <code>self</code>, <strong><em>E</em></strong> <code>what</code>)</p></td>
|
217
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Remove and destroy the <em>first</em> occurrence of the element <code>what</code> in <code>self</code>.
|
218
|
+
</p><p class="tableblock">Return non-zero value if element was removed and zero value otherwise.</p></td>
|
219
|
+
</tr>
|
220
|
+
<tr>
|
221
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>RemoveAll(<strong><em>Type</em></strong> * <code>self</code>, <strong><em>E</em></strong> <code>what</code>)</p></td>
|
222
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Remove and destroy <em>all</em> occurrences of the element <code>what</code> in <code>self</code>.
|
223
|
+
</p><p class="tableblock">Return number of elements actually removed.</p></td>
|
224
|
+
</tr>
|
225
|
+
<tr>
|
226
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>RemoveEx(<strong><em>Type</em></strong> * <code>self</code>, <strong><em>E</em></strong> <code>what</code>, <strong><em>int</em></strong> count)</p></td>
|
227
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Remove and destroy at most <code>count</code> occurrences of the element <code>what</code> in <code>self</code>.
|
228
|
+
If <code>count</code> is negative, <em>all</em> occurrences are removed instead.
|
229
|
+
</p><p class="tableblock">Return number of elements actually removed.</p></td>
|
230
|
+
</tr>
|
231
|
+
<tr>
|
232
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>size_t</em></strong> <sub>type</sub>Size(<strong><em>Type</em></strong> * <code>self</code>)</p></td>
|
233
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return number of elements stored in <code>self</code>.</p></td>
|
234
|
+
</tr>
|
235
|
+
</tbody>
|
236
|
+
</table>
|
237
|
+
|
238
|
+
</div>
|
239
|
+
<div class="sect2">
|
240
|
+
<h3 id="_iteration">Iteration</h3>
|
241
|
+
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
242
|
+
<colgroup>
|
243
|
+
<col style="width:50%;">
|
244
|
+
<col style="width:50%;">
|
245
|
+
</colgroup>
|
246
|
+
<tbody>
|
247
|
+
<tr>
|
248
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>it</sub>Ctor(<strong><em>IteratorType</em></strong> * <code>it</code>, <strong><em>Type</em></strong> * <code>self</code>)</p></td>
|
249
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new iterator <code>it</code> on list <code>self</code>.
|
250
|
+
</p><p class="tableblock">NOTE: Previous contents of <code>it</code> is overwritten.</p></td>
|
251
|
+
</tr>
|
252
|
+
<tr>
|
253
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>it</sub>Move(<strong><em>IteratorType</em></strong> * <code>it</code>)</p></td>
|
254
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Advance iterator position of <code>it</code> <strong>and</strong> return non-zero value if new position is valid and zero value otherwise.</p></td>
|
255
|
+
</tr>
|
256
|
+
<tr>
|
257
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>E</em></strong> <sub>it</sub>Get(<strong><em>IteratorType</em></strong> * <code>it</code>)</p></td>
|
258
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return a <em>copy</em> of current element pointed to by the iterator <code>it</code>.
|
259
|
+
</p><p class="tableblock">WARNING: current position <strong>must</strong> be valid otherwise the behavior is undefined. See <sub>it</sub>Move().</p></td>
|
260
|
+
</tr>
|
261
|
+
</tbody>
|
262
|
+
</table>
|
263
|
+
|
264
|
+
</div>
|
265
|
+
</div>
|
266
|
+
</div>
|
267
|
+
|
268
|
+
</div>
|
269
|
+
</div>
|
270
|
+
<div class="tags">
|
271
|
+
|
272
|
+
|
273
|
+
</div>
|
274
|
+
<h2>Constant Summary</h2>
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
<h2>Instance Attribute Summary</h2>
|
283
|
+
|
284
|
+
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Collection.html" title="AutoC::Collection (class)">Collection</a></span></h3>
|
285
|
+
<p class="inherited"><span class='object_link'><a href="Collection.html#element-instance_method" title="AutoC::Collection#element (method)">#element</a></span></p>
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Type.html" title="AutoC::Type (class)">Type</a></span></h3>
|
290
|
+
<p class="inherited"><span class='object_link'><a href="Type.html#type-instance_method" title="AutoC::Type#type (method)">#type</a></span></p>
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
<h2>
|
295
|
+
Instance Method Summary
|
296
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
297
|
+
</h2>
|
298
|
+
|
299
|
+
<ul class="summary">
|
300
|
+
|
301
|
+
<li class="public ">
|
302
|
+
<span class="summary_signature">
|
303
|
+
|
304
|
+
<a href="#write_exported_declarations-instance_method" title="#write_exported_declarations (instance method)">- (Object) <strong>write_exported_declarations</strong>(stream, declare, define) </a>
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
</span>
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
319
|
+
|
320
|
+
</li>
|
321
|
+
|
322
|
+
|
323
|
+
<li class="public ">
|
324
|
+
<span class="summary_signature">
|
325
|
+
|
326
|
+
<a href="#write_exported_types-instance_method" title="#write_exported_types (instance method)">- (Object) <strong>write_exported_types</strong>(stream) </a>
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
</span>
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
341
|
+
|
342
|
+
</li>
|
343
|
+
|
344
|
+
|
345
|
+
<li class="public ">
|
346
|
+
<span class="summary_signature">
|
347
|
+
|
348
|
+
<a href="#write_implementations-instance_method" title="#write_implementations (instance method)">- (Object) <strong>write_implementations</strong>(stream, define) </a>
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
</span>
|
353
|
+
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
363
|
+
|
364
|
+
</li>
|
365
|
+
|
366
|
+
|
367
|
+
</ul>
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Collection.html" title="AutoC::Collection (class)">Collection</a></span></h3>
|
380
|
+
<p class="inherited"><span class='object_link'><a href="Collection.html#coerce-class_method" title="AutoC::Collection.coerce (method)">coerce</a></span>, <span class='object_link'><a href="Collection.html#copy-instance_method" title="AutoC::Collection#copy (method)">#copy</a></span>, <span class='object_link'><a href="Collection.html#ctor-instance_method" title="AutoC::Collection#ctor (method)">#ctor</a></span>, <span class='object_link'><a href="Collection.html#dtor-instance_method" title="AutoC::Collection#dtor (method)">#dtor</a></span>, <span class='object_link'><a href="Collection.html#entities-instance_method" title="AutoC::Collection#entities (method)">#entities</a></span>, <span class='object_link'><a href="Collection.html#equal-instance_method" title="AutoC::Collection#equal (method)">#equal</a></span>, <span class='object_link'><a href="Collection.html#identify-instance_method" title="AutoC::Collection#identify (method)">#identify</a></span>, <span class='object_link'><a href="Collection.html#initialize-instance_method" title="AutoC::Collection#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="Collection.html#less-instance_method" title="AutoC::Collection#less (method)">#less</a></span></p>
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Type.html" title="AutoC::Type (class)">Type</a></span></h3>
|
391
|
+
<p class="inherited"><span class='object_link'><a href="Type.html#abort-instance_method" title="AutoC::Type#abort (method)">#abort</a></span>, <span class='object_link'><a href="Type.html#assert-instance_method" title="AutoC::Type#assert (method)">#assert</a></span>, <span class='object_link'><a href="Type.html#calloc-instance_method" title="AutoC::Type#calloc (method)">#calloc</a></span>, <span class='object_link'><a href="Type.html#entities-instance_method" title="AutoC::Type#entities (method)">#entities</a></span>, <span class='object_link'><a href="Type.html#extern-instance_method" title="AutoC::Type#extern (method)">#extern</a></span>, <span class='object_link'><a href="Type.html#free-instance_method" title="AutoC::Type#free (method)">#free</a></span>, <span class='object_link'><a href="Type.html#initialize-instance_method" title="AutoC::Type#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="Type.html#inline-instance_method" title="AutoC::Type#inline (method)">#inline</a></span>, <span class='object_link'><a href="Type.html#malloc-instance_method" title="AutoC::Type#malloc (method)">#malloc</a></span>, <span class='object_link'><a href="Type.html#method_missing-instance_method" title="AutoC::Type#method_missing (method)">#method_missing</a></span>, <span class='object_link'><a href="Type.html#static-instance_method" title="AutoC::Type#static (method)">#static</a></span>, <span class='object_link'><a href="Type.html#write_decls-instance_method" title="AutoC::Type#write_decls (method)">#write_decls</a></span>, <span class='object_link'><a href="Type.html#write_defs-instance_method" title="AutoC::Type#write_defs (method)">#write_defs</a></span>, <span class='object_link'><a href="Type.html#write_intf-instance_method" title="AutoC::Type#write_intf (method)">#write_intf</a></span></p>
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Code.html" title="AutoC::Code (class)">Code</a></span></h3>
|
402
|
+
<p class="inherited"><span class='object_link'><a href="Code.html#attach-instance_method" title="AutoC::Code#attach (method)">#attach</a></span>, <span class='object_link'><a href="Code.html#entities-instance_method" title="AutoC::Code#entities (method)">#entities</a></span>, <span class='object_link'><a href="Code.html#priority-instance_method" title="AutoC::Code#priority (method)">#priority</a></span>, <span class='object_link'><a href="Code.html#source_size-instance_method" title="AutoC::Code#source_size (method)">#source_size</a></span>, <span class='object_link'><a href="Code.html#write_decls-instance_method" title="AutoC::Code#write_decls (method)">#write_decls</a></span>, <span class='object_link'><a href="Code.html#write_defs-instance_method" title="AutoC::Code#write_defs (method)">#write_defs</a></span>, <span class='object_link'><a href="Code.html#write_intf-instance_method" title="AutoC::Code#write_intf (method)">#write_intf</a></span></p>
|
403
|
+
<div id="constructor_details" class="method_details_list">
|
404
|
+
<h2>Constructor Details</h2>
|
405
|
+
|
406
|
+
<p class="notice">This class inherits a constructor from <span class='object_link'><a href="Collection.html#initialize-instance_method" title="AutoC::Collection#initialize (method)">AutoC::Collection</a></span></p>
|
407
|
+
|
408
|
+
</div>
|
409
|
+
<div id="method_missing_details" class="method_details_list">
|
410
|
+
<h2>Dynamic Method Handling</h2>
|
411
|
+
<p class="notice super">
|
412
|
+
This class handles dynamic methods through the <tt>method_missing</tt> method
|
413
|
+
|
414
|
+
in the class <span class='object_link'><a href="Type.html#method_missing-instance_method" title="AutoC::Type#method_missing (method)">AutoC::Type</a></span>
|
415
|
+
|
416
|
+
</p>
|
417
|
+
|
418
|
+
</div>
|
419
|
+
|
420
|
+
|
421
|
+
<div id="instance_method_details" class="method_details_list">
|
422
|
+
<h2>Instance Method Details</h2>
|
423
|
+
|
424
|
+
|
425
|
+
<div class="method_details first">
|
426
|
+
<h3 class="signature first" id="write_exported_declarations-instance_method">
|
427
|
+
|
428
|
+
- (<tt>Object</tt>) <strong>write_exported_declarations</strong>(stream, declare, define)
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
</h3><table class="source_code">
|
435
|
+
<tr>
|
436
|
+
<td>
|
437
|
+
<pre class="lines">
|
438
|
+
|
439
|
+
|
440
|
+
183
|
441
|
+
184
|
442
|
+
185
|
443
|
+
186
|
444
|
+
187
|
445
|
+
188
|
446
|
+
189
|
447
|
+
190
|
448
|
+
191
|
449
|
+
192
|
450
|
+
193
|
451
|
+
194
|
452
|
+
195
|
453
|
+
196
|
454
|
+
197
|
455
|
+
198
|
456
|
+
199
|
457
|
+
200
|
458
|
+
201
|
459
|
+
202
|
460
|
+
203
|
461
|
+
204
|
462
|
+
205
|
463
|
+
206
|
464
|
+
207
|
465
|
+
208</pre>
|
466
|
+
</td>
|
467
|
+
<td>
|
468
|
+
<pre class="code"><span class="info file"># File 'lib/autoc/collection/list.rb', line 183</span>
|
469
|
+
|
470
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_write_exported_declarations'>write_exported_declarations</span><span class='lparen'>(</span><span class='id identifier rubyid_stream'>stream</span><span class='comma'>,</span> <span class='id identifier rubyid_declare'>declare</span><span class='comma'>,</span> <span class='id identifier rubyid_define'>define</span><span class='rparen'>)</span>
|
471
|
+
<span class='id identifier rubyid_stream'>stream</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>%$</span><span class='tstring_content'>
|
472
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_ctor'>ctor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>*);
|
473
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dtor'>dtor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>*);
|
474
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_copy'>copy</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>*, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>*);
|
475
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> int </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_equal'>equal</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>*, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>*);
|
476
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> size_t </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_identify'>identify</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>*);
|
477
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_purge'>purge</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>*);
|
478
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_peek'>peek</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>*);
|
479
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pop'>pop</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>*);
|
480
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_push'>push</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>*, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>);
|
481
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> int </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_contains'>contains</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>*, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>);
|
482
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_find'>find</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>*, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>);
|
483
|
+
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_replace'>replace</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, with) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_replaceEx'>replaceEx</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, with, 1)
|
484
|
+
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_replaceAll'>replaceAll</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, with) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_replaceEx'>replaceEx</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, with, -1)
|
485
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> int </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_replaceEx'>replaceEx</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>*, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>, int);
|
486
|
+
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_remove'>remove</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, what) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_removeEx'>removeEx</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, what, 1)
|
487
|
+
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_removeAll'>removeAll</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, what) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_removeEx'>removeEx</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, what, -1)
|
488
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> int </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_removeEx'>removeEx</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>*, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>, int);
|
489
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> size_t </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>*);
|
490
|
+
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_empty'>empty</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self) (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self) == 0)
|
491
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itCtor'>itCtor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'>*, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>*);
|
492
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> int </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itMove'>itMove</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'>*);
|
493
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_declare'>declare</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itGet'>itGet</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'>*);
|
494
|
+
</span><span class='tstring_end'>$</span></span>
|
495
|
+
<span class='kw'>end</span></pre>
|
496
|
+
</td>
|
497
|
+
</tr>
|
498
|
+
</table>
|
499
|
+
</div>
|
500
|
+
|
501
|
+
<div class="method_details ">
|
502
|
+
<h3 class="signature " id="write_exported_types-instance_method">
|
503
|
+
|
504
|
+
- (<tt>Object</tt>) <strong>write_exported_types</strong>(stream)
|
505
|
+
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
</h3><table class="source_code">
|
511
|
+
<tr>
|
512
|
+
<td>
|
513
|
+
<pre class="lines">
|
514
|
+
|
515
|
+
|
516
|
+
157
|
517
|
+
158
|
518
|
+
159
|
519
|
+
160
|
520
|
+
161
|
521
|
+
162
|
522
|
+
163
|
523
|
+
164
|
524
|
+
165
|
525
|
+
166
|
526
|
+
167
|
527
|
+
168
|
528
|
+
169
|
529
|
+
170
|
530
|
+
171
|
531
|
+
172
|
532
|
+
173
|
533
|
+
174
|
534
|
+
175
|
535
|
+
176
|
536
|
+
177
|
537
|
+
178
|
538
|
+
179
|
539
|
+
180
|
540
|
+
181</pre>
|
541
|
+
</td>
|
542
|
+
<td>
|
543
|
+
<pre class="code"><span class="info file"># File 'lib/autoc/collection/list.rb', line 157</span>
|
544
|
+
|
545
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_write_exported_types'>write_exported_types</span><span class='lparen'>(</span><span class='id identifier rubyid_stream'>stream</span><span class='rparen'>)</span>
|
546
|
+
<span class='id identifier rubyid_stream'>stream</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>%$</span><span class='tstring_content'>
|
547
|
+
/***
|
548
|
+
**** </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'><</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>> (</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'>)
|
549
|
+
***/
|
550
|
+
</span><span class='tstring_end'>$</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_public?'>public?</span>
|
551
|
+
<span class='id identifier rubyid_stream'>stream</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>%$</span><span class='tstring_content'>
|
552
|
+
typedef struct </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
553
|
+
typedef struct </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
554
|
+
typedef struct </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
555
|
+
struct </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
556
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* head_node;
|
557
|
+
size_t node_count;
|
558
|
+
};
|
559
|
+
struct </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
560
|
+
int start;
|
561
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* list;
|
562
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* this_node;
|
563
|
+
};
|
564
|
+
struct </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
565
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> element;
|
566
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* next_node;
|
567
|
+
};
|
568
|
+
</span><span class='tstring_end'>$</span></span>
|
569
|
+
<span class='kw'>end</span></pre>
|
570
|
+
</td>
|
571
|
+
</tr>
|
572
|
+
</table>
|
573
|
+
</div>
|
574
|
+
|
575
|
+
<div class="method_details ">
|
576
|
+
<h3 class="signature " id="write_implementations-instance_method">
|
577
|
+
|
578
|
+
- (<tt>Object</tt>) <strong>write_implementations</strong>(stream, define)
|
579
|
+
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
</h3><table class="source_code">
|
585
|
+
<tr>
|
586
|
+
<td>
|
587
|
+
<pre class="lines">
|
588
|
+
|
589
|
+
|
590
|
+
210
|
591
|
+
211
|
592
|
+
212
|
593
|
+
213
|
594
|
+
214
|
595
|
+
215
|
596
|
+
216
|
597
|
+
217
|
598
|
+
218
|
599
|
+
219
|
600
|
+
220
|
601
|
+
221
|
602
|
+
222
|
603
|
+
223
|
604
|
+
224
|
605
|
+
225
|
606
|
+
226
|
607
|
+
227
|
608
|
+
228
|
609
|
+
229
|
610
|
+
230
|
611
|
+
231
|
612
|
+
232
|
613
|
+
233
|
614
|
+
234
|
615
|
+
235
|
616
|
+
236
|
617
|
+
237
|
618
|
+
238
|
619
|
+
239
|
620
|
+
240
|
621
|
+
241
|
622
|
+
242
|
623
|
+
243
|
624
|
+
244
|
625
|
+
245
|
626
|
+
246
|
627
|
+
247
|
628
|
+
248
|
629
|
+
249
|
630
|
+
250
|
631
|
+
251
|
632
|
+
252
|
633
|
+
253
|
634
|
+
254
|
635
|
+
255
|
636
|
+
256
|
637
|
+
257
|
638
|
+
258
|
639
|
+
259
|
640
|
+
260
|
641
|
+
261
|
642
|
+
262
|
643
|
+
263
|
644
|
+
264
|
645
|
+
265
|
646
|
+
266
|
647
|
+
267
|
648
|
+
268
|
649
|
+
269
|
650
|
+
270
|
651
|
+
271
|
652
|
+
272
|
653
|
+
273
|
654
|
+
274
|
655
|
+
275
|
656
|
+
276
|
657
|
+
277
|
658
|
+
278
|
659
|
+
279
|
660
|
+
280
|
661
|
+
281
|
662
|
+
282
|
663
|
+
283
|
664
|
+
284
|
665
|
+
285
|
666
|
+
286
|
667
|
+
287
|
668
|
+
288
|
669
|
+
289
|
670
|
+
290
|
671
|
+
291
|
672
|
+
292
|
673
|
+
293
|
674
|
+
294
|
675
|
+
295
|
676
|
+
296
|
677
|
+
297
|
678
|
+
298
|
679
|
+
299
|
680
|
+
300
|
681
|
+
301
|
682
|
+
302
|
683
|
+
303
|
684
|
+
304
|
685
|
+
305
|
686
|
+
306
|
687
|
+
307
|
688
|
+
308
|
689
|
+
309
|
690
|
+
310
|
691
|
+
311
|
692
|
+
312
|
693
|
+
313
|
694
|
+
314
|
695
|
+
315
|
696
|
+
316
|
697
|
+
317
|
698
|
+
318
|
699
|
+
319
|
700
|
+
320
|
701
|
+
321
|
702
|
+
322
|
703
|
+
323
|
704
|
+
324
|
705
|
+
325
|
706
|
+
326
|
707
|
+
327
|
708
|
+
328
|
709
|
+
329
|
710
|
+
330
|
711
|
+
331
|
712
|
+
332
|
713
|
+
333
|
714
|
+
334
|
715
|
+
335
|
716
|
+
336
|
717
|
+
337
|
718
|
+
338
|
719
|
+
339
|
720
|
+
340
|
721
|
+
341
|
722
|
+
342
|
723
|
+
343
|
724
|
+
344
|
725
|
+
345
|
726
|
+
346
|
727
|
+
347
|
728
|
+
348
|
729
|
+
349
|
730
|
+
350
|
731
|
+
351
|
732
|
+
352
|
733
|
+
353
|
734
|
+
354
|
735
|
+
355
|
736
|
+
356
|
737
|
+
357
|
738
|
+
358
|
739
|
+
359
|
740
|
+
360
|
741
|
+
361
|
742
|
+
362
|
743
|
+
363
|
744
|
+
364
|
745
|
+
365
|
746
|
+
366
|
747
|
+
367
|
748
|
+
368
|
749
|
+
369
|
750
|
+
370
|
751
|
+
371
|
752
|
+
372
|
753
|
+
373
|
754
|
+
374
|
755
|
+
375
|
756
|
+
376
|
757
|
+
377
|
758
|
+
378
|
759
|
+
379
|
760
|
+
380
|
761
|
+
381
|
762
|
+
382
|
763
|
+
383
|
764
|
+
384
|
765
|
+
385
|
766
|
+
386
|
767
|
+
387
|
768
|
+
388
|
769
|
+
389
|
770
|
+
390
|
771
|
+
391
|
772
|
+
392
|
773
|
+
393
|
774
|
+
394
|
775
|
+
395
|
776
|
+
396
|
777
|
+
397
|
778
|
+
398
|
779
|
+
399
|
780
|
+
400
|
781
|
+
401
|
782
|
+
402
|
783
|
+
403
|
784
|
+
404
|
785
|
+
405</pre>
|
786
|
+
</td>
|
787
|
+
<td>
|
788
|
+
<pre class="code"><span class="info file"># File 'lib/autoc/collection/list.rb', line 210</span>
|
789
|
+
|
790
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_write_implementations'>write_implementations</span><span class='lparen'>(</span><span class='id identifier rubyid_stream'>stream</span><span class='comma'>,</span> <span class='id identifier rubyid_define'>define</span><span class='rparen'>)</span>
|
791
|
+
<span class='id identifier rubyid_stream'>stream</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>%$</span><span class='tstring_content'>
|
792
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itGetRef'>itGetRef</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'>*);
|
793
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_ctor'>ctor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* self) {
|
794
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
795
|
+
self->head_node = NULL;
|
796
|
+
self->node_count = 0;
|
797
|
+
}
|
798
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dtor'>dtor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* self) {
|
799
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node;
|
800
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
801
|
+
node = self->head_node;
|
802
|
+
while(node) {
|
803
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* this_node = node;
|
804
|
+
node = node->next_node;
|
805
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_dtor'>dtor</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>this_node->element</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
806
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_free'>free</span><span class='embexpr_end'>}</span><span class='tstring_content'>(this_node);
|
807
|
+
}
|
808
|
+
}
|
809
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_copy'>copy</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* dst, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* src) {
|
810
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'> it;
|
811
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(src);
|
812
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(dst);
|
813
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_ctor'>ctor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(dst);
|
814
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itCtor'>itCtor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&it, src);
|
815
|
+
while(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itMove'>itMove</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&it)) {
|
816
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_push'>push</span><span class='embexpr_end'>}</span><span class='tstring_content'>(dst, *</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itGetRef'>itGetRef</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&it));
|
817
|
+
}
|
818
|
+
}
|
819
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> int </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_equal'>equal</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* lt, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* rt) {
|
820
|
+
if(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'>(lt) == </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'>(rt)) {
|
821
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'> lit, rit;
|
822
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itCtor'>itCtor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&lit, lt);
|
823
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itCtor'>itCtor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&rit, rt);
|
824
|
+
while(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itMove'>itMove</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&lit) && </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itMove'>itMove</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&rit)) {
|
825
|
+
int equal;
|
826
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> *le, *re;
|
827
|
+
le = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itGetRef'>itGetRef</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&lit);
|
828
|
+
re = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itGetRef'>itGetRef</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&rit);
|
829
|
+
equal = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_equal'>equal</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>*le</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>*re</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
830
|
+
if(!equal) return 0;
|
831
|
+
}
|
832
|
+
return 1;
|
833
|
+
} else
|
834
|
+
return 0;
|
835
|
+
}
|
836
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> size_t </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_identify'>identify</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* self) {
|
837
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node;
|
838
|
+
size_t result = 0;
|
839
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
840
|
+
for(node = self->head_node; node != NULL; node = node->next_node) {
|
841
|
+
result ^= </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_identify'>identify</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>node->element</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
842
|
+
result = AUTOC_RCYCLE(result);
|
843
|
+
}
|
844
|
+
return result;
|
845
|
+
}
|
846
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_purge'>purge</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* self) {
|
847
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dtor'>dtor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
848
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_ctor'>ctor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
849
|
+
}
|
850
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_peek'>peek</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* self) {
|
851
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> result;
|
852
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
853
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(!</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_empty'>empty</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self));
|
854
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_copy'>copy</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>result</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>self->head_node->element</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
855
|
+
return result;
|
856
|
+
}
|
857
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pop'>pop</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* self) {
|
858
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node;
|
859
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> result;
|
860
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
861
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(!</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_empty'>empty</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self));
|
862
|
+
node = self->head_node;
|
863
|
+
result = node->element;
|
864
|
+
self->head_node = self->head_node->next_node;
|
865
|
+
--self->node_count;
|
866
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_free'>free</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node);
|
867
|
+
return result;
|
868
|
+
}
|
869
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_push'>push</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> element) {
|
870
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node;
|
871
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
872
|
+
node = (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>*)</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_malloc'>malloc</span><span class='embexpr_end'>}</span><span class='tstring_content'>(sizeof(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>)); </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node);
|
873
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_copy'>copy</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>node->element</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>element</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
874
|
+
node->next_node = self->head_node;
|
875
|
+
self->head_node = node;
|
876
|
+
++self->node_count;
|
877
|
+
}
|
878
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> int </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_contains'>contains</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> what) {
|
879
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node;
|
880
|
+
int found = 0;
|
881
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
882
|
+
node = self->head_node;
|
883
|
+
while(node) {
|
884
|
+
if(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_equal'>equal</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>node->element</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>what</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
885
|
+
found = 1;
|
886
|
+
break;
|
887
|
+
}
|
888
|
+
node = node->next_node;
|
889
|
+
}
|
890
|
+
return found;
|
891
|
+
}
|
892
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_find'>find</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> what) {
|
893
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node;
|
894
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
895
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_contains'>contains</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, what));
|
896
|
+
node = self->head_node;
|
897
|
+
while(node) {
|
898
|
+
if(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_equal'>equal</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>node->element</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>what</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
899
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> result;
|
900
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_copy'>copy</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>result</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>node->element</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
901
|
+
return result;
|
902
|
+
}
|
903
|
+
node = node->next_node;
|
904
|
+
}
|
905
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_abort'>abort</span><span class='embexpr_end'>}</span><span class='tstring_content'>();
|
906
|
+
}
|
907
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> int </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_replaceEx'>replaceEx</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> with, int count) {
|
908
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* node;
|
909
|
+
int replaced = 0;
|
910
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
911
|
+
if(count == 0) return 0;
|
912
|
+
node = self->head_node;
|
913
|
+
while(node) {
|
914
|
+
if(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_equal'>equal</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>node->element</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>with</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
915
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_dtor'>dtor</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>node->element</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
916
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_copy'>copy</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>node->element</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>with</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
917
|
+
++replaced;
|
918
|
+
if(count > 0 && replaced >= count) break;
|
919
|
+
}
|
920
|
+
node = node->next_node;
|
921
|
+
}
|
922
|
+
return replaced;
|
923
|
+
}
|
924
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> int </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_removeEx'>removeEx</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> what, int count) {
|
925
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'> *node, *prev_node;
|
926
|
+
int removed = 0;
|
927
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
928
|
+
if(count == 0) return 0;
|
929
|
+
node = self->head_node;
|
930
|
+
prev_node = NULL;
|
931
|
+
while(node) {
|
932
|
+
if(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_equal'>equal</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>node->element</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>what</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
933
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_node'>node</span><span class='embexpr_end'>}</span><span class='tstring_content'>* this_node;
|
934
|
+
if(prev_node) {
|
935
|
+
this_node = prev_node->next_node = node->next_node;
|
936
|
+
} else {
|
937
|
+
this_node = self->head_node = node->next_node;
|
938
|
+
}
|
939
|
+
++removed;
|
940
|
+
--self->node_count;
|
941
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_dtor'>dtor</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>node->element</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
942
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_free'>free</span><span class='embexpr_end'>}</span><span class='tstring_content'>(node);
|
943
|
+
node = this_node;
|
944
|
+
if(count > 0 && removed >= count) break;
|
945
|
+
} else {
|
946
|
+
prev_node = node;
|
947
|
+
node = node->next_node;
|
948
|
+
}
|
949
|
+
}
|
950
|
+
return removed;
|
951
|
+
}
|
952
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> size_t </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* self) {
|
953
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
954
|
+
return self->node_count;
|
955
|
+
}
|
956
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itCtor'>itCtor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'>* self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* list) {
|
957
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
958
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(list);
|
959
|
+
self->start = 1;
|
960
|
+
self->list = list;
|
961
|
+
}
|
962
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> int </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itMove'>itMove</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'>* self) {
|
963
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
964
|
+
if(self->start) {
|
965
|
+
self->this_node = self->list->head_node;
|
966
|
+
self->start = 0;
|
967
|
+
} else {
|
968
|
+
self->this_node = self->this_node ? self->this_node->next_node : NULL;
|
969
|
+
}
|
970
|
+
return self->this_node != NULL;
|
971
|
+
}
|
972
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itGet'>itGet</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'>* self) {
|
973
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> result;
|
974
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
975
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->this_node);
|
976
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_copy'>copy</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>result</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>self->this_node->element</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
977
|
+
return result;
|
978
|
+
}
|
979
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itGetRef'>itGetRef</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'>* self) {
|
980
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
981
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->this_node);
|
982
|
+
return &self->this_node->element;
|
983
|
+
}
|
984
|
+
</span><span class='tstring_end'>$</span></span>
|
985
|
+
<span class='kw'>end</span></pre>
|
986
|
+
</td>
|
987
|
+
</tr>
|
988
|
+
</table>
|
989
|
+
</div>
|
990
|
+
|
991
|
+
</div>
|
992
|
+
|
993
|
+
</div>
|
994
|
+
|
995
|
+
<div id="footer">
|
996
|
+
Generated on Fri Jun 6 18:05:35 2014 by
|
997
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
998
|
+
0.8.7.4 (ruby-2.0.0).
|
999
|
+
</div>
|
1000
|
+
|
1001
|
+
</body>
|
1002
|
+
</html>
|