autoc 1.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGES.md +3 -0
- data/README.md +149 -0
- data/cmake/AutoC.cmake +39 -0
- data/lib/autoc/allocators.rb +51 -0
- data/lib/autoc/association.rb +126 -0
- data/lib/autoc/box.rb +311 -0
- data/lib/autoc/cmake.rb +54 -0
- data/lib/autoc/collection.rb +83 -110
- data/lib/autoc/composite.rb +333 -0
- data/lib/autoc/cstring.rb +263 -0
- data/lib/autoc/function.rb +247 -0
- data/lib/autoc/hash_map.rb +328 -0
- data/lib/autoc/hash_set.rb +339 -0
- data/lib/autoc/hashers.rb +102 -0
- data/lib/autoc/list.rb +444 -0
- data/lib/autoc/module.rb +434 -0
- data/lib/autoc/openmp.rb +15 -0
- data/lib/autoc/primitive.rb +27 -0
- data/lib/autoc/ranges.rb +707 -0
- data/lib/autoc/record.rb +247 -0
- data/lib/autoc/scaffold/docs.rb +117 -0
- data/lib/autoc/scaffold/generic_value.rb +86 -0
- data/lib/autoc/scaffold/project.rb +75 -0
- data/lib/autoc/scaffold/test_cstring.rb +113 -0
- data/lib/autoc/scaffold/test_cstring_hash_set.rb +35 -0
- data/lib/autoc/scaffold/test_int_box.rb +22 -0
- data/lib/autoc/scaffold/test_int_hash_set.rb +448 -0
- data/lib/autoc/scaffold/test_int_list.rb +106 -0
- data/lib/autoc/scaffold/test_int_vector.rb +83 -0
- data/lib/autoc/scaffold/test_v2v_hash_map.rb +83 -0
- data/lib/autoc/scaffold/test_value_hash_set.rb +60 -0
- data/lib/autoc/scaffold/test_value_vector.rb +146 -0
- data/{test/test.rb → lib/autoc/scaffold/tests.rb} +179 -158
- data/lib/autoc/scaffold.rb +12 -0
- data/lib/autoc/sequential.rb +99 -0
- data/lib/autoc/set.rb +331 -0
- data/lib/autoc/std.rb +149 -0
- data/lib/autoc/type.rb +93 -531
- data/lib/autoc/vector.rb +290 -0
- data/lib/autoc.rb +4 -35
- metadata +55 -85
- data/.yardopts +0 -4
- data/CHANGES +0 -23
- data/README +0 -28
- data/doc/AutoC/Code.html +0 -523
- data/doc/AutoC/Collection.html +0 -1214
- data/doc/AutoC/HashMap.html +0 -1441
- data/doc/AutoC/HashSet.html +0 -916
- data/doc/AutoC/Iterators/Bidirectional.html +0 -204
- data/doc/AutoC/Iterators/Unidirectional.html +0 -200
- data/doc/AutoC/Iterators.html +0 -126
- data/doc/AutoC/List.html +0 -1039
- data/doc/AutoC/Maps.html +0 -290
- data/doc/AutoC/Module/File.html +0 -415
- data/doc/AutoC/Module/Header.html +0 -437
- data/doc/AutoC/Module/Source.html +0 -707
- data/doc/AutoC/Module.html +0 -948
- data/doc/AutoC/Priority.html +0 -138
- data/doc/AutoC/Queue.html +0 -1172
- data/doc/AutoC/Reference.html +0 -735
- data/doc/AutoC/Sets.html +0 -520
- data/doc/AutoC/String.html +0 -1394
- data/doc/AutoC/TreeMap.html +0 -1565
- data/doc/AutoC/TreeSet.html +0 -1447
- data/doc/AutoC/Type.html +0 -2148
- data/doc/AutoC/UserDefinedType.html +0 -1047
- data/doc/AutoC/Vector.html +0 -987
- data/doc/AutoC.html +0 -331
- data/doc/_index.html +0 -388
- data/doc/class_list.html +0 -51
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -58
- data/doc/css/style.css +0 -481
- data/doc/file.CHANGES.html +0 -117
- data/doc/file.README.html +0 -116
- data/doc/file_list.html +0 -61
- data/doc/frames.html +0 -17
- data/doc/index.html +0 -116
- data/doc/js/app.js +0 -243
- data/doc/js/full_list.js +0 -216
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -1307
- data/doc/top-level-namespace.html +0 -112
- data/lib/autoc/code.rb +0 -237
- data/lib/autoc/collection/hash_map.rb +0 -385
- data/lib/autoc/collection/hash_set.rb +0 -337
- data/lib/autoc/collection/iterator.rb +0 -39
- data/lib/autoc/collection/list.rb +0 -429
- data/lib/autoc/collection/map.rb +0 -41
- data/lib/autoc/collection/queue.rb +0 -517
- data/lib/autoc/collection/set.rb +0 -134
- data/lib/autoc/collection/tree_map.rb +0 -464
- data/lib/autoc/collection/tree_set.rb +0 -611
- data/lib/autoc/collection/vector.rb +0 -336
- data/lib/autoc/string.rb +0 -492
- data/test/test_auto.c +0 -7141
- data/test/test_auto.h +0 -753
- data/test/test_char_string.rb +0 -270
- data/test/test_int_list.rb +0 -35
- data/test/test_int_tree_set.rb +0 -111
- data/test/test_int_vector.rb +0 -34
- data/test/test_value_hash_map.rb +0 -162
- data/test/test_value_hash_set.rb +0 -173
- data/test/test_value_list.rb +0 -193
- data/test/test_value_queue.rb +0 -275
- data/test/test_value_tree_map.rb +0 -176
- data/test/test_value_tree_set.rb +0 -173
- data/test/test_value_vector.rb +0 -155
- data/test/value.rb +0 -80
data/doc/AutoC/String.html
DELETED
@@ -1,1394 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
-
<title>
|
7
|
-
Class: AutoC::String
|
8
|
-
|
9
|
-
— Documentation by YARD 0.9.5
|
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
|
-
pathId = "AutoC::String";
|
19
|
-
relpath = '../';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
|
23
|
-
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
-
|
25
|
-
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
-
|
27
|
-
|
28
|
-
</head>
|
29
|
-
<body>
|
30
|
-
<div class="nav_wrap">
|
31
|
-
<iframe id="nav" src="../class_list.html"></iframe>
|
32
|
-
<div id="resizer"></div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="main" tabindex="-1">
|
36
|
-
<div id="header">
|
37
|
-
<div id="menu">
|
38
|
-
|
39
|
-
<a href="../_index.html">Index (S)</a> »
|
40
|
-
<span class='title'><span class='object_link'><a href="../AutoC.html" title="AutoC (module)">AutoC</a></span></span>
|
41
|
-
»
|
42
|
-
<span class="title">String</span>
|
43
|
-
|
44
|
-
</div>
|
45
|
-
|
46
|
-
<div id="search">
|
47
|
-
|
48
|
-
<a class="full_list_link" id="class_list_link"
|
49
|
-
href="../class_list.html">
|
50
|
-
|
51
|
-
<svg width="24" height="24">
|
52
|
-
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
-
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
-
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
-
</svg>
|
56
|
-
</a>
|
57
|
-
|
58
|
-
</div>
|
59
|
-
<div class="clear"></div>
|
60
|
-
</div>
|
61
|
-
|
62
|
-
<iframe id="search_frame" src="../class_list.html"></iframe>
|
63
|
-
|
64
|
-
<div id="content"><h1>Class: AutoC::String
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
</h1>
|
69
|
-
<div class="box_info">
|
70
|
-
|
71
|
-
<dl>
|
72
|
-
<dt>Inherits:</dt>
|
73
|
-
<dd>
|
74
|
-
<span class="inheritName"><span class='object_link'><a href="Type.html" title="AutoC::Type (class)">Type</a></span></span>
|
75
|
-
|
76
|
-
<ul class="fullTree">
|
77
|
-
<li>Object</li>
|
78
|
-
|
79
|
-
<li class="next"><span class='object_link'><a href="Code.html" title="AutoC::Code (class)">Code</a></span></li>
|
80
|
-
|
81
|
-
<li class="next"><span class='object_link'><a href="Type.html" title="AutoC::Type (class)">Type</a></span></li>
|
82
|
-
|
83
|
-
<li class="next">AutoC::String</li>
|
84
|
-
|
85
|
-
</ul>
|
86
|
-
<a href="#" class="inheritanceTree">show all</a>
|
87
|
-
|
88
|
-
</dd>
|
89
|
-
</dl>
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
<dl>
|
97
|
-
<dt>Includes:</dt>
|
98
|
-
<dd>Redirecting</dd>
|
99
|
-
</dl>
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
<dl>
|
107
|
-
<dt>Defined in:</dt>
|
108
|
-
<dd>lib/autoc/string.rb</dd>
|
109
|
-
</dl>
|
110
|
-
|
111
|
-
</div>
|
112
|
-
|
113
|
-
<h2>Overview</h2><div class="docstring">
|
114
|
-
<div class="discussion">
|
115
|
-
<div class="paragraph">
|
116
|
-
<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>
|
117
|
-
</div>
|
118
|
-
<div class="paragraph">
|
119
|
-
<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>
|
120
|
-
</div>
|
121
|
-
<div class="paragraph">
|
122
|
-
<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>
|
123
|
-
</div>
|
124
|
-
<div class="paragraph">
|
125
|
-
<p>The String’s default character type, <strong><em>CharType</em></strong>, is <strong><em>char</em></strong> although this can be changed.</p>
|
126
|
-
</div>
|
127
|
-
<div class="paragraph">
|
128
|
-
<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>
|
129
|
-
</div>
|
130
|
-
<div class="sect1">
|
131
|
-
<h2 id="_generated_c_interface">Generated C interface</h2>
|
132
|
-
<div class="sectionbody">
|
133
|
-
<div class="sect2">
|
134
|
-
<h3 id="_string_management">String management</h3>
|
135
|
-
<table class="tableblock frame-all grid-all spread">
|
136
|
-
<colgroup>
|
137
|
-
<col style="width: 50%;">
|
138
|
-
<col style="width: 50%;">
|
139
|
-
</colgroup>
|
140
|
-
<tbody>
|
141
|
-
<tr>
|
142
|
-
<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>
|
143
|
-
<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.
|
144
|
-
</p><p class="tableblock">NOTE: Previous contents of dst is overwritten.</p></td>
|
145
|
-
</tr>
|
146
|
-
<tr>
|
147
|
-
<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>
|
148
|
-
<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.
|
149
|
-
</p><p class="tableblock">NOTE: Previous contents of dst is overwritten.
|
150
|
-
</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>
|
151
|
-
</tr>
|
152
|
-
<tr>
|
153
|
-
<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>
|
154
|
-
<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.
|
155
|
-
</p><p class="tableblock">NULL value of chars is permitted; this case corresponds to an empty string "".
|
156
|
-
</p><p class="tableblock">NOTE: Previous contents of self is overwritten.</p></td>
|
157
|
-
</tr>
|
158
|
-
<tr>
|
159
|
-
<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>
|
160
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Destroy string self.</p></td>
|
161
|
-
</tr>
|
162
|
-
<tr>
|
163
|
-
<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>
|
164
|
-
<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>
|
165
|
-
</tr>
|
166
|
-
<tr>
|
167
|
-
<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>
|
168
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return hash code for string self.</p></td>
|
169
|
-
</tr>
|
170
|
-
</tbody>
|
171
|
-
</table>
|
172
|
-
</div>
|
173
|
-
<div class="sect2">
|
174
|
-
<h3 id="_basic_operations">Basic operations</h3>
|
175
|
-
<table class="tableblock frame-all grid-all spread">
|
176
|
-
<colgroup>
|
177
|
-
<col style="width: 50%;">
|
178
|
-
<col style="width: 50%;">
|
179
|
-
</colgroup>
|
180
|
-
<tbody>
|
181
|
-
<tr>
|
182
|
-
<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>
|
183
|
-
<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.
|
184
|
-
</p><p class="tableblock">NOTE: the returned value need not to be freed.
|
185
|
-
</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>
|
186
|
-
</tr>
|
187
|
-
<tr>
|
188
|
-
<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>
|
189
|
-
<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>
|
190
|
-
</tr>
|
191
|
-
<tr>
|
192
|
-
<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>
|
193
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return a <em>copy</em> of the character stored in self at position index.
|
194
|
-
</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>
|
195
|
-
</tr>
|
196
|
-
<tr>
|
197
|
-
<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>
|
198
|
-
<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.
|
199
|
-
</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>
|
200
|
-
</tr>
|
201
|
-
<tr>
|
202
|
-
<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>
|
203
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return number of characters stored in string self.
|
204
|
-
</p><p class="tableblock">Note that this does not include the null terminator.</p></td>
|
205
|
-
</tr>
|
206
|
-
<tr>
|
207
|
-
<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>
|
208
|
-
<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.
|
209
|
-
A valid index lies between 0 and <sub>type</sub>Size()-1 inclusively.</p></td>
|
210
|
-
</tr>
|
211
|
-
</tbody>
|
212
|
-
</table>
|
213
|
-
</div>
|
214
|
-
<div class="sect2">
|
215
|
-
<h3 id="_string_buffer_operations">String buffer operations</h3>
|
216
|
-
<div class="paragraph">
|
217
|
-
<p>Functions which provide the string buffer functionality.
|
218
|
-
This allows the incremental building of strings without excessive storage copying/reallocation.</p>
|
219
|
-
</div>
|
220
|
-
<table class="tableblock frame-all grid-all spread">
|
221
|
-
<colgroup>
|
222
|
-
<col style="width: 50%;">
|
223
|
-
<col style="width: 50%;">
|
224
|
-
</colgroup>
|
225
|
-
<tbody>
|
226
|
-
<tr>
|
227
|
-
<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>
|
228
|
-
<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>
|
229
|
-
</tr>
|
230
|
-
<tr>
|
231
|
-
<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>
|
232
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Append a <em>copy</em> of the character value to string self.
|
233
|
-
</p><p class="tableblock">Return non-zero value on success and zero value on conversion error.
|
234
|
-
</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>
|
235
|
-
</tr>
|
236
|
-
<tr>
|
237
|
-
<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>
|
238
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Append string representation of the integer value to string self.
|
239
|
-
</p><p class="tableblock">Return non-zero value on success and zero value on conversion error.
|
240
|
-
</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>
|
241
|
-
</tr>
|
242
|
-
<tr>
|
243
|
-
<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>
|
244
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Append string representation of the floating-point value to string self.
|
245
|
-
</p><p class="tableblock">Return non-zero value on success and zero value on conversion error.
|
246
|
-
</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>
|
247
|
-
</tr>
|
248
|
-
<tr>
|
249
|
-
<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>
|
250
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Append string representation of the pointer value to string self.
|
251
|
-
</p><p class="tableblock">Return non-zero value on success and zero value on conversion error.
|
252
|
-
</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>
|
253
|
-
</tr>
|
254
|
-
<tr>
|
255
|
-
<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>
|
256
|
-
<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>
|
257
|
-
</tr>
|
258
|
-
<tr>
|
259
|
-
<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>
|
260
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Append the <em>?sprintf()</em>- formatted string to string self.
|
261
|
-
</p><p class="tableblock">Return non-zero value on successful formatting and zero value if the call to <em>?sprintf()</em> failed.
|
262
|
-
The latter usually happens due to the encoding error.
|
263
|
-
</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.
|
264
|
-
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.
|
265
|
-
<em>Note that the choice is obviously made at compile-time.</em>
|
266
|
-
</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.
|
267
|
-
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.
|
268
|
-
</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.
|
269
|
-
If not explicitly set it defaults to 4096 bytes.</p></td>
|
270
|
-
</tr>
|
271
|
-
</tbody>
|
272
|
-
</table>
|
273
|
-
</div>
|
274
|
-
<div class="sect2">
|
275
|
-
<h3 id="_iteration_over_string_s_characters">Iteration over string’s characters</h3>
|
276
|
-
<table class="tableblock frame-all grid-all spread">
|
277
|
-
<colgroup>
|
278
|
-
<col style="width: 50%;">
|
279
|
-
<col style="width: 50%;">
|
280
|
-
</colgroup>
|
281
|
-
<tbody>
|
282
|
-
<tr>
|
283
|
-
<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>
|
284
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new forward iterator it on string self.
|
285
|
-
</p><p class="tableblock">NOTE: Previous contents of it is overwritten.</p></td>
|
286
|
-
</tr>
|
287
|
-
<tr>
|
288
|
-
<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>
|
289
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Create a new iterator it on string self.
|
290
|
-
Non-zero value of forward specifies a forward iterator, zero value specifies a backward iterator.
|
291
|
-
</p><p class="tableblock">NOTE: Previous contents of it is overwritten.</p></td>
|
292
|
-
</tr>
|
293
|
-
<tr>
|
294
|
-
<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>
|
295
|
-
<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>
|
296
|
-
</tr>
|
297
|
-
<tr>
|
298
|
-
<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>
|
299
|
-
<td class="tableblock halign-left valign-top"><p class="tableblock">Return a <em>copy</em> of the character pointed to by the iterator it.
|
300
|
-
</p><p class="tableblock">WARNING: current position <strong>must</strong> be valid otherwise the behavior is undefined. See <sub>it</sub>Move().</p></td>
|
301
|
-
</tr>
|
302
|
-
</tbody>
|
303
|
-
</table>
|
304
|
-
</div>
|
305
|
-
</div>
|
306
|
-
</div>
|
307
|
-
|
308
|
-
</div>
|
309
|
-
</div>
|
310
|
-
<div class="tags">
|
311
|
-
|
312
|
-
|
313
|
-
</div>
|
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)">#<strong>it_ref</strong> ⇒ Object </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)">#<strong>char_type</strong> ⇒ Object </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)">#<strong>char_type_ref</strong> ⇒ Object </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)">#<strong>constructible?</strong> ⇒ Boolean </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)">#<strong>initialize</strong>(type_name = :String, visibility = :public) ⇒ String </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)">#<strong>write_impls</strong>(stream, define) ⇒ Object </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)">#<strong>write_intf_decls</strong>(stream, declare, define) ⇒ Object </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)">#<strong>write_intf_types</strong>(stream) ⇒ Object </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#sortable%3F-instance_method" title="AutoC::Type#sortable? (method)">#sortable?</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
|
-
#<strong>initialize</strong>(type_name = :String, visibility = :public) ⇒ <tt><span class='object_link'><a href="" title="AutoC::String (class)">String</a></span></tt>
|
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
|
-
#<strong>it_ref</strong> ⇒ <tt>Object</tt> <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
|
-
#<strong>char_type</strong> ⇒ <tt>Object</tt>
|
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
|
-
#<strong>char_type_ref</strong> ⇒ <tt>Object</tt>
|
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
|
-
#<strong>constructible?</strong> ⇒ <tt>Boolean</tt>
|
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
|
-
#<strong>write_impls</strong>(stream, define) ⇒ <tt>Object</tt>
|
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
|
-
#<strong>write_intf_decls</strong>(stream, declare, define) ⇒ <tt>Object</tt>
|
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
|
-
#<strong>write_intf_types</strong>(stream) ⇒ <tt>Object</tt>
|
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'>>
|
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 Wed Oct 12 12:27:11 2016 by
|
1388
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1389
|
-
0.9.5 (ruby-2.3.1).
|
1390
|
-
</div>
|
1391
|
-
|
1392
|
-
</div>
|
1393
|
-
</body>
|
1394
|
-
</html>
|