autodoc.git
/
traditional_manual
/
chapter_9.html
version
»
Context lines:
10
20
40
80
file
none
3
autodoc.git/traditional_manual/chapter_9.html:4308:
<dt class='head--doc'>Note</dt> <dd class='body--doc'><p>The "avoid copy" part means that a Buffer will never shrink unless you call the <code>trim</code> function.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>__fd_set_output</b></span> </dt>
-
<dd><p><code><code class='datatype'>int</code> <b><span class='method'>__fd_set_output</span>(</b><code class='datatype'>object</code> <code class='argument'>
f
</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>int</code> <b><span class='method'>__fd_set_output</span>(</b><code class='datatype'>object</code>
|<code
class='datatype'>function
<
/
code
>(<code
class='
datatype'>string</code>:<code class='datatype'>int</code>) <code class='
argument'>
write_callback
</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt> <dd class='body--doc'><p>This tells the buffer to trigger the write callback for the specified filedescriptor when data is added to the buffer.</p> <p> This is used internally by Stdio.File to handle nonblocking buffered mode, and is not really intended to be used directly.</p>
-
<p> If
f
is 0 the state is cleared.</p>
+
<p> If
<code>write_callback</code>
is
<code class='expr'>
0
</code>
(zero)
the state is cleared.</p>
</dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_encode</b></span><br> <span class='homogen--type'>Method</span> <span class='homogen--name'><b>_decode</b></span><br> </dt>
autodoc.git/traditional_manual/chapter_9.html:4668:
<dd class='example'><pre><pre><code><span class='comment'>// get the next whitespace separated word from the buffer.</span> buffer->match<span class='delim'>(</span><span class='string'>"%*[ \t\r\n]%[^ \t\r\n]"</span><span class='delim'>)</span><span class='delim'>;</span> </code></pre></pre></dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>output_to</b></span> </dt>
-
<dd><p><code><code class='datatype'>int(-1..)</code> <b><span class='method'>output_to</span>(</b><code class='object unresolved'>Stdio.Stream</code> <code class='argument'>
f
</code>, <code class='datatype'>int(0..)</code>|<code class='datatype'>void</code> <code class='argument'>nbytes</code><b>)</b></code></p></dd>
+
<dd><p><code><code class='datatype'>int(-1..)</code> <b><span class='method'>output_to</span>(</b><code class='object unresolved'>Stdio.Stream</code>
|<code
class='datatype'>function
<
/
code
>(<code
class='
datatype'>string</code>:<code class='datatype'>int</code>) <code class='
argument'>
fun
</code>, <code class='datatype'>int(0..)</code>|<code class='datatype'>void</code> <code class='argument'>nbytes</code><b>)</b></code></p></dd>
<dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Write data from the buffer to the indicated file.</p> </dd>
-
+
<dt class='head--doc'><span id='p-fun'></span>Parameter <code class='parameter'>fun</code></dt>
+
<dd></dd><dd class='body--doc'><p>Write function. Either one of:</p>
+
<table class='box'><tr><td><code><code class='object unresolved'>Stdio.Stream</code></code></td><td><p>A file object in which the function <code class='expr'>write()</code> will
+
be called.</p>
+
</td></tr>
+
<tr><td><code><code class='datatype'>function</code>(<code class='datatype'>string</code>:<code class='datatype'>int</code>)</code></td><td><p>A function which will be called with a <code class='expr'>string(8bit)</code>
+
to write and is expected to return an <code class='expr'>int</code> indicating
+
the number of bytes successfully written or <code class='expr'>-1</code> on
+
failure.</p>
+
</td></tr>
+
</table>
+
</dd>
<dt class='head--doc'><span id='p-nbytes'></span>Parameter <code class='parameter'>nbytes</code></dt> <dd></dd><dd class='body--doc'><p>If <code>nbytes</code> is not specified the whole buffer will be written if possible. Otherwise at most <code>nbytes</code> will be written.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Will return the number of bytes that have been written successfully.</p>
-
<p> If no bytes have been written successfully and <code class='expr'>
f->write
()</code> failed
+
<p> If no bytes have been written successfully and <code class='expr'>
fun
()</code> failed
with an error, <code class='expr'>-1</code> will be returned.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>range_error</b></span> </dt> <dd><p><code><code class='modifier'>protected</code> <code class='object unresolved'>bool</code> <b><span class='method'>range_error</span>(</b><code class='datatype'>int</code> <code class='argument'>howmuch</code><b>)</b></code></p></dd>