autoc 1.2 → 1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +4 -0
- data/README +3 -1
- data/doc/AutoC.html +23 -7
- data/doc/AutoC/Code.html +3 -3
- data/doc/AutoC/Collection.html +289 -76
- data/doc/AutoC/HashMap.html +44 -46
- data/doc/AutoC/HashSet.html +20 -17
- data/doc/AutoC/List.html +56 -92
- data/doc/AutoC/Module.html +2 -2
- data/doc/AutoC/Module/File.html +2 -2
- data/doc/AutoC/Module/Header.html +6 -4
- data/doc/AutoC/Module/Source.html +26 -26
- data/doc/AutoC/Priority.html +2 -2
- data/doc/AutoC/Queue.html +30 -92
- data/doc/AutoC/Reference.html +217 -61
- data/doc/AutoC/String.html +1393 -0
- data/doc/AutoC/Type.html +240 -128
- data/doc/AutoC/UserDefinedType.html +688 -47
- data/doc/AutoC/Vector.html +154 -62
- data/doc/_index.html +9 -2
- data/doc/class_list.html +1 -1
- data/doc/file.CHANGES.html +10 -2
- data/doc/file.README.html +5 -3
- data/doc/index.html +5 -3
- data/doc/method_list.html +235 -97
- data/doc/top-level-namespace.html +2 -2
- data/lib/autoc.rb +3 -1
- data/lib/autoc/code.rb +3 -2
- data/lib/autoc/collection.rb +36 -40
- data/lib/autoc/collection/hash_map.rb +10 -14
- data/lib/autoc/collection/hash_set.rb +12 -11
- data/lib/autoc/collection/list.rb +21 -11
- data/lib/autoc/collection/queue.rb +5 -8
- data/lib/autoc/collection/vector.rb +28 -12
- data/lib/autoc/string.rb +492 -0
- data/lib/autoc/type.rb +155 -66
- data/test/test.rb +157 -35
- data/test/test_char_string.rb +270 -0
- data/test/test_int_list.rb +35 -0
- data/test/test_int_vector.rb +34 -0
- data/test/test_value_hash_map.rb +162 -0
- data/test/test_value_hash_set.rb +173 -0
- data/test/test_value_list.rb +193 -0
- data/test/test_value_queue.rb +275 -0
- data/test/test_value_vector.rb +155 -0
- data/test/value.rb +80 -0
- metadata +15 -8
- data/test/test.c +0 -1041
- data/test/test.h +0 -41
- data/test/test_auto.c +0 -3407
- data/test/test_auto.h +0 -765
@@ -0,0 +1,1393 @@
|
|
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::String
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
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/String.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 (S)</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">String</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::String
|
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="Type.html" title="AutoC::Type (class)">Type</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">AutoC::String</li>
|
86
|
+
|
87
|
+
</ul>
|
88
|
+
<a href="#" class="inheritanceTree">show all</a>
|
89
|
+
|
90
|
+
</dd>
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<dt class="r2">Includes:</dt>
|
98
|
+
<dd class="r2">Redirecting</dd>
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
<dt class="r1 last">Defined in:</dt>
|
105
|
+
<dd class="r1 last">lib/autoc/string.rb</dd>
|
106
|
+
|
107
|
+
</dl>
|
108
|
+
<div class="clear"></div>
|
109
|
+
|
110
|
+
<h2>Overview</h2><div class="docstring">
|
111
|
+
<div class="discussion">
|
112
|
+
<div class="paragraph">
|
113
|
+
<p>String is wrapper around the standard null-terminated C string which has the capabilities of both a plain string and a string builder optimized for appending and incremental building.</p>
|
114
|
+
</div>
|
115
|
+
<div class="paragraph">
|
116
|
+
<p>It is ought to be on par with the raw C strings performance-wise (or even exceed it since the string size is tracked).</p>
|
117
|
+
</div>
|
118
|
+
<div class="paragraph">
|
119
|
+
<p>Unlike the plain C string, this String type has value type semantics but it can be turned into the reference type with <span class='object_link'><a href="Reference.html" title="AutoC::Reference (class)">Reference</a></span>.</p>
|
120
|
+
</div>
|
121
|
+
<div class="paragraph">
|
122
|
+
<p>The String’s default character type, <strong><em>CharType</em></strong>, is <strong><em>char</em></strong> although this can be changed.</p>
|
123
|
+
</div>
|
124
|
+
<div class="paragraph">
|
125
|
+
<p>String generally obeys the Vector interface with respect to working with its characters and resembles the List interface when using its building capabilities.</p>
|
126
|
+
</div>
|
127
|
+
<div class="sect1">
|
128
|
+
<h2 id="_generated_c_interface">Generated C interface</h2>
|
129
|
+
<div class="sectionbody">
|
130
|
+
<div class="sect2">
|
131
|
+
<h3 id="_string_management">String management</h3>
|
132
|
+
<table class="tableblock frame-all grid-all spread">
|
133
|
+
<colgroup>
|
134
|
+
<col style="width: 50%;">
|
135
|
+
<col style="width: 50%;">
|
136
|
+
</colgroup>
|
137
|
+
<tbody>
|
138
|
+
<tr>
|
139
|
+
<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>
|
140
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new string dst filled with a <em>copy</em> the contents of src.
|
141
|
+
</p><p class="tableblock">NOTE: Previous contents of dst is overwritten.</p></td>
|
142
|
+
</tr>
|
143
|
+
<tr>
|
144
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>CopyRange(<strong><em>Type</em></strong> * dst, <strong><em>Type</em></strong> * src, <strong><em>size_t</em></strong> first, <strong><em>size_t</em></strong> last)</p></td>
|
145
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new string dst filled with a part the contents of src lying in the range [first, last], that is including the character at position first and including the character at position last.
|
146
|
+
</p><p class="tableblock">NOTE: Previous contents of dst is overwritten.
|
147
|
+
</p><p class="tableblock">WARNING: first <strong>must not</strong> exceed last (that is, first ⇐ last) and both indices <strong>must</strong> be valid otherwise behavior is undefined. See <sub>type</sub>Within().</p></td>
|
148
|
+
</tr>
|
149
|
+
<tr>
|
150
|
+
<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>const CharType *</em></strong> chars)</p></td>
|
151
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new string self with a <em>copy</em> of the null-terminated C string chars.
|
152
|
+
</p><p class="tableblock">NULL value of chars is permitted; this case corresponds to an empty string "".
|
153
|
+
</p><p class="tableblock">NOTE: Previous contents of self is overwritten.</p></td>
|
154
|
+
</tr>
|
155
|
+
<tr>
|
156
|
+
<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>
|
157
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Destroy string self.</p></td>
|
158
|
+
</tr>
|
159
|
+
<tr>
|
160
|
+
<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>
|
161
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return non-zero value if strings lt and rt are considered equal by contents and zero value otherwise.</p></td>
|
162
|
+
</tr>
|
163
|
+
<tr>
|
164
|
+
<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>
|
165
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return hash code for string self.</p></td>
|
166
|
+
</tr>
|
167
|
+
</tbody>
|
168
|
+
</table>
|
169
|
+
</div>
|
170
|
+
<div class="sect2">
|
171
|
+
<h3 id="_basic_operations">Basic operations</h3>
|
172
|
+
<table class="tableblock frame-all grid-all spread">
|
173
|
+
<colgroup>
|
174
|
+
<col style="width: 50%;">
|
175
|
+
<col style="width: 50%;">
|
176
|
+
</colgroup>
|
177
|
+
<tbody>
|
178
|
+
<tr>
|
179
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>const CharType *</em></strong> <sub>type</sub>Chars(<strong><em>Type</em></strong> * self)</p></td>
|
180
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return a <em>read-only view</em> of the string in a form of the standard C null-terminated string.
|
181
|
+
</p><p class="tableblock">NOTE: the returned value need not to be freed.
|
182
|
+
</p><p class="tableblock">WARNING: the returned value should be considered <strong>volatile</strong> and thus may be altered or invalidated by a subsequent call to any String method!</p></td>
|
183
|
+
</tr>
|
184
|
+
<tr>
|
185
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>Empty(<strong><em>Type</em></strong> * self)</p></td>
|
186
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return non-zero value if string self has zero length and zero value otherwise.</p></td>
|
187
|
+
</tr>
|
188
|
+
<tr>
|
189
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>CharType</em></strong> <sub>type</sub>Get(<strong><em>Type</em></strong> * self, <strong><em>size_t</em></strong> index)</p></td>
|
190
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return a <em>copy</em> of the character stored in self at position index.
|
191
|
+
</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>
|
192
|
+
</tr>
|
193
|
+
<tr>
|
194
|
+
<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>CharType</em></strong> value)</p></td>
|
195
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Store a <em>copy</em> of the character value in string self at position index.
|
196
|
+
</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>
|
197
|
+
</tr>
|
198
|
+
<tr>
|
199
|
+
<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>
|
200
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return number of characters stored in string self.
|
201
|
+
</p><p class="tableblock">Note that this does not include the null terminator.</p></td>
|
202
|
+
</tr>
|
203
|
+
<tr>
|
204
|
+
<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>
|
205
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return non-zero value if index is a valid character index and zero value otherwise.
|
206
|
+
A valid index lies between 0 and <sub>type</sub>Size()-1 inclusively.</p></td>
|
207
|
+
</tr>
|
208
|
+
</tbody>
|
209
|
+
</table>
|
210
|
+
</div>
|
211
|
+
<div class="sect2">
|
212
|
+
<h3 id="_string_buffer_operations">String buffer operations</h3>
|
213
|
+
<div class="paragraph">
|
214
|
+
<p>Functions which provide the string buffer functionality.
|
215
|
+
This allows the incremental building of strings without excessive storage copying/reallocation.</p>
|
216
|
+
</div>
|
217
|
+
<table class="tableblock frame-all grid-all spread">
|
218
|
+
<colgroup>
|
219
|
+
<col style="width: 50%;">
|
220
|
+
<col style="width: 50%;">
|
221
|
+
</colgroup>
|
222
|
+
<tbody>
|
223
|
+
<tr>
|
224
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>PushChars(<strong><em>Type</em></strong> * self, <strong><em>const CharType*</em></strong> chars)</p></td>
|
225
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Append a <em>copy</em> of the null-terminated C string chars to string self.</p></td>
|
226
|
+
</tr>
|
227
|
+
<tr>
|
228
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>PushChar(<strong><em>Type</em></strong> * self, <strong><em>CharType</em></strong> value)</p></td>
|
229
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Append a <em>copy</em> of the character value to string self.
|
230
|
+
</p><p class="tableblock">Return non-zero value on success and zero value on conversion error.
|
231
|
+
</p><p class="tableblock">NOTE: this convenience function applies generic formatting rules and is currently implemented as a macro; for more precise control over the formatting process use the <sub>type</sub>PushFormat() function.</p></td>
|
232
|
+
</tr>
|
233
|
+
<tr>
|
234
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>PushInt(<strong><em>Type</em></strong> * self, <strong><em>int</em></strong> value)</p></td>
|
235
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Append string representation of the integer value to string self.
|
236
|
+
</p><p class="tableblock">Return non-zero value on success and zero value on conversion error.
|
237
|
+
</p><p class="tableblock">NOTE: this convenience function applies generic formatting rules and is currently implemented as a macro; for more precise control over the formatting process use the <sub>type</sub>PushFormat() function.</p></td>
|
238
|
+
</tr>
|
239
|
+
<tr>
|
240
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>PushFloat(<strong><em>Type</em></strong> * self, <strong><em>double</em></strong> value)</p></td>
|
241
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Append string representation of the floating-point value to string self.
|
242
|
+
</p><p class="tableblock">Return non-zero value on success and zero value on conversion error.
|
243
|
+
</p><p class="tableblock">NOTE: this convenience function applies generic formatting rules and is currently implemented as a macro; for more precise control over the formatting process use the <sub>type</sub>PushFormat() function.</p></td>
|
244
|
+
</tr>
|
245
|
+
<tr>
|
246
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>PushPtr(<strong><em>Type</em></strong> * self, <strong><em>void*</em></strong> value)</p></td>
|
247
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Append string representation of the pointer value to string self.
|
248
|
+
</p><p class="tableblock">Return non-zero value on success and zero value on conversion error.
|
249
|
+
</p><p class="tableblock">NOTE: this convenience function applies generic formatting rules and is currently implemented as a macro; for more precise control over the formatting process use the <sub>type</sub>PushFormat() function.</p></td>
|
250
|
+
</tr>
|
251
|
+
<tr>
|
252
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>void</em></strong> <sub>type</sub>PushString(<strong><em>Type</em></strong> * self, <strong><em>Type</em></strong> * from)</p></td>
|
253
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Append a <em>copy</em> of the contents of string from to string self.</p></td>
|
254
|
+
</tr>
|
255
|
+
<tr>
|
256
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>int</em></strong> <sub>type</sub>PushFormat(<strong><em>Type</em></strong> * self, <strong><em>const char*</em></strong> format, …​);</p></td>
|
257
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Append the <em>?sprintf()</em>- formatted string to string self.
|
258
|
+
</p><p class="tableblock">Return non-zero value on successful formatting and zero value if the call to <em>?sprintf()</em> failed.
|
259
|
+
The latter usually happens due to the encoding error.
|
260
|
+
</p><p class="tableblock">This function tries to use the <em>vsnprintf()</em> standard C function if possible and falls back to <strong>unsafe</strong> <em>vsprintf()</em> function which is ought to be present in every ANSI-compliant standard C library.
|
261
|
+
The former function is used on the platforms which are known to have it; the Autotools-compliant <em>HAVE_VSNPRINTF</em> macro is also taken into consideration.
|
262
|
+
<em>Note that the choice is obviously made at compile-time.</em>
|
263
|
+
</p><p class="tableblock">If using the <em>vsnprintf()</em> and the allocated buffer is not large enough this function continuously expands the buffer to eventually accommodate the resulting string.
|
264
|
+
On the contrary, when the <strong>unsafe</strong> <em>vsprintf()</em> is used, the buffer overrun causes this function to <strong>abort()</strong> in order to possible data corruption not to slip away uncaught.
|
265
|
+
</p><p class="tableblock">Current implementation operates on the heap-allocated buffer whose initial size is determined by the <em>AUTOC_BUFFER_SIZE</em> macro.
|
266
|
+
If not explicitly set it defaults to 4096 bytes.</p></td>
|
267
|
+
</tr>
|
268
|
+
</tbody>
|
269
|
+
</table>
|
270
|
+
</div>
|
271
|
+
<div class="sect2">
|
272
|
+
<h3 id="_iteration_over_string_s_characters">Iteration over string’s characters</h3>
|
273
|
+
<table class="tableblock frame-all grid-all spread">
|
274
|
+
<colgroup>
|
275
|
+
<col style="width: 50%;">
|
276
|
+
<col style="width: 50%;">
|
277
|
+
</colgroup>
|
278
|
+
<tbody>
|
279
|
+
<tr>
|
280
|
+
<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>
|
281
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new forward iterator it on string self.
|
282
|
+
</p><p class="tableblock">NOTE: Previous contents of it is overwritten.</p></td>
|
283
|
+
</tr>
|
284
|
+
<tr>
|
285
|
+
<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>
|
286
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new iterator it on string self.
|
287
|
+
Non-zero value of forward specifies a forward iterator, zero value specifies a backward iterator.
|
288
|
+
</p><p class="tableblock">NOTE: Previous contents of it is overwritten.</p></td>
|
289
|
+
</tr>
|
290
|
+
<tr>
|
291
|
+
<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>
|
292
|
+
<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>
|
293
|
+
</tr>
|
294
|
+
<tr>
|
295
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong><em>CharType</em></strong> <sub>it</sub>Get(<strong><em>IteratorType</em></strong> * it)</p></td>
|
296
|
+
<td class="tableblock halign-left valign-top"><p class="tableblock">Return a <em>copy</em> of the character pointed to by the iterator it.
|
297
|
+
</p><p class="tableblock">WARNING: current position <strong>must</strong> be valid otherwise the behavior is undefined. See <sub>it</sub>Move().</p></td>
|
298
|
+
</tr>
|
299
|
+
</tbody>
|
300
|
+
</table>
|
301
|
+
</div>
|
302
|
+
</div>
|
303
|
+
</div>
|
304
|
+
|
305
|
+
</div>
|
306
|
+
</div>
|
307
|
+
<div class="tags">
|
308
|
+
|
309
|
+
|
310
|
+
</div>
|
311
|
+
<h2>Constant Summary</h2>
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
318
|
+
<ul class="summary">
|
319
|
+
|
320
|
+
<li class="public ">
|
321
|
+
<span class="summary_signature">
|
322
|
+
|
323
|
+
<a href="#it_ref-instance_method" title="#it_ref (instance method)">- (Object) <strong>it_ref</strong> </a>
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
</span>
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
<span class="note title readonly">readonly</span>
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
<span class="summary_desc"><div class='inline'><div class="paragraph">
|
343
|
+
<p>Returns the value of attribute it_ref.</p>
|
344
|
+
</div></div></span>
|
345
|
+
|
346
|
+
</li>
|
347
|
+
|
348
|
+
|
349
|
+
</ul>
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Type.html" title="AutoC::Type (class)">Type</a></span></h3>
|
356
|
+
<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>
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
<h2>
|
361
|
+
Instance Method Summary
|
362
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
363
|
+
</h2>
|
364
|
+
|
365
|
+
<ul class="summary">
|
366
|
+
|
367
|
+
<li class="public ">
|
368
|
+
<span class="summary_signature">
|
369
|
+
|
370
|
+
<a href="#char_type-instance_method" title="#char_type (instance method)">- (Object) <strong>char_type</strong> </a>
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
</span>
|
375
|
+
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
385
|
+
|
386
|
+
</li>
|
387
|
+
|
388
|
+
|
389
|
+
<li class="public ">
|
390
|
+
<span class="summary_signature">
|
391
|
+
|
392
|
+
<a href="#char_type_ref-instance_method" title="#char_type_ref (instance method)">- (Object) <strong>char_type_ref</strong> </a>
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
</span>
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
407
|
+
|
408
|
+
</li>
|
409
|
+
|
410
|
+
|
411
|
+
<li class="public ">
|
412
|
+
<span class="summary_signature">
|
413
|
+
|
414
|
+
<a href="#constructible%3F-instance_method" title="#constructible? (instance method)">- (Boolean) <strong>constructible?</strong> </a>
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
</span>
|
419
|
+
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
|
428
|
+
<span class="summary_desc"><div class='inline'><div class="paragraph">
|
429
|
+
<p>No default constructor provided.</p>
|
430
|
+
</div></div></span>
|
431
|
+
|
432
|
+
</li>
|
433
|
+
|
434
|
+
|
435
|
+
<li class="public ">
|
436
|
+
<span class="summary_signature">
|
437
|
+
|
438
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (String) <strong>initialize</strong>(type_name = :String, visibility = :public) </a>
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
</span>
|
443
|
+
|
444
|
+
|
445
|
+
<span class="note title constructor">constructor</span>
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
|
454
|
+
<span class="summary_desc"><div class='inline'><div class="paragraph">
|
455
|
+
<p>A new instance of String.</p>
|
456
|
+
</div></div></span>
|
457
|
+
|
458
|
+
</li>
|
459
|
+
|
460
|
+
|
461
|
+
<li class="public ">
|
462
|
+
<span class="summary_signature">
|
463
|
+
|
464
|
+
<a href="#write_impls-instance_method" title="#write_impls (instance method)">- (Object) <strong>write_impls</strong>(stream, define) </a>
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
</span>
|
469
|
+
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
479
|
+
|
480
|
+
</li>
|
481
|
+
|
482
|
+
|
483
|
+
<li class="public ">
|
484
|
+
<span class="summary_signature">
|
485
|
+
|
486
|
+
<a href="#write_intf_decls-instance_method" title="#write_intf_decls (instance method)">- (Object) <strong>write_intf_decls</strong>(stream, declare, define) </a>
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
</span>
|
491
|
+
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
|
500
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
501
|
+
|
502
|
+
</li>
|
503
|
+
|
504
|
+
|
505
|
+
<li class="public ">
|
506
|
+
<span class="summary_signature">
|
507
|
+
|
508
|
+
<a href="#write_intf_types-instance_method" title="#write_intf_types (instance method)">- (Object) <strong>write_intf_types</strong>(stream) </a>
|
509
|
+
|
510
|
+
|
511
|
+
|
512
|
+
</span>
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
|
522
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
523
|
+
|
524
|
+
</li>
|
525
|
+
|
526
|
+
|
527
|
+
</ul>
|
528
|
+
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
|
534
|
+
|
535
|
+
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
|
540
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Type.html" title="AutoC::Type (class)">Type</a></span></h3>
|
541
|
+
<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#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#initializable%3F-instance_method" title="AutoC::Type#initializable? (method)">#initializable?</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>
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
|
550
|
+
|
551
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Code.html" title="AutoC::Code (class)">Code</a></span></h3>
|
552
|
+
<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>
|
553
|
+
<div id="constructor_details" class="method_details_list">
|
554
|
+
<h2>Constructor Details</h2>
|
555
|
+
|
556
|
+
<div class="method_details first">
|
557
|
+
<h3 class="signature first" id="initialize-instance_method">
|
558
|
+
|
559
|
+
- (<tt><span class='object_link'><a href="" title="AutoC::String (class)">String</a></span></tt>) <strong>initialize</strong>(type_name = :String, visibility = :public)
|
560
|
+
|
561
|
+
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
</h3><div class="docstring">
|
566
|
+
<div class="discussion">
|
567
|
+
<div class="paragraph">
|
568
|
+
<p>Returns a new instance of String</p>
|
569
|
+
</div>
|
570
|
+
|
571
|
+
</div>
|
572
|
+
</div>
|
573
|
+
<div class="tags">
|
574
|
+
|
575
|
+
|
576
|
+
</div><table class="source_code">
|
577
|
+
<tr>
|
578
|
+
<td>
|
579
|
+
<pre class="lines">
|
580
|
+
|
581
|
+
|
582
|
+
206
|
583
|
+
207
|
584
|
+
208
|
585
|
+
209
|
586
|
+
210
|
587
|
+
211
|
588
|
+
212</pre>
|
589
|
+
</td>
|
590
|
+
<td>
|
591
|
+
<pre class="code"><span class="info file"># File 'lib/autoc/string.rb', line 206</span>
|
592
|
+
|
593
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_type_name'>type_name</span> <span class='op'>=</span> <span class='symbol'>:String</span><span class='comma'>,</span> <span class='id identifier rubyid_visibility'>visibility</span> <span class='op'>=</span> <span class='symbol'>:public</span><span class='rparen'>)</span>
|
594
|
+
<span class='kw'>super</span>
|
595
|
+
<span class='ivar'>@it_ref</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</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='tstring_end'>"</span></span>
|
596
|
+
<span class='ivar'>@list</span> <span class='op'>=</span> <span class='const'>List</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_list'>list</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='symbol'>:type</span> <span class='op'>=></span> <span class='id identifier rubyid_char_type_ref'>char_type_ref</span><span class='comma'>,</span> <span class='symbol'>:dtor</span> <span class='op'>=></span> <span class='id identifier rubyid_free'>free</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='symbol'>:private</span><span class='rparen'>)</span> <span class='comment'># List takes ownership over the strings put into it hence the custom element destructor
|
597
|
+
</span> <span class='id identifier rubyid_initialize_redirectors'>initialize_redirectors</span>
|
598
|
+
<span class='ivar'>@ctor</span> <span class='op'>=</span> <span class='id identifier rubyid_define_redirector'>define_redirector</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='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>const </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type_ref'>char_type_ref</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='op'>^</span><span class='symbol'>:chars</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
599
|
+
<span class='kw'>end</span></pre>
|
600
|
+
</td>
|
601
|
+
</tr>
|
602
|
+
</table>
|
603
|
+
</div>
|
604
|
+
|
605
|
+
</div>
|
606
|
+
<div id="method_missing_details" class="method_details_list">
|
607
|
+
<h2>Dynamic Method Handling</h2>
|
608
|
+
<p class="notice super">
|
609
|
+
This class handles dynamic methods through the <tt>method_missing</tt> method
|
610
|
+
|
611
|
+
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>
|
612
|
+
|
613
|
+
</p>
|
614
|
+
|
615
|
+
</div>
|
616
|
+
|
617
|
+
<div id="instance_attr_details" class="attr_details">
|
618
|
+
<h2>Instance Attribute Details</h2>
|
619
|
+
|
620
|
+
|
621
|
+
<span id=""></span>
|
622
|
+
<div class="method_details first">
|
623
|
+
<h3 class="signature first" id="it_ref-instance_method">
|
624
|
+
|
625
|
+
- (<tt>Object</tt>) <strong>it_ref</strong> <span class="extras">(readonly)</span>
|
626
|
+
|
627
|
+
|
628
|
+
|
629
|
+
|
630
|
+
|
631
|
+
</h3><div class="docstring">
|
632
|
+
<div class="discussion">
|
633
|
+
<div class="paragraph">
|
634
|
+
<p>Returns the value of attribute it_ref</p>
|
635
|
+
</div>
|
636
|
+
|
637
|
+
</div>
|
638
|
+
</div>
|
639
|
+
<div class="tags">
|
640
|
+
|
641
|
+
|
642
|
+
</div><table class="source_code">
|
643
|
+
<tr>
|
644
|
+
<td>
|
645
|
+
<pre class="lines">
|
646
|
+
|
647
|
+
|
648
|
+
204
|
649
|
+
205
|
650
|
+
206</pre>
|
651
|
+
</td>
|
652
|
+
<td>
|
653
|
+
<pre class="code"><span class="info file"># File 'lib/autoc/string.rb', line 204</span>
|
654
|
+
|
655
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_it_ref'>it_ref</span>
|
656
|
+
<span class='ivar'>@it_ref</span>
|
657
|
+
<span class='kw'>end</span></pre>
|
658
|
+
</td>
|
659
|
+
</tr>
|
660
|
+
</table>
|
661
|
+
</div>
|
662
|
+
|
663
|
+
</div>
|
664
|
+
|
665
|
+
|
666
|
+
<div id="instance_method_details" class="method_details_list">
|
667
|
+
<h2>Instance Method Details</h2>
|
668
|
+
|
669
|
+
|
670
|
+
<div class="method_details first">
|
671
|
+
<h3 class="signature first" id="char_type-instance_method">
|
672
|
+
|
673
|
+
- (<tt>Object</tt>) <strong>char_type</strong>
|
674
|
+
|
675
|
+
|
676
|
+
|
677
|
+
|
678
|
+
|
679
|
+
</h3><table class="source_code">
|
680
|
+
<tr>
|
681
|
+
<td>
|
682
|
+
<pre class="lines">
|
683
|
+
|
684
|
+
|
685
|
+
200</pre>
|
686
|
+
</td>
|
687
|
+
<td>
|
688
|
+
<pre class="code"><span class="info file"># File 'lib/autoc/string.rb', line 200</span>
|
689
|
+
|
690
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_char_type'>char_type</span><span class='semicolon'>;</span> <span class='symbol'>:char</span> <span class='kw'>end</span></pre>
|
691
|
+
</td>
|
692
|
+
</tr>
|
693
|
+
</table>
|
694
|
+
</div>
|
695
|
+
|
696
|
+
<div class="method_details ">
|
697
|
+
<h3 class="signature " id="char_type_ref-instance_method">
|
698
|
+
|
699
|
+
- (<tt>Object</tt>) <strong>char_type_ref</strong>
|
700
|
+
|
701
|
+
|
702
|
+
|
703
|
+
|
704
|
+
|
705
|
+
</h3><table class="source_code">
|
706
|
+
<tr>
|
707
|
+
<td>
|
708
|
+
<pre class="lines">
|
709
|
+
|
710
|
+
|
711
|
+
202</pre>
|
712
|
+
</td>
|
713
|
+
<td>
|
714
|
+
<pre class="code"><span class="info file"># File 'lib/autoc/string.rb', line 202</span>
|
715
|
+
|
716
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_char_type_ref'>char_type_ref</span><span class='semicolon'>;</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type'>char_type</span><span class='embexpr_end'>}</span><span class='tstring_content'>*</span><span class='tstring_end'>"</span></span> <span class='kw'>end</span></pre>
|
717
|
+
</td>
|
718
|
+
</tr>
|
719
|
+
</table>
|
720
|
+
</div>
|
721
|
+
|
722
|
+
<div class="method_details ">
|
723
|
+
<h3 class="signature " id="constructible?-instance_method">
|
724
|
+
|
725
|
+
- (<tt>Boolean</tt>) <strong>constructible?</strong>
|
726
|
+
|
727
|
+
|
728
|
+
|
729
|
+
|
730
|
+
|
731
|
+
</h3><div class="docstring">
|
732
|
+
<div class="discussion">
|
733
|
+
<div class="paragraph">
|
734
|
+
<p>No default constructor provided</p>
|
735
|
+
</div>
|
736
|
+
|
737
|
+
</div>
|
738
|
+
</div>
|
739
|
+
<div class="tags">
|
740
|
+
|
741
|
+
<p class="tag_title">Returns:</p>
|
742
|
+
<ul class="return">
|
743
|
+
|
744
|
+
<li>
|
745
|
+
|
746
|
+
|
747
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
748
|
+
|
749
|
+
|
750
|
+
|
751
|
+
</li>
|
752
|
+
|
753
|
+
</ul>
|
754
|
+
|
755
|
+
</div><table class="source_code">
|
756
|
+
<tr>
|
757
|
+
<td>
|
758
|
+
<pre class="lines">
|
759
|
+
|
760
|
+
|
761
|
+
215</pre>
|
762
|
+
</td>
|
763
|
+
<td>
|
764
|
+
<pre class="code"><span class="info file"># File 'lib/autoc/string.rb', line 215</span>
|
765
|
+
|
766
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_constructible?'>constructible?</span><span class='semicolon'>;</span> <span class='kw'>false</span> <span class='kw'>end</span></pre>
|
767
|
+
</td>
|
768
|
+
</tr>
|
769
|
+
</table>
|
770
|
+
</div>
|
771
|
+
|
772
|
+
<div class="method_details ">
|
773
|
+
<h3 class="signature " id="write_impls-instance_method">
|
774
|
+
|
775
|
+
- (<tt>Object</tt>) <strong>write_impls</strong>(stream, define)
|
776
|
+
|
777
|
+
|
778
|
+
|
779
|
+
|
780
|
+
|
781
|
+
</h3><table class="source_code">
|
782
|
+
<tr>
|
783
|
+
<td>
|
784
|
+
<pre class="lines">
|
785
|
+
|
786
|
+
|
787
|
+
322
|
788
|
+
323
|
789
|
+
324
|
790
|
+
325
|
791
|
+
326
|
792
|
+
327
|
793
|
+
328
|
794
|
+
329
|
795
|
+
330
|
796
|
+
331
|
797
|
+
332
|
798
|
+
333
|
799
|
+
334
|
800
|
+
335
|
801
|
+
336
|
802
|
+
337
|
803
|
+
338
|
804
|
+
339
|
805
|
+
340
|
806
|
+
341
|
807
|
+
342
|
808
|
+
343
|
809
|
+
344
|
810
|
+
345
|
811
|
+
346
|
812
|
+
347
|
813
|
+
348
|
814
|
+
349
|
815
|
+
350
|
816
|
+
351
|
817
|
+
352
|
818
|
+
353
|
819
|
+
354
|
820
|
+
355
|
821
|
+
356
|
822
|
+
357
|
823
|
+
358
|
824
|
+
359
|
825
|
+
360
|
826
|
+
361
|
827
|
+
362
|
828
|
+
363
|
829
|
+
364
|
830
|
+
365
|
831
|
+
366
|
832
|
+
367
|
833
|
+
368
|
834
|
+
369
|
835
|
+
370
|
836
|
+
371
|
837
|
+
372
|
838
|
+
373
|
839
|
+
374
|
840
|
+
375
|
841
|
+
376
|
842
|
+
377
|
843
|
+
378
|
844
|
+
379
|
845
|
+
380
|
846
|
+
381
|
847
|
+
382
|
848
|
+
383
|
849
|
+
384
|
850
|
+
385
|
851
|
+
386
|
852
|
+
387
|
853
|
+
388
|
854
|
+
389
|
855
|
+
390
|
856
|
+
391
|
857
|
+
392
|
858
|
+
393
|
859
|
+
394
|
860
|
+
395
|
861
|
+
396
|
862
|
+
397
|
863
|
+
398
|
864
|
+
399
|
865
|
+
400
|
866
|
+
401
|
867
|
+
402
|
868
|
+
403
|
869
|
+
404
|
870
|
+
405
|
871
|
+
406
|
872
|
+
407
|
873
|
+
408
|
874
|
+
409
|
875
|
+
410
|
876
|
+
411
|
877
|
+
412
|
878
|
+
413
|
879
|
+
414
|
880
|
+
415
|
881
|
+
416
|
882
|
+
417
|
883
|
+
418
|
884
|
+
419
|
885
|
+
420
|
886
|
+
421
|
887
|
+
422
|
888
|
+
423
|
889
|
+
424
|
890
|
+
425
|
891
|
+
426
|
892
|
+
427
|
893
|
+
428
|
894
|
+
429
|
895
|
+
430
|
896
|
+
431
|
897
|
+
432
|
898
|
+
433
|
899
|
+
434
|
900
|
+
435
|
901
|
+
436
|
902
|
+
437
|
903
|
+
438
|
904
|
+
439
|
905
|
+
440
|
906
|
+
441
|
907
|
+
442
|
908
|
+
443
|
909
|
+
444
|
910
|
+
445
|
911
|
+
446
|
912
|
+
447
|
913
|
+
448
|
914
|
+
449
|
915
|
+
450
|
916
|
+
451
|
917
|
+
452
|
918
|
+
453
|
919
|
+
454
|
920
|
+
455
|
921
|
+
456
|
922
|
+
457
|
923
|
+
458
|
924
|
+
459
|
925
|
+
460
|
926
|
+
461
|
927
|
+
462
|
928
|
+
463
|
929
|
+
464
|
930
|
+
465
|
931
|
+
466
|
932
|
+
467
|
933
|
+
468
|
934
|
+
469
|
935
|
+
470
|
936
|
+
471
|
937
|
+
472
|
938
|
+
473
|
939
|
+
474
|
940
|
+
475
|
941
|
+
476
|
942
|
+
477
|
943
|
+
478
|
944
|
+
479
|
945
|
+
480
|
946
|
+
481
|
947
|
+
482
|
948
|
+
483
|
949
|
+
484
|
950
|
+
485
|
951
|
+
486
|
952
|
+
487</pre>
|
953
|
+
</td>
|
954
|
+
<td>
|
955
|
+
<pre class="code"><span class="info file"># File 'lib/autoc/string.rb', line 322</span>
|
956
|
+
|
957
|
+
<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>
|
958
|
+
<span class='kw'>super</span>
|
959
|
+
<span class='lbracket'>[</span><span class='ivar'>@list</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_obj'>obj</span><span class='op'>|</span>
|
960
|
+
<span class='id identifier rubyid_obj'>obj</span><span class='period'>.</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_static'>static</span><span class='comma'>,</span> <span class='id identifier rubyid_inline'>inline</span><span class='rparen'>)</span>
|
961
|
+
<span class='id identifier rubyid_obj'>obj</span><span class='period'>.</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_static'>static</span><span class='rparen'>)</span>
|
962
|
+
<span class='rbrace'>}</span>
|
963
|
+
<span class='id identifier rubyid_stream'>stream</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>%$</span><span class='tstring_content'>
|
964
|
+
#include <stdio.h>
|
965
|
+
#include <stdarg.h>
|
966
|
+
#undef AUTOC_VSNPRINTF
|
967
|
+
#if defined(_MSC_VER)
|
968
|
+
#define AUTOC_VSNPRINTF _vsnprintf
|
969
|
+
#elif defined(__DMC__) || defined (__LCC__)
|
970
|
+
#define AUTOC_VSNPRINTF vsnprintf
|
971
|
+
#elif defined(HAVE_VSNPRINTF) || __STDC_VERSION__ >= 199901L /* Be Autotools-friendly, C99 must have snprintf() */
|
972
|
+
#define AUTOC_VSNPRINTF vsnprintf
|
973
|
+
#endif
|
974
|
+
#ifndef AUTOC_VSNPRINTF
|
975
|
+
/* #warning Using unsafe vsprintf() function */
|
976
|
+
#endif
|
977
|
+
</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__join'>_join</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) {
|
978
|
+
</span><span class='embexpr_beg'>#{</span><span class='ivar'>@list</span><span class='period'>.</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'> it;
|
979
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type_ref'>char_type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> string;
|
980
|
+
size_t* size; /* size sizes cache to avoid excessive calls to strlen() */
|
981
|
+
size_t i, start = 0, total = 0;
|
982
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
983
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->is_list);
|
984
|
+
if(!</span><span class='embexpr_beg'>#{</span><span class='ivar'>@list</span><span class='period'>.</span><span class='id identifier rubyid_empty'>empty</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&self->data.list)) {
|
985
|
+
size = (size_t*)malloc(</span><span class='embexpr_beg'>#{</span><span class='ivar'>@list</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&self->data.list)*sizeof(size_t)); </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(size);
|
986
|
+
</span><span class='embexpr_beg'>#{</span><span class='ivar'>@list</span><span class='period'>.</span><span class='id identifier rubyid_itCtor'>itCtor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&it, &self->data.list);
|
987
|
+
for(i = 0; </span><span class='embexpr_beg'>#{</span><span class='ivar'>@list</span><span class='period'>.</span><span class='id identifier rubyid_itMove'>itMove</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&it); ++i) {
|
988
|
+
total += (size[i] = strlen(</span><span class='embexpr_beg'>#{</span><span class='ivar'>@list</span><span class='period'>.</span><span class='id identifier rubyid_itGet'>itGet</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&it)));
|
989
|
+
}
|
990
|
+
string = (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type_ref'>char_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'>((total + 1)*sizeof(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type'>char_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'>(string);
|
991
|
+
</span><span class='embexpr_beg'>#{</span><span class='ivar'>@list</span><span class='period'>.</span><span class='id identifier rubyid_itCtor'>itCtor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&it, &self->data.list);
|
992
|
+
/* List is a LIFO structure therefore merging should be performed from right to left */
|
993
|
+
i = 0; start = total;
|
994
|
+
while(</span><span class='embexpr_beg'>#{</span><span class='ivar'>@list</span><span class='period'>.</span><span class='id identifier rubyid_itMove'>itMove</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&it)) {
|
995
|
+
start -= size[i];
|
996
|
+
memcpy(&string[start], </span><span class='embexpr_beg'>#{</span><span class='ivar'>@list</span><span class='period'>.</span><span class='id identifier rubyid_itGet'>itGet</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&it), size[i]*sizeof(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type'>char_type</span><span class='embexpr_end'>}</span><span class='tstring_content'>));
|
997
|
+
++i;
|
998
|
+
}
|
999
|
+
string[total] = '\\0';
|
1000
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_free'>free</span><span class='embexpr_end'>}</span><span class='tstring_content'>(size);
|
1001
|
+
} else {
|
1002
|
+
string = (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type_ref'>char_type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_calloc'>calloc</span><span class='embexpr_end'>}</span><span class='tstring_content'>(1, sizeof(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type'>char_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'>(string);
|
1003
|
+
}
|
1004
|
+
</span><span class='embexpr_beg'>#{</span><span class='ivar'>@list</span><span class='period'>.</span><span class='id identifier rubyid_dtor'>dtor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&self->data.list);
|
1005
|
+
self->size = total;
|
1006
|
+
self->data.string = string;
|
1007
|
+
self->is_list = 0;
|
1008
|
+
}
|
1009
|
+
</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__split'>_split</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) {
|
1010
|
+
</span><span class='embexpr_beg'>#{</span><span class='ivar'>@list</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> list;
|
1011
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1012
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(!self->is_list);
|
1013
|
+
</span><span class='embexpr_beg'>#{</span><span class='ivar'>@list</span><span class='period'>.</span><span class='id identifier rubyid_ctor'>ctor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&list);
|
1014
|
+
</span><span class='embexpr_beg'>#{</span><span class='ivar'>@list</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&list, self->data.string);
|
1015
|
+
/* self->size = strlen(self->data.string); not needed since the size shouldn't have changed */
|
1016
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->size == strlen(self->data.string));
|
1017
|
+
self->data.list = list;
|
1018
|
+
self->is_list = 1;
|
1019
|
+
}
|
1020
|
+
</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'> {
|
1021
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1022
|
+
if(chars) {
|
1023
|
+
size_t nbytes;
|
1024
|
+
self->size = strlen(chars);
|
1025
|
+
nbytes = (self->size + 1)*sizeof(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type'>char_type</span><span class='embexpr_end'>}</span><span class='tstring_content'>);
|
1026
|
+
self->data.string = (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type_ref'>char_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'>(nbytes); </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->data.string);
|
1027
|
+
memcpy(self->data.string, chars, nbytes);
|
1028
|
+
self->is_list = 0;
|
1029
|
+
} else {
|
1030
|
+
/* NULL argument is permitted and corresponds to empty string */
|
1031
|
+
self->size = 0;
|
1032
|
+
</span><span class='embexpr_beg'>#{</span><span class='ivar'>@list</span><span class='period'>.</span><span class='id identifier rubyid_ctor'>ctor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&self->data.list);
|
1033
|
+
self->is_list = 1;
|
1034
|
+
}
|
1035
|
+
}
|
1036
|
+
</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'> {
|
1037
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1038
|
+
if(self->is_list) </span><span class='embexpr_beg'>#{</span><span class='ivar'>@list</span><span class='period'>.</span><span class='id identifier rubyid_dtor'>dtor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&self->data.list); else </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_free'>free</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->data.string);
|
1039
|
+
}
|
1040
|
+
</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'> {
|
1041
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(src);
|
1042
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(dst);
|
1043
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(src != dst);
|
1044
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_ctor'>ctor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(dst, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_chars'>chars</span><span class='embexpr_end'>}</span><span class='tstring_content'>(src));
|
1045
|
+
}
|
1046
|
+
</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_copyRange'>copyRange</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'> dst, </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'> src, size_t first, size_t last) {
|
1047
|
+
size_t size;
|
1048
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type_ref'>char_type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> string;
|
1049
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(src);
|
1050
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(src != dst);
|
1051
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(first <= last);
|
1052
|
+
</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'>(src, first));
|
1053
|
+
</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'>(src, last));
|
1054
|
+
size = last - first + 1;
|
1055
|
+
string = (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type_ref'>char_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'>((size + 1)*sizeof(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type'>char_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'>(string);
|
1056
|
+
memcpy(string, &</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_chars'>chars</span><span class='embexpr_end'>}</span><span class='tstring_content'>(src)[first], size*sizeof(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type'>char_type</span><span class='embexpr_end'>}</span><span class='tstring_content'>));
|
1057
|
+
string[size] = '\\0';
|
1058
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_ctor'>ctor</span><span class='embexpr_end'>}</span><span class='tstring_content'>(dst, string);
|
1059
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_free'>free</span><span class='embexpr_end'>}</span><span class='tstring_content'>(string);
|
1060
|
+
}
|
1061
|
+
</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'> {
|
1062
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(lt);
|
1063
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(rt);
|
1064
|
+
return strcmp(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_chars'>chars</span><span class='embexpr_end'>}</span><span class='tstring_content'>(lt), </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_chars'>chars</span><span class='embexpr_end'>}</span><span class='tstring_content'>(rt)) == 0;
|
1065
|
+
}
|
1066
|
+
</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'> {
|
1067
|
+
size_t index, result = 0;
|
1068
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1069
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_join'>join</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1070
|
+
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) {
|
1071
|
+
result ^= self->data.string[index];
|
1072
|
+
result = AUTOC_RCYCLE(result);
|
1073
|
+
}
|
1074
|
+
return result;
|
1075
|
+
}
|
1076
|
+
</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_pushFormat'>pushFormat</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, const char* format, ...) {
|
1077
|
+
va_list args;
|
1078
|
+
char* buffer;
|
1079
|
+
int i, c, buffer_size = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid__bufferSize'>_bufferSize</span><span class='embexpr_end'>}</span><span class='tstring_content'>;
|
1080
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1081
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(format);
|
1082
|
+
do {
|
1083
|
+
buffer = (char*)</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_malloc'>malloc</span><span class='embexpr_end'>}</span><span class='tstring_content'>(buffer_size*sizeof(char)); </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(buffer);
|
1084
|
+
va_start(args, format);
|
1085
|
+
#ifdef AUTOC_VSNPRINTF
|
1086
|
+
i = AUTOC_VSNPRINTF(buffer, buffer_size, format, args);
|
1087
|
+
#else
|
1088
|
+
i = vsprintf(buffer, format, args);
|
1089
|
+
if(i >= buffer_size) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_abort'>abort</span><span class='embexpr_end'>}</span><span class='tstring_content'>();
|
1090
|
+
/* Since vsprintf() can not truncate its output this means the buffer overflow and
|
1091
|
+
there is no guarantee that some useful data is not corrupted so its better
|
1092
|
+
to crash right here than to let the corruption slip away uncaught */
|
1093
|
+
#endif
|
1094
|
+
c = (i > 0 && !(i < buffer_size));
|
1095
|
+
if(i > 0 && !c) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pushChars'>pushChars</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, buffer);
|
1096
|
+
va_end(args);
|
1097
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_free'>free</span><span class='embexpr_end'>}</span><span class='tstring_content'>(buffer);
|
1098
|
+
buffer_size *= 2;
|
1099
|
+
} while(c);
|
1100
|
+
return i >= 0;
|
1101
|
+
}
|
1102
|
+
</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_pushChars'>pushChars</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, const </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type_ref'>char_type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> chars) {
|
1103
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type_ref'>char_type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> string;
|
1104
|
+
size_t size, nbytes;
|
1105
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1106
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(chars);
|
1107
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_split'>split</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1108
|
+
size = strlen(chars);
|
1109
|
+
nbytes = (size + 1)*sizeof(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type'>char_type</span><span class='embexpr_end'>}</span><span class='tstring_content'>);
|
1110
|
+
string = (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type_ref'>char_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'>(nbytes); </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(string);
|
1111
|
+
memcpy(string, chars, nbytes);
|
1112
|
+
</span><span class='embexpr_beg'>#{</span><span class='ivar'>@list</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='embexpr_end'>}</span><span class='tstring_content'>(&self->data.list, string);
|
1113
|
+
self->size += size;
|
1114
|
+
}
|
1115
|
+
</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_pushString'>pushString</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, </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'> from) {
|
1116
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1117
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(from);
|
1118
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pushChars'>pushChars</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_chars'>chars</span><span class='embexpr_end'>}</span><span class='tstring_content'>(from));
|
1119
|
+
}
|
1120
|
+
#undef AUTOC_SNPRINTF
|
1121
|
+
</span><span class='tstring_end'>$</span></span>
|
1122
|
+
<span class='kw'>end</span></pre>
|
1123
|
+
</td>
|
1124
|
+
</tr>
|
1125
|
+
</table>
|
1126
|
+
</div>
|
1127
|
+
|
1128
|
+
<div class="method_details ">
|
1129
|
+
<h3 class="signature " id="write_intf_decls-instance_method">
|
1130
|
+
|
1131
|
+
- (<tt>Object</tt>) <strong>write_intf_decls</strong>(stream, declare, define)
|
1132
|
+
|
1133
|
+
|
1134
|
+
|
1135
|
+
|
1136
|
+
|
1137
|
+
</h3><table class="source_code">
|
1138
|
+
<tr>
|
1139
|
+
<td>
|
1140
|
+
<pre class="lines">
|
1141
|
+
|
1142
|
+
|
1143
|
+
242
|
1144
|
+
243
|
1145
|
+
244
|
1146
|
+
245
|
1147
|
+
246
|
1148
|
+
247
|
1149
|
+
248
|
1150
|
+
249
|
1151
|
+
250
|
1152
|
+
251
|
1153
|
+
252
|
1154
|
+
253
|
1155
|
+
254
|
1156
|
+
255
|
1157
|
+
256
|
1158
|
+
257
|
1159
|
+
258
|
1160
|
+
259
|
1161
|
+
260
|
1162
|
+
261
|
1163
|
+
262
|
1164
|
+
263
|
1165
|
+
264
|
1166
|
+
265
|
1167
|
+
266
|
1168
|
+
267
|
1169
|
+
268
|
1170
|
+
269
|
1171
|
+
270
|
1172
|
+
271
|
1173
|
+
272
|
1174
|
+
273
|
1175
|
+
274
|
1176
|
+
275
|
1177
|
+
276
|
1178
|
+
277
|
1179
|
+
278
|
1180
|
+
279
|
1181
|
+
280
|
1182
|
+
281
|
1183
|
+
282
|
1184
|
+
283
|
1185
|
+
284
|
1186
|
+
285
|
1187
|
+
286
|
1188
|
+
287
|
1189
|
+
288
|
1190
|
+
289
|
1191
|
+
290
|
1192
|
+
291
|
1193
|
+
292
|
1194
|
+
293
|
1195
|
+
294
|
1196
|
+
295
|
1197
|
+
296
|
1198
|
+
297
|
1199
|
+
298
|
1200
|
+
299
|
1201
|
+
300
|
1202
|
+
301
|
1203
|
+
302
|
1204
|
+
303
|
1205
|
+
304
|
1206
|
+
305
|
1207
|
+
306
|
1208
|
+
307
|
1209
|
+
308
|
1210
|
+
309
|
1211
|
+
310
|
1212
|
+
311
|
1213
|
+
312
|
1214
|
+
313
|
1215
|
+
314
|
1216
|
+
315
|
1217
|
+
316
|
1218
|
+
317
|
1219
|
+
318
|
1220
|
+
319
|
1221
|
+
320</pre>
|
1222
|
+
</td>
|
1223
|
+
<td>
|
1224
|
+
<pre class="code"><span class="info file"># File 'lib/autoc/string.rb', line 242</span>
|
1225
|
+
|
1226
|
+
<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>
|
1227
|
+
<span class='kw'>super</span>
|
1228
|
+
<span class='id identifier rubyid_write_redirectors'>write_redirectors</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>
|
1229
|
+
<span class='id identifier rubyid_stream'>stream</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>%$</span><span class='tstring_content'>
|
1230
|
+
#include <string.h>
|
1231
|
+
#ifdef AUTOC_BUFFER_SIZE
|
1232
|
+
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid__bufferSize'>_bufferSize</span><span class='embexpr_end'>}</span><span class='tstring_content'> AUTOC_BUFFER_SIZE
|
1233
|
+
#else
|
1234
|
+
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid__bufferSize'>_bufferSize</span><span class='embexpr_end'>}</span><span class='tstring_content'> 4096 /* Stay in sync with the documentation! */
|
1235
|
+
#endif
|
1236
|
+
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_join'>join</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self) if(self->is_list) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid__join'>_join</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1237
|
+
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_split'>split</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self) if(!self->is_list) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid__split'>_split</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1238
|
+
</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__join'>_join</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'>);
|
1239
|
+
</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__split'>_split</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'>);
|
1240
|
+
</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'>;
|
1241
|
+
</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'>;
|
1242
|
+
</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'>;
|
1243
|
+
</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_copyRange'>copyRange</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'>, </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, size_t);
|
1244
|
+
</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'>;
|
1245
|
+
</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'>;
|
1246
|
+
#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)
|
1247
|
+
</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) {
|
1248
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1249
|
+
/* </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_join'>join</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self); assuming the changes to the contents are reflected in the size */
|
1250
|
+
#ifndef NDEBUG
|
1251
|
+
/* Type invariants which must hold true */
|
1252
|
+
if(!self->is_list) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self->size == strlen(self->data.string));
|
1253
|
+
/* TODO self->is_list case */
|
1254
|
+
#endif
|
1255
|
+
return self->size;
|
1256
|
+
}
|
1257
|
+
</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) {
|
1258
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1259
|
+
/* Omitting excessive call to </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_join'>join</span><span class='embexpr_end'>}</span><span class='tstring_content'>() */
|
1260
|
+
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);
|
1261
|
+
}
|
1262
|
+
</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_char_type'>char_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) {
|
1263
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1264
|
+
</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));
|
1265
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_join'>join</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1266
|
+
return self->data.string[index];
|
1267
|
+
}
|
1268
|
+
</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_char_type'>char_type</span><span class='embexpr_end'>}</span><span class='tstring_content'> value) {
|
1269
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1270
|
+
</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));
|
1271
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_join'>join</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1272
|
+
self->data.string[index] = value;
|
1273
|
+
}
|
1274
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_define'>define</span><span class='embexpr_end'>}</span><span class='tstring_content'> const </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type_ref'>char_type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_chars'>chars</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) {
|
1275
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1276
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_join'>join</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1277
|
+
return self->data.string;
|
1278
|
+
}
|
1279
|
+
</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_pushFormat'>pushFormat</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'>, const char*, ...);
|
1280
|
+
</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_pushChars'>pushChars</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'>, const </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type_ref'>char_type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'>);
|
1281
|
+
</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_pushString'>pushString</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'>, </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'>);
|
1282
|
+
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pushChar'>pushChar</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, c) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pushFormat'>pushFormat</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, "%c", (char)(c))
|
1283
|
+
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pushInt'>pushInt</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, i) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pushFormat'>pushFormat</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, "%d", (int)(i))
|
1284
|
+
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pushFloat'>pushFloat</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, f) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pushFormat'>pushFormat</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, "%e", (double)(f))
|
1285
|
+
#define </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pushPtr'>pushPtr</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, p) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pushFormat'>pushFormat</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self, "%p", (void*)(p))
|
1286
|
+
#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)
|
1287
|
+
</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'> string, int forward) {
|
1288
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1289
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(string);
|
1290
|
+
self->string = string;
|
1291
|
+
self->forward = forward;
|
1292
|
+
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'>(string);
|
1293
|
+
}
|
1294
|
+
</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) {
|
1295
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1296
|
+
if(self->forward) ++self->index; else --self->index;
|
1297
|
+
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->string, self->index);
|
1298
|
+
}
|
1299
|
+
</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_char_type'>char_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) {
|
1300
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_assert'>assert</span><span class='embexpr_end'>}</span><span class='tstring_content'>(self);
|
1301
|
+
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->string, self->index);
|
1302
|
+
}
|
1303
|
+
</span><span class='tstring_end'>$</span></span>
|
1304
|
+
<span class='kw'>end</span></pre>
|
1305
|
+
</td>
|
1306
|
+
</tr>
|
1307
|
+
</table>
|
1308
|
+
</div>
|
1309
|
+
|
1310
|
+
<div class="method_details ">
|
1311
|
+
<h3 class="signature " id="write_intf_types-instance_method">
|
1312
|
+
|
1313
|
+
- (<tt>Object</tt>) <strong>write_intf_types</strong>(stream)
|
1314
|
+
|
1315
|
+
|
1316
|
+
|
1317
|
+
|
1318
|
+
|
1319
|
+
</h3><table class="source_code">
|
1320
|
+
<tr>
|
1321
|
+
<td>
|
1322
|
+
<pre class="lines">
|
1323
|
+
|
1324
|
+
|
1325
|
+
217
|
1326
|
+
218
|
1327
|
+
219
|
1328
|
+
220
|
1329
|
+
221
|
1330
|
+
222
|
1331
|
+
223
|
1332
|
+
224
|
1333
|
+
225
|
1334
|
+
226
|
1335
|
+
227
|
1336
|
+
228
|
1337
|
+
229
|
1338
|
+
230
|
1339
|
+
231
|
1340
|
+
232
|
1341
|
+
233
|
1342
|
+
234
|
1343
|
+
235
|
1344
|
+
236
|
1345
|
+
237
|
1346
|
+
238
|
1347
|
+
239
|
1348
|
+
240</pre>
|
1349
|
+
</td>
|
1350
|
+
<td>
|
1351
|
+
<pre class="code"><span class="info file"># File 'lib/autoc/string.rb', line 217</span>
|
1352
|
+
|
1353
|
+
<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>
|
1354
|
+
<span class='id identifier rubyid_stream'>stream</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>%$</span><span class='tstring_content'>
|
1355
|
+
/***
|
1356
|
+
**** </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_char_type'>char_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'>)
|
1357
|
+
***/
|
1358
|
+
</span><span class='tstring_end'>$</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_public?'>public?</span>
|
1359
|
+
<span class='lbracket'>[</span><span class='ivar'>@list</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_obj'>obj</span><span class='op'>|</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</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><span class='rbrace'>}</span> <span class='comment'># TODO : this should be handled by the entity dependencies system
|
1360
|
+
</span> <span class='id identifier rubyid_stream'>stream</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>%$</span><span class='tstring_content'>
|
1361
|
+
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'>;
|
1362
|
+
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'>;
|
1363
|
+
struct </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
1364
|
+
size_t size;
|
1365
|
+
union data {
|
1366
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_char_type_ref'>char_type_ref</span><span class='embexpr_end'>}</span><span class='tstring_content'> string;
|
1367
|
+
</span><span class='embexpr_beg'>#{</span><span class='ivar'>@list</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'> list;
|
1368
|
+
} data;
|
1369
|
+
int is_list;
|
1370
|
+
};
|
1371
|
+
struct </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_it'>it</span><span class='embexpr_end'>}</span><span class='tstring_content'> {
|
1372
|
+
</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'> string;
|
1373
|
+
int index, forward;
|
1374
|
+
};
|
1375
|
+
</span><span class='tstring_end'>$</span></span>
|
1376
|
+
<span class='kw'>end</span></pre>
|
1377
|
+
</td>
|
1378
|
+
</tr>
|
1379
|
+
</table>
|
1380
|
+
</div>
|
1381
|
+
|
1382
|
+
</div>
|
1383
|
+
|
1384
|
+
</div>
|
1385
|
+
|
1386
|
+
<div id="footer">
|
1387
|
+
Generated on Thu Mar 17 13:32:51 2016 by
|
1388
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1389
|
+
0.8.7.6 (ruby-2.2.4).
|
1390
|
+
</div>
|
1391
|
+
|
1392
|
+
</body>
|
1393
|
+
</html>
|