autoc 1.1 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +3 -1
- data/CHANGES +15 -0
- data/README +2 -0
- data/doc/AutoC.html +84 -14
- data/doc/AutoC/Code.html +31 -31
- data/doc/AutoC/Collection.html +250 -182
- data/doc/AutoC/HashMap.html +565 -245
- data/doc/AutoC/HashSet.html +266 -264
- data/doc/AutoC/List.html +317 -249
- data/doc/AutoC/Module.html +66 -72
- data/doc/AutoC/Module/File.html +25 -25
- data/doc/AutoC/Module/Header.html +25 -25
- data/doc/AutoC/Module/Source.html +43 -43
- data/doc/AutoC/Priority.html +3 -3
- data/doc/AutoC/Queue.html +352 -286
- data/doc/AutoC/Reference.html +578 -0
- data/doc/AutoC/Type.html +941 -131
- data/doc/AutoC/UserDefinedType.html +64 -313
- data/doc/AutoC/Vector.html +336 -306
- data/doc/_index.html +22 -4
- data/doc/class_list.html +6 -2
- data/doc/file.CHANGES.html +102 -0
- data/doc/file.README.html +7 -4
- data/doc/file_list.html +8 -1
- data/doc/frames.html +1 -1
- data/doc/index.html +7 -4
- data/doc/js/full_list.js +4 -1
- data/doc/method_list.html +236 -118
- data/doc/top-level-namespace.html +3 -3
- data/lib/autoc.rb +3 -3
- data/lib/autoc/code.rb +11 -5
- data/lib/autoc/collection.rb +62 -56
- data/lib/autoc/collection/hash_map.rb +83 -63
- data/lib/autoc/collection/hash_set.rb +74 -64
- data/lib/autoc/collection/list.rb +48 -41
- data/lib/autoc/collection/queue.rb +53 -47
- data/lib/autoc/collection/vector.rb +63 -42
- data/lib/autoc/type.rb +326 -61
- data/test/test.c +120 -0
- data/test/test.rb +16 -2
- data/test/test_auto.c +1683 -987
- data/test/test_auto.h +491 -176
- metadata +22 -19
data/doc/AutoC/Vector.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: AutoC::Vector
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.7.
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -111,122 +111,121 @@
|
|
111
111
|
<p>Vector is an ordered random access sequence container.</p>
|
112
112
|
</div>
|
113
113
|
<div class="paragraph">
|
114
|
-
<p>The collection’s C++ counterpart is
|
114
|
+
<p>The collection’s C++ counterpart is std::vector<> template class.</p>
|
115
115
|
</div>
|
116
116
|
<div class="sect1">
|
117
117
|
<h2 id="_generated_c_interface">Generated C interface</h2>
|
118
118
|
<div class="sectionbody">
|
119
119
|
<div class="sect2">
|
120
120
|
<h3 id="_collection_management">Collection management</h3>
|
121
|
-
<table class="tableblock frame-all grid-all
|
121
|
+
<table class="tableblock frame-all grid-all spread">
|
122
122
|
<colgroup>
|
123
|
-
<col style="width:50%;">
|
124
|
-
<col style="width:50%;">
|
123
|
+
<col style="width: 50%;">
|
124
|
+
<col style="width: 50%;">
|
125
125
|
</colgroup>
|
126
126
|
<tbody>
|
127
127
|
<tr>
|
128
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Copy(<strong><em>Type</em></strong> *
|
129
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new vector
|
130
|
-
A copy operation is performed on every element in
|
131
|
-
</p><p class="tableblock">NOTE: Previous contents of
|
128
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Copy(<strong><em>Type</em></strong> * dst, <strong><em>Type</em></strong> * src)</p></td>
|
129
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new vector dst filled with the contents of src.
|
130
|
+
A copy operation is performed on every element in src.
|
131
|
+
</p><p class="tableblock">NOTE: Previous contents of dst is overwritten.</p></td>
|
132
132
|
</tr>
|
133
133
|
<tr>
|
134
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Ctor(<strong><em>Type</em></strong> *
|
135
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new vector
|
134
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Ctor(<strong><em>Type</em></strong> * self, <strong><em>size_t</em></strong> size)</p></td>
|
135
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new vector self of size size.
|
136
136
|
The elements are initialized with either supplied or generated default parameterless constructor.
|
137
|
-
</p><p class="tableblock">WARNING:
|
138
|
-
</p><p class="tableblock">NOTE: Previous contents of
|
137
|
+
</p><p class="tableblock">WARNING: size must be greater than zero.
|
138
|
+
</p><p class="tableblock">NOTE: Previous contents of self is overwritten.</p></td>
|
139
139
|
</tr>
|
140
140
|
<tr>
|
141
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Dtor(<strong><em>Type</em></strong> *
|
142
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Destroy vector
|
141
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Dtor(<strong><em>Type</em></strong> * self)</p></td>
|
142
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Destroy vector self.
|
143
143
|
Stored elements are destroyed as well by calling the respective destructors.</p></td>
|
144
144
|
</tr>
|
145
145
|
<tr>
|
146
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>Equal(<strong><em>Type</em></strong> *
|
147
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return non-zero value if vectors
|
146
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>Equal(<strong><em>Type</em></strong> * lt, <strong><em>Type</em></strong> * rt)</p></td>
|
147
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return non-zero value if vectors lt and rt are considered equal by contents and zero value otherwise.</p></td>
|
148
148
|
</tr>
|
149
149
|
<tr>
|
150
|
-
<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> *
|
151
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return hash code for vector
|
150
|
+
<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> * self)</p></td>
|
151
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return hash code for vector self.</p></td>
|
152
152
|
</tr>
|
153
153
|
</tbody>
|
154
154
|
</table>
|
155
|
-
|
156
155
|
</div>
|
157
156
|
<div class="sect2">
|
158
157
|
<h3 id="_basic_operations">Basic operations</h3>
|
159
|
-
<table class="tableblock frame-all grid-all
|
158
|
+
<table class="tableblock frame-all grid-all spread">
|
160
159
|
<colgroup>
|
161
|
-
<col style="width:50%;">
|
162
|
-
<col style="width:50%;">
|
160
|
+
<col style="width: 50%;">
|
161
|
+
<col style="width: 50%;">
|
163
162
|
</colgroup>
|
164
163
|
<tbody>
|
165
164
|
<tr>
|
166
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>E</em></strong> <sub>type</sub>Get(<strong><em>Type</em></strong> *
|
167
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return a <em>copy</em> of the element stored in
|
168
|
-
</p><p class="tableblock">WARNING:
|
165
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>E</em></strong> <sub>type</sub>Get(<strong><em>Type</em></strong> * self, <strong><em>size_t</em></strong> index)</p></td>
|
166
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return a <em>copy</em> of the element stored in self at position index.
|
167
|
+
</p><p class="tableblock">WARNING: index <strong>must</strong> be a valid index otherwise the behavior is undefined. See <sub>type</sub>Within().</p></td>
|
169
168
|
</tr>
|
170
169
|
<tr>
|
171
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Resize(<strong><em>Type</em></strong> *
|
172
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Set new size of vector
|
170
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Resize(<strong><em>Type</em></strong> * self, <strong><em>size_t</em></strong> size)</p></td>
|
171
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Set new size of vector self to size.
|
173
172
|
</p><p class="tableblock">If new size is greater than the old one, extra elements are created with default parameterless constructors.
|
174
173
|
If new size is smaller the the old one, excessive elements are destroyed.
|
175
|
-
</p><p class="tableblock">WARNING:
|
174
|
+
</p><p class="tableblock">WARNING: size <strong>must</strong> be greater than zero.</p></td>
|
176
175
|
</tr>
|
177
176
|
<tr>
|
178
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Set(<strong><em>Type</em></strong> *
|
179
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Store a <em>copy</em> of the element
|
180
|
-
</p><p class="tableblock">WARNING:
|
177
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Set(<strong><em>Type</em></strong> * self, <strong><em>size_t</em></strong> index, <strong><em>E</em></strong> what)</p></td>
|
178
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Store a <em>copy</em> of the element what in vector self at position index destroying previous contents.
|
179
|
+
</p><p class="tableblock">WARNING: index <strong>must</strong> be a valid index otherwise the behavior is undefined. See <sub>type</sub>Within().</p></td>
|
181
180
|
</tr>
|
182
181
|
<tr>
|
183
|
-
<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> *
|
184
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return number of elements stored in vector
|
182
|
+
<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> * self)</p></td>
|
183
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return number of elements stored in vector self.</p></td>
|
185
184
|
</tr>
|
186
185
|
<tr>
|
187
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Sort(<strong><em>Type</em></strong> *
|
188
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">
|
186
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>Sort(<strong><em>Type</em></strong> * self)</p></td>
|
187
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">NOTE : optional operation.
|
188
|
+
</p><p class="tableblock">Perform a sorting operation on the contents of vector self utilizing either generated of user supplied ordering functions.
|
189
|
+
</p><p class="tableblock">Note that this operation is defined only if element type is orderable, e.g. has equality testing and comparison operations defined.</p></td>
|
189
190
|
</tr>
|
190
191
|
<tr>
|
191
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>Within(<strong><em>Type</em></strong> *
|
192
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return non-zero value if
|
193
|
-
Valid index belongs to the range 0 … <sub>type</sub>Size()-1.</p></td>
|
192
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>Within(<strong><em>Type</em></strong> * self, <strong><em>size_t</em></strong> index)</p></td>
|
193
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return non-zero value if index is a valid index and zero value otherwise.
|
194
|
+
Valid index belongs to the range 0 …​ <sub>type</sub>Size()-1.</p></td>
|
194
195
|
</tr>
|
195
196
|
</tbody>
|
196
197
|
</table>
|
197
|
-
|
198
198
|
</div>
|
199
199
|
<div class="sect2">
|
200
200
|
<h3 id="_iteration">Iteration</h3>
|
201
|
-
<table class="tableblock frame-all grid-all
|
201
|
+
<table class="tableblock frame-all grid-all spread">
|
202
202
|
<colgroup>
|
203
|
-
<col style="width:50%;">
|
204
|
-
<col style="width:50%;">
|
203
|
+
<col style="width: 50%;">
|
204
|
+
<col style="width: 50%;">
|
205
205
|
</colgroup>
|
206
206
|
<tbody>
|
207
207
|
<tr>
|
208
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>it</sub>Ctor(<strong><em>IteratorType</em></strong> *
|
209
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new forward iterator
|
210
|
-
</p><p class="tableblock">NOTE: Previous contents of
|
208
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>it</sub>Ctor(<strong><em>IteratorType</em></strong> * it, <strong><em>Type</em></strong> * self)</p></td>
|
209
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new forward iterator it on vector self.
|
210
|
+
</p><p class="tableblock">NOTE: Previous contents of it is overwritten.</p></td>
|
211
211
|
</tr>
|
212
212
|
<tr>
|
213
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>it</sub>CtorEx(<strong><em>IteratorType</em></strong> *
|
214
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new iterator
|
215
|
-
Non-zero value of
|
216
|
-
</p><p class="tableblock">NOTE: Previous contents of
|
213
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>it</sub>CtorEx(<strong><em>IteratorType</em></strong> * it, <strong><em>Type</em></strong> * self, <strong><em>int</em></strong> forward)</p></td>
|
214
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new iterator it on vector self.
|
215
|
+
Non-zero value of forward specifies a forward iterator, zero value specifies a backward iterator.
|
216
|
+
</p><p class="tableblock">NOTE: Previous contents of it is overwritten.</p></td>
|
217
217
|
</tr>
|
218
218
|
<tr>
|
219
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>it</sub>Move(<strong><em>IteratorType</em></strong> *
|
220
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Advance iterator position of
|
219
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>it</sub>Move(<strong><em>IteratorType</em></strong> * it)</p></td>
|
220
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Advance iterator position of it <strong>and</strong> return non-zero value if new position is valid and zero value otherwise.</p></td>
|
221
221
|
</tr>
|
222
222
|
<tr>
|
223
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>E</em></strong> <sub>it</sub>Get(<strong><em>IteratorType</em></strong> *
|
224
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return a <em>copy</em> of current element pointed to by the iterator
|
223
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>E</em></strong> <sub>it</sub>Get(<strong><em>IteratorType</em></strong> * it)</p></td>
|
224
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return a <em>copy</em> of current element pointed to by the iterator it.
|
225
225
|
</p><p class="tableblock">WARNING: current position <strong>must</strong> be valid otherwise the behavior is undefined. See <sub>it</sub>Move().</p></td>
|
226
226
|
</tr>
|
227
227
|
</tbody>
|
228
228
|
</table>
|
229
|
-
|
230
229
|
</div>
|
231
230
|
</div>
|
232
231
|
</div>
|
@@ -248,12 +247,12 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
248
247
|
<h2>Instance Attribute Summary</h2>
|
249
248
|
|
250
249
|
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Collection.html" title="AutoC::Collection (class)">Collection</a></span></h3>
|
251
|
-
<p class="inherited"><span class='object_link'><a href="Collection.html#element-instance_method" title="AutoC::Collection#element (method)">#element</a></span></p>
|
250
|
+
<p class="inherited"><span class='object_link'><a href="Collection.html#element-instance_method" title="AutoC::Collection#element (method)">#element</a></span>, <span class='object_link'><a href="Collection.html#it_ref-instance_method" title="AutoC::Collection#it_ref (method)">#it_ref</a></span></p>
|
252
251
|
|
253
252
|
|
254
253
|
|
255
254
|
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Type.html" title="AutoC::Type (class)">Type</a></span></h3>
|
256
|
-
<p class="inherited"><span class='object_link'><a href="Type.html#type-instance_method" title="AutoC::Type#type (method)">#type</a></span></p>
|
255
|
+
<p class="inherited"><span class='object_link'><a href="Type.html#type-instance_method" title="AutoC::Type#type (method)">#type</a></span>, <span class='object_link'><a href="Type.html#type_ref-instance_method" title="AutoC::Type#type_ref (method)">#type_ref</a></span></p>
|
257
256
|
|
258
257
|
|
259
258
|
|
@@ -267,13 +266,15 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
267
266
|
<li class="public ">
|
268
267
|
<span class="summary_signature">
|
269
268
|
|
270
|
-
<a href="#
|
269
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Vector) <strong>initialize</strong>(*args) </a>
|
271
270
|
|
272
271
|
|
273
272
|
|
274
273
|
</span>
|
275
274
|
|
276
275
|
|
276
|
+
<span class="note title constructor">constructor</span>
|
277
|
+
|
277
278
|
|
278
279
|
|
279
280
|
|
@@ -281,7 +282,9 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
281
282
|
|
282
283
|
|
283
284
|
|
284
|
-
<span class="summary_desc"><div class='inline'
|
285
|
+
<span class="summary_desc"><div class='inline'><div class="paragraph">
|
286
|
+
<p>A new instance of Vector.</p>
|
287
|
+
</div></div></span>
|
285
288
|
|
286
289
|
</li>
|
287
290
|
|
@@ -289,7 +292,7 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
289
292
|
<li class="public ">
|
290
293
|
<span class="summary_signature">
|
291
294
|
|
292
|
-
<a href="#
|
295
|
+
<a href="#write_impls-instance_method" title="#write_impls (instance method)">- (Object) <strong>write_impls</strong>(stream, define) </a>
|
293
296
|
|
294
297
|
|
295
298
|
|
@@ -311,7 +314,7 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
311
314
|
<li class="public ">
|
312
315
|
<span class="summary_signature">
|
313
316
|
|
314
|
-
<a href="#
|
317
|
+
<a href="#write_intf_decls-instance_method" title="#write_intf_decls (instance method)">- (Object) <strong>write_intf_decls</strong>(stream, declare, define) </a>
|
315
318
|
|
316
319
|
|
317
320
|
|
@@ -333,7 +336,7 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
333
336
|
<li class="public ">
|
334
337
|
<span class="summary_signature">
|
335
338
|
|
336
|
-
<a href="#
|
339
|
+
<a href="#write_intf_types-instance_method" title="#write_intf_types (instance method)">- (Object) <strong>write_intf_types</strong>(stream) </a>
|
337
340
|
|
338
341
|
|
339
342
|
|
@@ -365,7 +368,7 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
365
368
|
|
366
369
|
|
367
370
|
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Collection.html" title="AutoC::Collection (class)">Collection</a></span></h3>
|
368
|
-
<p class="inherited"><span class='object_link'><a href="Collection.html
|
371
|
+
<p class="inherited"><span class='object_link'><a href="Collection.html#%3D%3D-instance_method" title="AutoC::Collection#== (method)">#==</a></span>, <span class='object_link'><a href="Collection.html#comparable%3F-instance_method" title="AutoC::Collection#comparable? (method)">#comparable?</a></span>, <span class='object_link'><a href="Collection.html#copyable%3F-instance_method" title="AutoC::Collection#copyable? (method)">#copyable?</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#hash-instance_method" title="AutoC::Collection#hash (method)">#hash</a></span>, <span class='object_link'><a href="Collection.html#hashable%3F-instance_method" title="AutoC::Collection#hashable? (method)">#hashable?</a></span></p>
|
369
372
|
|
370
373
|
|
371
374
|
|
@@ -376,7 +379,7 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
376
379
|
|
377
380
|
|
378
381
|
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Type.html" title="AutoC::Type (class)">Type</a></span></h3>
|
379
|
-
<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#
|
382
|
+
<p class="inherited"><span class='object_link'><a href="Type.html#%3D%3D-instance_method" title="AutoC::Type#== (method)">#==</a></span>, <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#coerce-class_method" title="AutoC::Type.coerce (method)">coerce</a></span>, <span class='object_link'><a href="Type.html#comparable%3F-instance_method" title="AutoC::Type#comparable? (method)">#comparable?</a></span>, <span class='object_link'><a href="Type.html#constructible%3F-instance_method" title="AutoC::Type#constructible? (method)">#constructible?</a></span>, <span class='object_link'><a href="Type.html#copyable%3F-instance_method" title="AutoC::Type#copyable? (method)">#copyable?</a></span>, <span class='object_link'><a href="Type.html#destructible%3F-instance_method" title="AutoC::Type#destructible? (method)">#destructible?</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#hash-instance_method" title="AutoC::Type#hash (method)">#hash</a></span>, <span class='object_link'><a href="Type.html#hashable%3F-instance_method" title="AutoC::Type#hashable? (method)">#hashable?</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#orderable%3F-instance_method" title="AutoC::Type#orderable? (method)">#orderable?</a></span>, <span class='object_link'><a href="Type.html#prefix-instance_method" title="AutoC::Type#prefix (method)">#prefix</a></span>, <span class='object_link'><a href="Type.html#private%3F-instance_method" title="AutoC::Type#private? (method)">#private?</a></span>, <span class='object_link'><a href="Type.html#public%3F-instance_method" title="AutoC::Type#public? (method)">#public?</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#static%3F-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>
|
380
383
|
|
381
384
|
|
382
385
|
|
@@ -391,187 +394,27 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
391
394
|
<div id="constructor_details" class="method_details_list">
|
392
395
|
<h2>Constructor Details</h2>
|
393
396
|
|
394
|
-
<
|
395
|
-
|
396
|
-
</div>
|
397
|
-
<div id="method_missing_details" class="method_details_list">
|
398
|
-
<h2>Dynamic Method Handling</h2>
|
399
|
-
<p class="notice super">
|
400
|
-
This class handles dynamic methods through the <tt>method_missing</tt> method
|
401
|
-
|
402
|
-
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>
|
403
|
-
|
404
|
-
</p>
|
405
|
-
|
406
|
-
</div>
|
407
|
-
|
408
|
-
|
409
|
-
<div id="instance_method_details" class="method_details_list">
|
410
|
-
<h2>Instance Method Details</h2>
|
411
|
-
|
412
|
-
|
413
|
-
<div class="method_details first">
|
414
|
-
<h3 class="signature first" id="ctor-instance_method">
|
397
|
+
<div class="method_details first">
|
398
|
+
<h3 class="signature first" id="initialize-instance_method">
|
415
399
|
|
416
|
-
- (<tt>
|
400
|
+
- (<tt><span class='object_link'><a href="" title="AutoC::Vector (class)">Vector</a></span></tt>) <strong>initialize</strong>(*args)
|
417
401
|
|
418
402
|
|
419
403
|
|
420
404
|
|
421
405
|
|
422
|
-
</h3><
|
423
|
-
<
|
424
|
-
<
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
120
|
429
|
-
121
|
430
|
-
122</pre>
|
431
|
-
</td>
|
432
|
-
<td>
|
433
|
-
<pre class="code"><span class="info file"># File 'lib/autoc/collection/vector.rb', line 120</span>
|
434
|
-
|
435
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_ctor'>ctor</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
436
|
-
<span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>?</span> <span class='kw'>super</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</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'> provides no default constructor</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
437
|
-
<span class='kw'>end</span></pre>
|
438
|
-
</td>
|
439
|
-
</tr>
|
440
|
-
</table>
|
406
|
+
</h3><div class="docstring">
|
407
|
+
<div class="discussion">
|
408
|
+
<div class="paragraph">
|
409
|
+
<p>Returns a new instance of Vector</p>
|
441
410
|
</div>
|
442
|
-
|
443
|
-
<div class="method_details ">
|
444
|
-
<h3 class="signature " id="write_exported_declarations-instance_method">
|
445
|
-
|
446
|
-
- (<tt>Object</tt>) <strong>write_exported_declarations</strong>(stream, declare, define)
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
</h3><table class="source_code">
|
453
|
-
<tr>
|
454
|
-
<td>
|
455
|
-
<pre class="lines">
|
456
|
-
|
457
|
-
|
458
|
-
145
|
459
|
-
146
|
460
|
-
147
|
461
|
-
148
|
462
|
-
149
|
463
|
-
150
|
464
|
-
151
|
465
|
-
152
|
466
|
-
153
|
467
|
-
154
|
468
|
-
155
|
469
|
-
156
|
470
|
-
157
|
471
|
-
158
|
472
|
-
159
|
473
|
-
160
|
474
|
-
161
|
475
|
-
162
|
476
|
-
163
|
477
|
-
164
|
478
|
-
165
|
479
|
-
166
|
480
|
-
167
|
481
|
-
168
|
482
|
-
169
|
483
|
-
170
|
484
|
-
171
|
485
|
-
172
|
486
|
-
173
|
487
|
-
174
|
488
|
-
175
|
489
|
-
176
|
490
|
-
177
|
491
|
-
178
|
492
|
-
179
|
493
|
-
180
|
494
|
-
181
|
495
|
-
182
|
496
|
-
183
|
497
|
-
184
|
498
|
-
185
|
499
|
-
186
|
500
|
-
187
|
501
|
-
188
|
502
|
-
189
|
503
|
-
190
|
504
|
-
191
|
505
|
-
192
|
506
|
-
193</pre>
|
507
|
-
</td>
|
508
|
-
<td>
|
509
|
-
<pre class="code"><span class="info file"># File 'lib/autoc/collection/vector.rb', line 145</span>
|
510
411
|
|
511
|
-
|
512
|
-
<span class='id identifier rubyid_stream'>stream</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>%$</span><span class='tstring_content'>
|
513
|
-
</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'>*, size_t);
|
514
|
-
</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'>*);
|
515
|
-
</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'>*);
|
516
|
-
</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'>*);
|
517
|
-
</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_resize'>resize</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'>*, size_t);
|
518
|
-
</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'>*);
|
519
|
-
</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) {
|
520
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
521
|
-
return self->element_count;
|
522
|
-
}
|
523
|
-
</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_within'>within</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, size_t index) {
|
524
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
525
|
-
return index < </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
526
|
-
}
|
527
|
-
</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_get'>get</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, size_t index) {
|
528
|
-
</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;
|
529
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
530
|
-
</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_within'>within</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, index));
|
531
|
-
</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->values[index]</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
532
|
-
return result;
|
533
|
-
}
|
534
|
-
</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_set'>set</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, size_t index, </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'> value) {
|
535
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
536
|
-
</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_within'>within</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, index));
|
537
|
-
</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'>self->values[index]</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
538
|
-
</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'>self->values[index]</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>value</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
539
|
-
}
|
540
|
-
</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_sort'>sort</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'>*);
|
541
|
-
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itCtor'>itCtor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, type) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itCtorEx'>itCtorEx</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, type, 1)
|
542
|
-
</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_itCtorEx'>itCtorEx</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'>* vector, int forward) {
|
543
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
544
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(vector);
|
545
|
-
self->vector = vector;
|
546
|
-
self->forward = forward;
|
547
|
-
self->index = forward ? -1 : </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'>(vector);
|
548
|
-
}
|
549
|
-
</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) {
|
550
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
551
|
-
if(self->forward) ++self->index; else --self->index;
|
552
|
-
return </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_within'>within</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->vector, self->index);
|
553
|
-
}
|
554
|
-
</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) {
|
555
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
556
|
-
return </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_get'>get</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->vector, self->index);
|
557
|
-
}
|
558
|
-
</span><span class='tstring_end'>$</span></span>
|
559
|
-
<span class='kw'>end</span></pre>
|
560
|
-
</td>
|
561
|
-
</tr>
|
562
|
-
</table>
|
412
|
+
</div>
|
563
413
|
</div>
|
564
|
-
|
565
|
-
<div class="method_details ">
|
566
|
-
<h3 class="signature " id="write_exported_types-instance_method">
|
567
|
-
|
568
|
-
- (<tt>Object</tt>) <strong>write_exported_types</strong>(stream)
|
569
|
-
|
570
|
-
|
414
|
+
<div class="tags">
|
571
415
|
|
572
416
|
|
573
|
-
|
574
|
-
</h3><table class="source_code">
|
417
|
+
</div><table class="source_code">
|
575
418
|
<tr>
|
576
419
|
<td>
|
577
420
|
<pre class="lines">
|
@@ -583,53 +426,44 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
583
426
|
127
|
584
427
|
128
|
585
428
|
129
|
586
|
-
130
|
587
|
-
131
|
588
|
-
132
|
589
|
-
133
|
590
|
-
134
|
591
|
-
135
|
592
|
-
136
|
593
|
-
137
|
594
|
-
138
|
595
|
-
139
|
596
|
-
140
|
597
|
-
141
|
598
|
-
142
|
599
|
-
143</pre>
|
429
|
+
130</pre>
|
600
430
|
</td>
|
601
431
|
<td>
|
602
432
|
<pre class="code"><span class="info file"># File 'lib/autoc/collection/vector.rb', line 124</span>
|
603
433
|
|
604
|
-
<span class='kw'>def</span> <span class='id identifier
|
605
|
-
<span class='
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
</span><span class='
|
610
|
-
|
611
|
-
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'>;
|
612
|
-
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'>;
|
613
|
-
struct </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
614
|
-
</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'>* values;
|
615
|
-
size_t element_count;
|
616
|
-
};
|
617
|
-
struct </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
618
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>* vector;
|
619
|
-
int index;
|
620
|
-
int forward;
|
621
|
-
};
|
622
|
-
</span><span class='tstring_end'>$</span></span>
|
623
|
-
<span class='kw'>end</span></pre>
|
434
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
435
|
+
<span class='kw'>super</span>
|
436
|
+
<span class='comment'># Override the default type constructor as the Vector's requires one extra parameter
|
437
|
+
</span> <span class='comment'># Note that this makes the Vector instance un-constructible
|
438
|
+
</span> <span class='ivar'>@ctor</span> <span class='op'>=</span> <span class='id identifier rubyid_define_function'>define_function</span><span class='lparen'>(</span><span class='symbol'>:ctor</span><span class='comma'>,</span> <span class='const'>Function</span><span class='op'>::</span><span class='const'>Signature</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='op'>^</span><span class='symbol'>:self</span><span class='comma'>,</span> <span class='symbol'>:size_t</span><span class='op'>^</span><span class='symbol'>:element_count</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
439
|
+
<span class='ivar'>@capability</span><span class='period'>.</span><span class='id identifier rubyid_subtract'>subtract</span> <span class='lbracket'>[</span><span class='symbol'>:constructible</span><span class='comma'>,</span> <span class='symbol'>:orderable</span><span class='rbracket'>]</span> <span class='comment'># No default constructor and no less operation defined
|
440
|
+
</span><span class='kw'>end</span></pre>
|
624
441
|
</td>
|
625
442
|
</tr>
|
626
443
|
</table>
|
627
444
|
</div>
|
445
|
+
|
446
|
+
</div>
|
447
|
+
<div id="method_missing_details" class="method_details_list">
|
448
|
+
<h2>Dynamic Method Handling</h2>
|
449
|
+
<p class="notice super">
|
450
|
+
This class handles dynamic methods through the <tt>method_missing</tt> method
|
628
451
|
|
629
|
-
<
|
630
|
-
|
452
|
+
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>
|
453
|
+
|
454
|
+
</p>
|
455
|
+
|
456
|
+
</div>
|
457
|
+
|
458
|
+
|
459
|
+
<div id="instance_method_details" class="method_details_list">
|
460
|
+
<h2>Instance Method Details</h2>
|
461
|
+
|
462
|
+
|
463
|
+
<div class="method_details first">
|
464
|
+
<h3 class="signature first" id="write_impls-instance_method">
|
631
465
|
|
632
|
-
- (<tt>Object</tt>) <strong>
|
466
|
+
- (<tt>Object</tt>) <strong>write_impls</strong>(stream, define)
|
633
467
|
|
634
468
|
|
635
469
|
|
@@ -641,17 +475,6 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
641
475
|
<pre class="lines">
|
642
476
|
|
643
477
|
|
644
|
-
195
|
645
|
-
196
|
646
|
-
197
|
647
|
-
198
|
648
|
-
199
|
649
|
-
200
|
650
|
-
201
|
651
|
-
202
|
652
|
-
203
|
653
|
-
204
|
654
|
-
205
|
655
478
|
206
|
656
479
|
207
|
657
480
|
208
|
@@ -736,20 +559,33 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
736
559
|
287
|
737
560
|
288
|
738
561
|
289
|
739
|
-
290
|
562
|
+
290
|
563
|
+
291
|
564
|
+
292
|
565
|
+
293
|
566
|
+
294
|
567
|
+
295
|
568
|
+
296
|
569
|
+
297
|
570
|
+
298
|
571
|
+
299
|
572
|
+
300
|
573
|
+
301
|
574
|
+
302
|
575
|
+
303</pre>
|
740
576
|
</td>
|
741
577
|
<td>
|
742
|
-
<pre class="code"><span class="info file"># File 'lib/autoc/collection/vector.rb', line
|
578
|
+
<pre class="code"><span class="info file"># File 'lib/autoc/collection/vector.rb', line 206</span>
|
743
579
|
|
744
|
-
<span class='kw'>def</span> <span class='id identifier
|
580
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_write_impls'>write_impls</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>
|
745
581
|
<span class='id identifier rubyid_stream'>stream</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>%$</span><span class='tstring_content'>
|
746
|
-
static void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_allocate'>allocate</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier
|
582
|
+
static void </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_allocate'>allocate</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self, size_t element_count) {
|
747
583
|
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
748
584
|
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(element_count > 0);
|
749
585
|
self->element_count = element_count;
|
750
586
|
self->values = (</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_malloc'>malloc</span><span class='embexpr_end'>}</span><span class='tstring_content'>(element_count*sizeof(</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_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->values);
|
751
587
|
}
|
752
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'>
|
588
|
+
</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_ctor'>ctor</span><span class='period'>.</span><span class='id identifier rubyid_definition'>definition</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
753
589
|
size_t index;
|
754
590
|
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
755
591
|
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_allocate'>allocate</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, element_count);
|
@@ -757,7 +593,7 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
757
593
|
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_ctor'>ctor</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>self->values[index]</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
758
594
|
}
|
759
595
|
}
|
760
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'>
|
596
|
+
</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_dtor'>dtor</span><span class='period'>.</span><span class='id identifier rubyid_definition'>definition</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
761
597
|
size_t index;
|
762
598
|
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
763
599
|
for(index = 0; index < </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self); ++index) {
|
@@ -765,7 +601,7 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
765
601
|
}
|
766
602
|
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_free'>free</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->values);
|
767
603
|
}
|
768
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'>
|
604
|
+
</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_copy'>copy</span><span class='period'>.</span><span class='id identifier rubyid_definition'>definition</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
769
605
|
size_t index, size;
|
770
606
|
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(src);
|
771
607
|
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(dst);
|
@@ -774,7 +610,7 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
774
610
|
</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'>dst->values[index]</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>src->values[index]</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
775
611
|
}
|
776
612
|
}
|
777
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'>
|
613
|
+
</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_equal'>equal</span><span class='period'>.</span><span class='id identifier rubyid_definition'>definition</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
778
614
|
size_t index, size;
|
779
615
|
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(lt);
|
780
616
|
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(rt);
|
@@ -786,11 +622,20 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
786
622
|
} else
|
787
623
|
return 0;
|
788
624
|
}
|
789
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'>
|
625
|
+
</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_identify'>identify</span><span class='period'>.</span><span class='id identifier rubyid_definition'>definition</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
626
|
+
size_t index, result = 0;
|
627
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
628
|
+
for(index = 0; index < self->element_count; ++index) {
|
629
|
+
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'>self->values[index]</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
630
|
+
result = AUTOC_RCYCLE(result);
|
631
|
+
}
|
632
|
+
return result;
|
633
|
+
}
|
634
|
+
</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_resize'>resize</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self, size_t new_element_count) {
|
790
635
|
size_t index, element_count, from, to;
|
791
636
|
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
792
637
|
if((element_count = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self)) != new_element_count) {
|
793
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier
|
638
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> values = (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type_ref'>type_ref</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'>(new_element_count*sizeof(</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_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(values);
|
794
639
|
from = AUTOC_MIN(element_count, new_element_count);
|
795
640
|
to = AUTOC_MAX(element_count, new_element_count);
|
796
641
|
for(index = 0; index < from; ++index) {
|
@@ -810,18 +655,11 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
810
655
|
self->element_count = new_element_count;
|
811
656
|
}
|
812
657
|
}
|
813
|
-
|
814
|
-
|
815
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
816
|
-
for(index = 0; index < self->element_count; ++index) {
|
817
|
-
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'>self->values[index]</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
818
|
-
result = AUTOC_RCYCLE(result);
|
819
|
-
}
|
820
|
-
return result;
|
821
|
-
}
|
658
|
+
</span><span class='tstring_end'>$</span></span>
|
659
|
+
<span class='id identifier rubyid_stream'>stream</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>%$</span><span class='tstring_content'>
|
822
660
|
static int </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_comparator'>comparator</span><span class='embexpr_end'>}</span><span class='tstring_content'>(void* lp_, void* rp_) {
|
823
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier
|
824
|
-
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier
|
661
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> lp = (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'>)lp_;
|
662
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> rp = (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'>)rp_;
|
825
663
|
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'>*lp</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>*rp</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
826
664
|
return 0;
|
827
665
|
} else if(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_less'>less</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>*lp</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>*rp</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>) {
|
@@ -830,11 +668,203 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
830
668
|
return +1;
|
831
669
|
}
|
832
670
|
}
|
833
|
-
</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_sort'>sort</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier
|
671
|
+
</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_sort'>sort</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self) {
|
834
672
|
typedef int (*F)(const void*, const void*);
|
835
673
|
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
836
674
|
qsort(self->values, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self), sizeof(</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'>), (F)</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_comparator'>comparator</span><span class='embexpr_end'>}</span><span class='tstring_content'>);
|
837
675
|
}
|
676
|
+
</span><span class='tstring_end'>$</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_orderable?'>orderable?</span>
|
677
|
+
<span class='kw'>end</span></pre>
|
678
|
+
</td>
|
679
|
+
</tr>
|
680
|
+
</table>
|
681
|
+
</div>
|
682
|
+
|
683
|
+
<div class="method_details ">
|
684
|
+
<h3 class="signature " id="write_intf_decls-instance_method">
|
685
|
+
|
686
|
+
- (<tt>Object</tt>) <strong>write_intf_decls</strong>(stream, declare, define)
|
687
|
+
|
688
|
+
|
689
|
+
|
690
|
+
|
691
|
+
|
692
|
+
</h3><table class="source_code">
|
693
|
+
<tr>
|
694
|
+
<td>
|
695
|
+
<pre class="lines">
|
696
|
+
|
697
|
+
|
698
|
+
153
|
699
|
+
154
|
700
|
+
155
|
701
|
+
156
|
702
|
+
157
|
703
|
+
158
|
704
|
+
159
|
705
|
+
160
|
706
|
+
161
|
707
|
+
162
|
708
|
+
163
|
709
|
+
164
|
710
|
+
165
|
711
|
+
166
|
712
|
+
167
|
713
|
+
168
|
714
|
+
169
|
715
|
+
170
|
716
|
+
171
|
717
|
+
172
|
718
|
+
173
|
719
|
+
174
|
720
|
+
175
|
721
|
+
176
|
722
|
+
177
|
723
|
+
178
|
724
|
+
179
|
725
|
+
180
|
726
|
+
181
|
727
|
+
182
|
728
|
+
183
|
729
|
+
184
|
730
|
+
185
|
731
|
+
186
|
732
|
+
187
|
733
|
+
188
|
734
|
+
189
|
735
|
+
190
|
736
|
+
191
|
737
|
+
192
|
738
|
+
193
|
739
|
+
194
|
740
|
+
195
|
741
|
+
196
|
742
|
+
197
|
743
|
+
198
|
744
|
+
199
|
745
|
+
200
|
746
|
+
201
|
747
|
+
202
|
748
|
+
203
|
749
|
+
204</pre>
|
750
|
+
</td>
|
751
|
+
<td>
|
752
|
+
<pre class="code"><span class="info file"># File 'lib/autoc/collection/vector.rb', line 153</span>
|
753
|
+
|
754
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_write_intf_decls'>write_intf_decls</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>
|
755
|
+
<span class='kw'>super</span>
|
756
|
+
<span class='id identifier rubyid_stream'>stream</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>%$</span><span class='tstring_content'>
|
757
|
+
</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_ctor'>ctor</span><span class='period'>.</span><span class='id identifier rubyid_declaration'>declaration</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
758
|
+
</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_dtor'>dtor</span><span class='period'>.</span><span class='id identifier rubyid_declaration'>declaration</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
759
|
+
</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_copy'>copy</span><span class='period'>.</span><span class='id identifier rubyid_declaration'>declaration</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
760
|
+
</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_equal'>equal</span><span class='period'>.</span><span class='id identifier rubyid_declaration'>declaration</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
761
|
+
</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_identify'>identify</span><span class='period'>.</span><span class='id identifier rubyid_declaration'>declaration</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
762
|
+
</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_resize'>resize</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'>, size_t);
|
763
|
+
</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_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self) {
|
764
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
765
|
+
return self->element_count;
|
766
|
+
}
|
767
|
+
</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_within'>within</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self, size_t index) {
|
768
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
769
|
+
return index < </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
770
|
+
}
|
771
|
+
</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_get'>get</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self, size_t index) {
|
772
|
+
</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;
|
773
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
774
|
+
</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_within'>within</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, index));
|
775
|
+
</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->values[index]</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
776
|
+
return result;
|
777
|
+
}
|
778
|
+
</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_set'>set</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self, size_t index, </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'> value) {
|
779
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
780
|
+
</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_within'>within</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, index));
|
781
|
+
</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'>self->values[index]</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
782
|
+
</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'>self->values[index]</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>value</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
783
|
+
}
|
784
|
+
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itCtor'>itCtor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, type) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_itCtorEx'>itCtorEx</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, type, 1)
|
785
|
+
</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_itCtorEx'>itCtorEx</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it_ref'>it_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> vector, int forward) {
|
786
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
787
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(vector);
|
788
|
+
self->vector = vector;
|
789
|
+
self->forward = forward;
|
790
|
+
self->index = forward ? -1 : </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'>(vector);
|
791
|
+
}
|
792
|
+
</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_ref'>it_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self) {
|
793
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
794
|
+
if(self->forward) ++self->index; else --self->index;
|
795
|
+
return </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_within'>within</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->vector, self->index);
|
796
|
+
}
|
797
|
+
</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_ref'>it_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> self) {
|
798
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
799
|
+
return </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_get'>get</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->vector, self->index);
|
800
|
+
}
|
801
|
+
</span><span class='tstring_end'>$</span></span>
|
802
|
+
<span class='id identifier rubyid_stream'>stream</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>%$</span><span class='tstring_content'>
|
803
|
+
</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_sort'>sort</span><span class='embexpr_end'>}</span><span class='tstring_content'>(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'>);
|
804
|
+
</span><span class='tstring_end'>$</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_orderable?'>orderable?</span>
|
805
|
+
<span class='kw'>end</span></pre>
|
806
|
+
</td>
|
807
|
+
</tr>
|
808
|
+
</table>
|
809
|
+
</div>
|
810
|
+
|
811
|
+
<div class="method_details ">
|
812
|
+
<h3 class="signature " id="write_intf_types-instance_method">
|
813
|
+
|
814
|
+
- (<tt>Object</tt>) <strong>write_intf_types</strong>(stream)
|
815
|
+
|
816
|
+
|
817
|
+
|
818
|
+
|
819
|
+
|
820
|
+
</h3><table class="source_code">
|
821
|
+
<tr>
|
822
|
+
<td>
|
823
|
+
<pre class="lines">
|
824
|
+
|
825
|
+
|
826
|
+
132
|
827
|
+
133
|
828
|
+
134
|
829
|
+
135
|
830
|
+
136
|
831
|
+
137
|
832
|
+
138
|
833
|
+
139
|
834
|
+
140
|
835
|
+
141
|
836
|
+
142
|
837
|
+
143
|
838
|
+
144
|
839
|
+
145
|
840
|
+
146
|
841
|
+
147
|
842
|
+
148
|
843
|
+
149
|
844
|
+
150
|
845
|
+
151</pre>
|
846
|
+
</td>
|
847
|
+
<td>
|
848
|
+
<pre class="code"><span class="info file"># File 'lib/autoc/collection/vector.rb', line 132</span>
|
849
|
+
|
850
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_write_intf_types'>write_intf_types</span><span class='lparen'>(</span><span class='id identifier rubyid_stream'>stream</span><span class='rparen'>)</span>
|
851
|
+
<span class='id identifier rubyid_stream'>stream</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>%$</span><span class='tstring_content'>
|
852
|
+
/***
|
853
|
+
**** </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'>)
|
854
|
+
***/
|
855
|
+
</span><span class='tstring_end'>$</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_public?'>public?</span>
|
856
|
+
<span class='id identifier rubyid_stream'>stream</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>%$</span><span class='tstring_content'>
|
857
|
+
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'>;
|
858
|
+
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'>;
|
859
|
+
struct </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
860
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> values;
|
861
|
+
size_t element_count;
|
862
|
+
};
|
863
|
+
struct </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
864
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type_ref'>type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> vector;
|
865
|
+
int index;
|
866
|
+
int forward;
|
867
|
+
};
|
838
868
|
</span><span class='tstring_end'>$</span></span>
|
839
869
|
<span class='kw'>end</span></pre>
|
840
870
|
</td>
|
@@ -847,9 +877,9 @@ Non-zero value of <code>forward</code> specifies a forward iterator, zero value
|
|
847
877
|
</div>
|
848
878
|
|
849
879
|
<div id="footer">
|
850
|
-
Generated on
|
880
|
+
Generated on Sat Nov 22 16:58:04 2014 by
|
851
881
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
852
|
-
0.8.7.
|
882
|
+
0.8.7.6 (ruby-2.1.5).
|
853
883
|
</div>
|
854
884
|
|
855
885
|
</body>
|