9699552002-03-12Martin Nilsson <!doctype html><html><head><title>Pike Reference Manual</title> <meta charset='utf-8'></head>
c3fe742003-02-05Martin Nilsson <body><dl><dt><h1 class='header'>9. I/O</h1></dt><dd><dl><dt><h2 class='header'>Class <b class='ms datatype'>Stdio.File</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>This is the basic I/O object, it provides socket communication as well as file access. It does not buffer reads and writes or provide line-by-line reading, that is done with <code>Stdio.FILE</code> object.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson 
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>`&lt;&lt;</b></span> </dt> <dd><p><code><code class='object unresolved'>Stdio.File</code> res = <code class='class'>Stdio.File()</code>&#32;&lt;&lt;&#32;<code class='class'>data</code></code><br> <code><code class='object unresolved'>Stdio.File</code> res = <code class='class'>Stdio.File()</code>&#32;&lt;&lt;&#32;<code class='class'>data</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Write some data to a file.</p> <p> If <code>data</code> is not a string, it will be casted to string, and then written to the file.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Throws an error if not all data could be written.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>write()</code></p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>assign</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>assign</span>(</b><code class='object unresolved'>File</code>|<code class='object unresolved'>Fd</code> <code class='argument'>o</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This function takes a clone of Stdio.File and assigns all variables of this file from it. It can be used together with <code>dup()</code> to move files around.</p>
e4e3f32002-04-06Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p><code>dup()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>async_connect</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
b27ad92003-04-22Marcus Comstedt <dd><p><code><code class='datatype'>int</code> <b><span class='method'>async_connect</span>(</b><code class='datatype'>string</code> <code class='argument'>host</code>, <code class='datatype'>int</code>|<code class='datatype'>string</code> <code class='argument'>port</code>, <code class='datatype'>function</code>(<code class='datatype'>int</code>, <code class='datatype'>mixed</code> ... :<code class='datatype'>void</code>) <code class='argument'>callback</code>, <code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Open a TCP/IP connection asynchronously.</p> <p> This function is similar to <code>connect()</code>, but works asynchronously.</p> </dd> <dt class='head--doc'><span id='p-host'></span>Parameter <code class='parameter'>host</code></dt> <dd></dd><dd class='body--doc'><p>Hostname or IP to connect to.</p> </dd> <dt class='head--doc'><span id='p-port'></span>Parameter <code class='parameter'>port</code></dt>
b27ad92003-04-22Marcus Comstedt <dd></dd><dd class='body--doc'><p>Port number or service name to connect to.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'><span id='p-callback'></span>Parameter <code class='parameter'>callback</code></dt> <dd></dd><dd class='body--doc'><p>Function to be called on completion.
84ea4e2003-04-07Martin Nilsson  The first argument will be <code class='expr'>1</code> if a connection was successfully estabished, and <code class='expr'>0</code> (zero) on failure.
c3fe742003-02-05Martin Nilsson  The rest of the arguments to <code>callback</code> are passed verbatim from <code>args</code>.</p> </dd> <dt class='head--doc'><span id='p-args'></span>Parameter <code class='parameter'>args</code></dt> <dd></dd><dd class='body--doc'><p>Extra arguments to pass to <code>callback</code>.</p> </dd> <dt class='head--doc'>Returns</dt>
84ea4e2003-04-07Martin Nilsson <dd class='body--doc'><p>Returns <code class='expr'>0</code> on failure, and <code class='expr'>1</code> if <code>callback</code>
c3fe742003-02-05Martin Nilsson  will be used.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>The socket may be opened with <code>open_socket()</code> ahead of the call to this function, but it is not required.</p> <p> For <code>callback</code> to be called, the backend must be active (ie
0f4adf2003-07-22Henrik Grubbström (Grubba)  <code>main()</code> must have returned <code class='expr'>-1</code>, or <code>Pike.DefaultBackend</code> get called in some other way).</p>
84ea4e2003-04-07Martin Nilsson <p> The socket will be in non-blocking state if <code class='expr'>1</code> has been
0f4adf2003-07-22Henrik Grubbström (Grubba)  returned, and any non-blocking callbacks will be cleared.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>connect()</code>, <code>open_socket()</code>, <code>set_nonblocking()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>close</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>close</span>(</b><b>)</b></code><br> <code><code class='datatype'>int</code> <b><span class='method'>close</span>(</b><code class='datatype'>string</code> <code class='argument'>direction</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Close the file. Optionally, specify "r", "w" or "rw" to close just the read, just the write or both read and write directions of the file respectively.</p>
d69f952003-10-22Martin Stjernholm <p> An exception is thrown if an I/O error occurs.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Nonzero is returned if the file wasn't open in the specified direction, zero otherwise.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>This function will not call the <tt>close_callback</tt>.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>open</code>, <code>open_socket</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>close</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>close</span>(</b><b>)</b></code><br> <code><code class='datatype'>int</code> <b><span class='method'>close</span>(</b><code class='datatype'>string</code> <code class='argument'>direction</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Close a file or stream.</p> <p> If direction is not specified, both the read and the write direction will be closed. Otherwise only the directions specified will be closed.</p>
a525602003-10-15Martin Stjernholm </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Nonzero is returned if the file or stream wasn't open in the specified direction, zero otherwise.</p>
5bfef52003-04-01Martin Nilsson </dd>
45f8092003-10-15Martin Stjernholm <dt class='head--doc'>Throws</dt> <dd class='body--doc'><p>An exception is thrown if an I/O error occurs.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p><code>close()</code> has no effect if this file object has been associated with an already opened file, i.e. if <code>open()</code> was given an integer as the first argument.</p> </dd>
5bfef52003-04-01Martin Nilsson <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>open()</code>, <code>open_socket()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>connect</b></span> </dt> <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>connect</span>(</b><code class='datatype'>string</code> <code class='argument'>dest_addr</code>, <code class='datatype'>int</code> <code class='argument'>dest_port</code><b>)</b></code><br> <code><code class='datatype'>bool</code> <b><span class='method'>connect</span>(</b><code class='datatype'>string</code> <code class='argument'>dest_addr</code>, <code class='datatype'>int</code> <code class='argument'>dest_port</code>, <code class='datatype'>string</code> <code class='argument'>src_addr</code>, <code class='datatype'>int</code> <code class='argument'>src_port</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Open a TCP/IP connection to the specified destination.</p> <p> In nonblocking mode, success is indicated with the write-callback, and failure with the close-callback or the read_oob-callback.</p> </dd> <dt class='head--doc'>Returns</dt>
84ea4e2003-04-07Martin Nilsson <dd class='body--doc'><p>Returns <code class='expr'>1</code> on success, and <code class='expr'>0</code> on failure.</p>
5bfef52003-04-01Martin Nilsson </dd> <dt class='head--doc'>Note</dt>
84ea4e2003-04-07Martin Nilsson <dd class='body--doc'><p>In nonblocking mode <code class='expr'>0</code> (zero) may be returned and <code>errno()</code> set to <tt>EWOULDBLOCK</tt> or <tt>WSAEWOULDBLOCK</tt>. This should not be regarded
5bfef52003-04-01Martin Nilsson  as a connection failure.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>connect</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
b27ad92003-04-22Marcus Comstedt <dd><p><code><code class='datatype'>int</code> <b><span class='method'>connect</span>(</b><code class='datatype'>string</code> <code class='argument'>host</code>, <code class='datatype'>int</code>|<code class='datatype'>string</code> <code class='argument'>port</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>client</code>, <code class='datatype'>void</code>|<code class='datatype'>int</code>|<code class='datatype'>string</code> <code class='argument'>client_port</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This function connects a socket previously created with <code>open_socket()</code> to a remote socket through TCP/IP. The <code>host</code> argument is the hostname or IP number of the remote machine. A local IP and port can be explicitly bound by specifying <code>client</code> and <code>client_port</code>.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>This function returns 1 for success, 0 otherwise.</p> </dd> <dt class='head--doc'>Note</dt>
84ea4e2003-04-07Martin Nilsson <dd class='body--doc'><p>In nonblocking mode <code class='expr'>0</code> (zero) may be returned and <code>errno()</code> set to <code class='expr'>EWOULDBLOCK</code> or <code class='expr'>WSAEWOULDBLOCK</code>. This should not be regarded as a connection failure. In nonblocking mode you need to wait for a write or close callback before you know if the connection failed or not.</p>
e4e3f32002-04-06Martin Nilsson </dd>
50af352002-07-15Martin Nilsson <dt class='head--doc'>See also</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p><code>query_address()</code>, <code>async_connect()</code>, <code>connect_unix()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>connect_unix</b></span> </dt> <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>connect_unix</span>(</b><code class='datatype'>string</code> <code class='argument'>filename</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Open a UNIX domain socket connection to the specified destination.</p> <p> In nonblocking mode, success is indicated with the write-callback, and failure with the close-callback or the read_oob-callback.</p> </dd> <dt class='head--doc'>Returns</dt>
84ea4e2003-04-07Martin Nilsson <dd class='body--doc'><p>Returns <code class='expr'>1</code> on success, and <code class='expr'>0</code> on failure.</p>
5bfef52003-04-01Martin Nilsson </dd> <dt class='head--doc'>Note</dt>
84ea4e2003-04-07Martin Nilsson <dd class='body--doc'><p>In nonblocking mode <code class='expr'>0</code> (zero) may be returned and <code>errno()</code> set to <tt>EWOULDBLOCK</tt> or <tt>WSAEWOULDBLOCK</tt>. This should not be regarded
5bfef52003-04-01Martin Nilsson  as a connection failure.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>connect_unix</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>connect_unix</span>(</b><code class='datatype'>string</code> <code class='argument'>path</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Open a UNIX domain socket connection to the specified destination.</p>
e4e3f32002-04-06Martin Nilsson </dd>
c3fe742003-02-05Martin Nilsson <dt class='head--doc'>Returns</dt>
84ea4e2003-04-07Martin Nilsson <dd class='body--doc'><p>Returns <code class='expr'>1</code> on success, and <code class='expr'>0</code> on failure.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Nonblocking mode is not supported while connecting</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>create</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><span class='object'>Stdio.File</span> <span class='class'>Stdio.File</span><b>(</b><b>)</b></code><br> <code><span class='object'>Stdio.File</span> <span class='class'>Stdio.File</span><b>(</b><code class='datatype'>string</code> <code class='argument'>filename</code><b>)</b></code><br> <code><span class='object'>Stdio.File</span> <span class='class'>Stdio.File</span><b>(</b><code class='datatype'>string</code> <code class='argument'>filename</code>, <code class='datatype'>string</code> <code class='argument'>mode</code><b>)</b></code><br> <code><span class='object'>Stdio.File</span> <span class='class'>Stdio.File</span><b>(</b><code class='datatype'>string</code> <code class='argument'>filename</code>, <code class='datatype'>string</code> <code class='argument'>mode</code>, <code class='datatype'>int</code> <code class='argument'>mask</code><b>)</b></code><br> <code><span class='object'>Stdio.File</span> <span class='class'>Stdio.File</span><b>(</b><code class='datatype'>string</code> <code class='argument'>descriptorname</code><b>)</b></code><br> <code><span class='object'>Stdio.File</span> <span class='class'>Stdio.File</span><b>(</b><code class='datatype'>int</code> <code class='argument'>fd</code><b>)</b></code><br> <code><span class='object'>Stdio.File</span> <span class='class'>Stdio.File</span><b>(</b><code class='datatype'>int</code> <code class='argument'>fd</code>, <code class='datatype'>string</code> <code class='argument'>mode</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>There are four basic ways to create a Stdio.File object. The first is calling it without any arguments, in which case the you'd have to call <code>open()</code>, <code>connect()</code> or some other method which connects the File object with a stream.</p> <p> The second way is calling it with a <code>filename</code> and open <code>mode</code>. This is the same thing as cloning and then calling <code>open()</code>, except shorter and faster.</p>
84ea4e2003-04-07Martin Nilsson <p> The third way is to call it with <code>descriptorname</code> of <code class='expr'>"stdin"</code>, <code class='expr'>"stdout"</code> or <code class='expr'>"stderr"</code>. This will open the specified
c3fe742003-02-05Martin Nilsson  standard stream.</p> <p> For the advanced users, you can use the file descriptors of the systems (note: emulated by pike on some systems - like NT). This is only useful for streaming purposes on unix systems. This is <b>not recommended at all</b> if you don't know what you're into. Default
84ea4e2003-04-07Martin Nilsson  <code>mode</code> for this is <code class='expr'>"rw"</code>.</p>
715b8a2002-10-12Martin Nilsson </dd>
c3fe742003-02-05Martin Nilsson <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Open mode will be filtered through the system UMASK. You might need to use <code>chmod()</code> later.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>open()</code>, <code>connect()</code>, <code>Stdio.FILE</code>,</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>create</b></span> </dt> <dd><p><code><span class='object'>Stdio.File</span> <span class='class'>Stdio.File</span><b>(</b><code class='datatype'>string</code> <code class='argument'>filename</code><b>)</b></code><br> <code><span class='object'>Stdio.File</span> <span class='class'>Stdio.File</span><b>(</b><code class='datatype'>string</code> <code class='argument'>filename</code>, <code class='datatype'>string</code> <code class='argument'>mode</code><b>)</b></code><br> <code><span class='object'>Stdio.File</span> <span class='class'>Stdio.File</span><b>(</b><code class='datatype'>string</code> <code class='argument'>filename</code>, <code class='datatype'>string</code> <code class='argument'>mode</code>, <code class='object unresolved'>in</code> <code class='argument'>access</code><b>)</b></code><br> <code><span class='object'>Stdio.File</span> <span class='class'>Stdio.File</span><b>(</b><code class='datatype'>int</code> <code class='argument'>fd</code><b>)</b></code><br> <code><span class='object'>Stdio.File</span> <span class='class'>Stdio.File</span><b>(</b><code class='datatype'>int</code> <code class='argument'>fd</code>, <code class='datatype'>string</code> <code class='argument'>mode</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>See <code>open()</code>.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>open()</code></p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>dup</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='object unresolved'>File</code> <b><span class='method'>dup</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This function returns a clone of Stdio.File with all variables copied from this file.</p>
715b8a2002-10-12Martin Nilsson </dd>
c3fe742003-02-05Martin Nilsson <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>All variables, even <tt>id</tt>, are copied.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>assign()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>dup</b></span> </dt> <dd><p><code><code class='object unresolved'>Stdio.File</code> <b><span class='method'>dup</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>dup2</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>dup2</span>(</b><code class='object unresolved'>Stdio.File</code> <code class='argument'>to</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Duplicate a file over another.</p> <p> This function works similarly to <code>assign()</code>, but instead of making the argument a reference to the same file, it creates a new file with the same properties and places it in the argument.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>assign()</code>, <code>dup()</code></p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>errno</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>errno</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Returns the error code for the last command on this file. Error code is normally cleared when a command is successful.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>errno</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>errno</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Return the errno for the latest failed file operation.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>grantpt</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>grantpt</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt>
1f71bf2003-05-15Marcus Comstedt <dd class='body--doc'><p>If this file has been created by calling <code>openpt()</code>, return the
5bfef52003-04-01Martin Nilsson  filename of the associated pts-file. This function should only be called once.</p>
34f9ab2003-09-30Martin Nilsson </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>This function is only available on some platforms.</p>
5bfef52003-04-01Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
c3fe742003-02-05Martin Nilsson <dt class='head--type'><span class='homogen--type'>Inherit</span> <span class='homogen--name'><b>Fd_ref</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><span class='datatype'><code class='modifier'>optional</code> inherit Fd_ref</span> : <span class='inherit'>Fd_ref</span></code></p></dd> </dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>line_iterator</b></span>
1f918f2002-05-26Martin Nilsson </dt>
88ba442003-04-21Henrik Grubbström (Grubba) <dd><p><code><code class='object unresolved'>String.SplitIterator</code>|<code class='object unresolved'>LineIterator</code> <b><span class='method'>line_iterator</span>(</b><code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>trim</code><b>)</b></code></p></dd>
c3fe742003-02-05Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns an iterator that will loop over the lines in this file.
0f4adf2003-07-22Henrik Grubbström (Grubba)  If trim is true, all <tt>'\r'</tt> characters will be removed from the input.</p>
c3fe742003-02-05Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>lock</b></span> </dt> <dd><p><code><code class='object unresolved'>Stdio.FileLockKey</code> <b><span class='method'>lock</span>(</b><b>)</b></code><br> <code><code class='object unresolved'>Stdio.FileLockKey</code> <b><span class='method'>lock</span>(</b><code class='datatype'>bool</code> <code class='argument'>is_recursive</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Makes an exclusive file lock on this file.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>trylock()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>mode</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>mode</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns the open mode for the file.</p> <table class='box'><tr><td><code><code class='key'>0x1000</code></code></td><td><p>FILE_READ</p> </td></tr> <tr><td><code><code class='key'>0x2000</code></code></td><td><p>FILE_WRITE</p> </td></tr> <tr><td><code><code class='key'>0x4000</code></code></td><td><p>FILE_APPEND</p> </td></tr> <tr><td><code><code class='key'>0x8000</code></code></td><td><p>FILE_CREATE</p> </td></tr> <tr><td><code><code class='key'>0x0100</code></code></td><td><p>FILE_TRUNC</p> </td></tr> <tr><td><code><code class='key'>0x0200</code></code></td><td><p>FILE_EXCLUSIVE</p> </td></tr> <tr><td><code><code class='key'>0x0400</code></code></td><td><p>FILE_NONBLOCKING</p> </td></tr> <tr><td><code><code class='key'>0x0800</code></code></td><td><p>FILE_SET_CLOSE_ON_EXEC</p> </td></tr> <tr><td><code><code class='key'>0x0001</code></code></td><td><p>FILE_HAS_INTERNAL_REF</p> </td></tr> <tr><td><code><code class='key'>0x0002</code></code></td><td><p>FILE_NO_CLOSE_ON_DESTRUCT</p> </td></tr> <tr><td><code><code class='key'>0x0004</code></code></td><td><p>FILE_LOCK_FD</p> </td></tr> <tr><td><code><code class='key'>0x0010</code></code></td><td><p>FILE_NOT_OPENED</p> </td></tr> </table> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>open()</code></p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>open</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>open</span>(</b><code class='datatype'>string</code> <code class='argument'>filename</code>, <code class='datatype'>string</code> <code class='argument'>mode</code><b>)</b></code><br> <code><code class='datatype'>int</code> <b><span class='method'>open</span>(</b><code class='datatype'>string</code> <code class='argument'>filename</code>, <code class='datatype'>string</code> <code class='argument'>mode</code>, <code class='datatype'>int</code> <code class='argument'>mask</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Open a file for read, write or append. The parameter <code>mode</code> should contain one or more of the following letters:</p>
84ea4e2003-04-07Martin Nilsson <table class='box'><tr><td><code><code class='key'>"r"</code></code></td><td><p>Open file for reading.</p>
c3fe742003-02-05Martin Nilsson </td></tr>
84ea4e2003-04-07Martin Nilsson <tr><td><code><code class='key'>"w"</code></code></td><td><p>Open file for writing.</p>
c3fe742003-02-05Martin Nilsson </td></tr>
84ea4e2003-04-07Martin Nilsson <tr><td><code><code class='key'>"a"</code></code></td><td><p>Open file for append (use with <code class='expr'>"w"</code>).</p>
c3fe742003-02-05Martin Nilsson </td></tr>
84ea4e2003-04-07Martin Nilsson <tr><td><code><code class='key'>"t"</code></code></td><td><p>Truncate file at open (use with <code class='expr'>"w"</code>).</p>
c3fe742003-02-05Martin Nilsson </td></tr>
84ea4e2003-04-07Martin Nilsson <tr><td><code><code class='key'>"c"</code></code></td><td><p>Create file if it doesn't exist (use with <code class='expr'>"w"</code>).</p>
c3fe742003-02-05Martin Nilsson </td></tr>
84ea4e2003-04-07Martin Nilsson <tr><td><code><code class='key'>"x"</code></code></td><td><p>Fail if file already exists (use with <code class='expr'>"c"</code>).</p>
c3fe742003-02-05Martin Nilsson </td></tr>
84ea4e2003-04-07Martin Nilsson </table><p><code>mode</code> should always contain at least one of the letters <code class='expr'>"r"</code> or <code class='expr'>"w"</code>.</p> <p> The parameter <code>mask</code> is protection bits to use if the file is created. Default is <code class='expr'>0666</code> (read+write for all in octal notation).</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>Returns</dt>
84ea4e2003-04-07Martin Nilsson <dd class='body--doc'><p>This function returns <code class='expr'>1</code> for success, <code class='expr'>0</code> otherwise.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>close()</code>, <code>create()</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>open</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>open</span>(</b><code class='datatype'>string</code> <code class='argument'>filename</code>, <code class='datatype'>string</code> <code class='argument'>mode</code><b>)</b></code><br> <code><code class='datatype'>int</code> <b><span class='method'>open</span>(</b><code class='datatype'>string</code> <code class='argument'>filename</code>, <code class='datatype'>string</code> <code class='argument'>mode</code>, <code class='datatype'>int</code> <code class='argument'>access</code><b>)</b></code><br> <code><code class='datatype'>int</code> <b><span class='method'>open</span>(</b><code class='datatype'>int</code> <code class='argument'>fd</code>, <code class='datatype'>string</code> <code class='argument'>mode</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt>
45f8092003-10-15Martin Stjernholm <dd class='body--doc'><p>Open a file, or use an existing fd.</p> <p> If <code>filename</code> is given, attempt to open the named file. If <code>fd</code> is given instead, it should be the file descriptor for an already opened file, which will then be used by this object.</p> <p> <code>mode</code> describes how the file will be opened. It's a case-insensitive string consisting of one or more of the following letters:</p> <dl class='group--doc'><dt>"r"</dt> <dd><p>Open for reading.</p> </dd> <dt>"w"</dt> <dd><p>Open for writing.</p> </dd> <dt>"a"</dt> <dd><p>Append new data to the end.</p> </dd> <dt>"c"</dt> <dd><p>Create the file if it doesn't exist already.</p> </dd> <dt>"t"</dt> <dd><p>Truncate the file to zero length if it already contains data. Use only together with <code class='expr'>"w"</code>.</p> </dd> <dt>"x"</dt> <dd><p>Open exclusively - the open will fail if the file already exists. Use only together with <code class='expr'>"c"</code>. Note that it's not safe to assume that this is atomic on some systems.</p> </dd> </dl><p><code>access</code> specifies the permissions to use if a new file is created. It is a UNIX style permission bitfield:</p> <dl class='group--doc'><dt>0400</dt> <dd><p>User has read permission.</p> </dd> <dt>0200</dt> <dd><p>User has write permission.</p> </dd> <dt>0100</dt> <dd><p>User has execute permission.</p> </dd> <dt>0040</dt> <dd><p>Group has read permission.</p> </dd> <dt>0020</dt> <dd><p>Group has write permission.</p> </dd> <dt>0010</dt> <dd><p>Group has execute permission.</p> </dd> <dt>0004</dt> <dd><p>Others have read permission.</p> </dd> <dt>0002</dt> <dd><p>Others have write permission.</p> </dd> <dt>0001</dt> <dd><p>Others have execute permission.</p> </dd> </dl><p>It's system dependent on which of these bits that are actually heeded. If <code>access</code> is not specified, it will default to <code class='expr'>00666</code>, but note that on UNIX systems it's masked with the process umask before use.</p>
5bfef52003-04-01Martin Nilsson </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>close()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>open_socket</b></span> </dt>
4ed3b72003-04-26Marcus Comstedt <dd><p><code><code class='datatype'>int</code> <b><span class='method'>open_socket</span>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>port</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>address</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>family</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This makes this file into a socket ready for connections. The reason for this function is so that you can set the socket to nonblocking or blocking (default is blocking) before you call <code>connect()</code>.</p> <p> If you give a <code>port</code> number to this function, the socket will be bound to this <code>port</code> locally before connecting anywhere. This is only useful for some silly protocols like <b>FTP</b>. You may also specify an <code>address</code> to bind to if your machine has many IP numbers.</p>
b27ad92003-04-22Marcus Comstedt <p> <code>port</code> can also be specified as a string, giving the name of the service associated with the port.</p>
4ed3b72003-04-26Marcus Comstedt <p> Finally, a protocol <code>family</code> for the socket can be specified. If no <code>family</code> is specified, one which is appropriate for the <code>address</code> is automatically selected. Thus, there is normally no need to specify it.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>This function returns 1 for success, 0 otherwise.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>connect()</code>, <code>set_nonblocking()</code>, <code>set_blocking()</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
c3fe742003-02-05Martin Nilsson 
b27ad92003-04-22Marcus Comstedt <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>open_socket</b></span> </dt>
4ed3b72003-04-26Marcus Comstedt <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>open_socket</span>(</b><code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>port</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>addr</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>family</code><b>)</b></code></p></dd>
b27ad92003-04-22Marcus Comstedt </dl>
1f71bf2003-05-15Marcus Comstedt <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>openpt</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>openpt</span>(</b><code class='datatype'>string</code> <code class='argument'>mode</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Open the master end of a pseudo-terminal pair. The parameter <code>mode</code> should contain one or more of the following letters:</p> <table class='box'><tr><td><code><code class='key'>"r"</code></code></td><td><p>Open terminal for reading.</p> </td></tr> <tr><td><code><code class='key'>"w"</code></code></td><td><p>Open terminal for writing.</p> </td></tr> </table><p><code>mode</code> should always contain at least one of the letters <code class='expr'>"r"</code> or <code class='expr'>"w"</code>.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>grantpt()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>openpt</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>openpt</span>(</b><code class='datatype'>string</code> <code class='argument'>mode</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Open the master end of a pseudo-terminal pair.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>grantpt()</code></p> </dd></dl>
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>peek</b></span> </dt> <dd><p><code><code class='datatype'>int(-1..1)</code> <b><span class='method'>peek</span>(</b><b>)</b></code><br> <code><code class='datatype'>int(-1..1)</code> <b><span class='method'>peek</span>(</b><code class='datatype'>int</code>|<code class='datatype'>float</code> <code class='argument'>timeout</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Check if there is data available to read, or wait some time for available data to read.</p>
84ea4e2003-04-07Martin Nilsson <p> Returns <code class='expr'>1</code> if there is data available to read, <code class='expr'>0</code> (zero) if there is no data available, and <code class='expr'>-1</code> if something went wrong.</p>
5bfef52003-04-01Martin Nilsson </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>errno()</code>, <code>read()</code></p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>The function may be interrupted prematurely of the timeout (due to signals); check the timing manually if this is imporant.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>pipe</b></span> </dt> <dd><p><code><code class='object unresolved'>Stdio.File</code> <b><span class='method'>pipe</span>(</b><b>)</b></code><br> <code><code class='object unresolved'>Stdio.File</code> <b><span class='method'>pipe</span>(</b><code class='datatype'>int</code> <code class='argument'>flags</code><b>)</b></code></p></dd> </dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>pipe</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
25eb8a2003-10-05Henrik Grubbström (Grubba) <dd><p><code><code class='object unresolved'>File</code> <b><span class='method'>pipe</span>(</b><code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>required_properties</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
25eb8a2003-10-05Henrik Grubbström (Grubba) <dd class='body--doc'><p>This function creates a pipe between the object it was called in and an object that is returned.</p> </dd>
9cb4712003-10-08Martin Nilsson <dt class='head--doc'><span id='p-required_properties'></span>Parameter <code class='parameter'>required_properties</code></dt>
25eb8a2003-10-05Henrik Grubbström (Grubba) <dd></dd><dd class='body--doc'><p>Binary or (<code>predef::`|()</code>) of required <code class='expr'>PROP_</code> properties.</p> <table class='box'><tr><td><code><code class='key'>PROP_IPC</code></code></td><td><p>The resulting pipe may be used for inter process communication.</p> </td></tr> <tr><td><code><code class='key'>PROP_NONBLOCK</code></code></td><td><p>The resulting pipe supports nonblocking I/O.</p> </td></tr> <tr><td><code><code class='key'>PROP_SHUTDOWN</code></code></td><td><p>The resulting pipe supports shutting down transmission in either direction (see <code>close()</code>).</p> </td></tr> <tr><td><code><code class='key'>PROP_BUFFERED</code></code></td><td><p>The resulting pipe is buffered (usually 4KB).</p> </td></tr> <tr><td><code><code class='key'>PROP_BIDIRECTIONAL</code></code></td><td><p>The resulting pipe is bi-directional.</p> </td></tr> <tr><td><code><code class='key'>PROP_REVERSE</code></code></td><td><p>The resulting pipe supports communication "backwards" (but not necessarily "forwards", see <code>PROP_BIDIRECTIONAL</code>).</p> </td></tr> </table><p>The default is <code class='expr'>PROP_NONBLOCK|PROP_BIDIRECTIONAL</code>.</p> <p> If <code>PROP_BIDIRECTIONAL</code> isn't specified, the read-end is this object, and the write-end is the returned object (unless <code>PROP_REVERSE</code> has been specified, in which case it is the other way around).</p> <p> The two ends of a bi-directional pipe are indistinguishable.</p> <p> If the File object this function is called in was open to begin with, it will be closed before the pipe is created.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Calling this function with an argument of <tt>0</tt> is not the same as calling it with no arguments.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
25eb8a2003-10-05Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>Process.create_process()</code>, <code>PROP_IPC</code>, <code>PROP_NONBLOCK</code>, <code>PROP_SHUTDOWN</code>, <code>PROP_BUFFERED</code>, <code>PROP_REVERSE</code>, <code>PROP_BIDIRECTIONAL</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>proxy</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>proxy</span>(</b><code class='object unresolved'>Stdio.File</code> <code class='argument'>from</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Starts a thread that asynchronously copies data from <code>from</code> to this file.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>Stdio.sendfile()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>query_address</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>query_address</span>(</b><b>)</b></code><br> <code><code class='datatype'>string</code> <b><span class='method'>query_address</span>(</b><code class='datatype'>bool</code> <code class='argument'>local</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Get address and port of a socket end-point.</p>
5ffeba2003-04-23Henrik Grubbström (Grubba) </dd> <dt class='head--doc'><span id='p-local'></span>Parameter <code class='parameter'>local</code></dt> <dd></dd><dd class='body--doc'><p>If the argument <code>local</code> is not specified, or is <code class='expr'>0</code> (zero), the remote end-point will be returned. Otherwise, if <code>local</code> is <code class='expr'>1</code>, the local end-point will be returned.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>This function returns the address and port of a socket end-point on the form <code class='expr'>"x.x.x.x&nbsp;port"</code> (IPv4) or <code class='expr'>"x:x:x:x:x:x:x:x&nbsp;port"</code> (IPv6).</p> <p> If this file is not a socket, is not connected, or some other error occurrs, <code class='expr'>0</code> (zero) will be returned.</p>
5bfef52003-04-01Martin Nilsson </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>connect()</code></p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>query_close_callback</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>function</code>(<code class='datatype'>mixed</code>:<code class='datatype'>void</code>) <b><span class='method'>query_close_callback</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This function returns the <tt>close_callback</tt>, which has been set with <code>set_nonblocking()</code> or <code>set_close_callback()</code>.</p>
1f918f2002-05-26Martin Nilsson </dd>
c3fe742003-02-05Martin Nilsson <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>set_nonblocking()</code>, <code>set_close_callback()</code></p> </dd></dl>
e4e3f32002-04-06Martin Nilsson 
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>query_fd</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>query_fd</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns the file descriptor number associated with this object.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>query_id</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>query_id</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This function returns the <tt>id</tt> that has been set with <code>set_id()</code>.</p>
50af352002-07-15Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p><code>set_id()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
c3fe742003-02-05Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>query_read_callback</b></span> </dt> <dd><p><code><code class='datatype'>function</code>(<code class='datatype'>mixed</code>, <code class='datatype'>string</code>:<code class='datatype'>void</code>) <b><span class='method'>query_read_callback</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This function returns the <tt>read_callback</tt>, which has been set with <code>set_nonblocking()</code> or <code>set_read_callback()</code>.</p>
50af352002-07-15Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p><code>set_nonblocking()</code>, <code>set_read_callback</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
c3fe742003-02-05Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>query_read_oob_callback</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>function</code>(<code class='datatype'>mixed</code>, <code class='datatype'>string</code>:<code class='datatype'>void</code>) <b><span class='method'>query_read_oob_callback</span>(</b><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>query_write_callback</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>function</code>(<code class='datatype'>mixed</code>:<code class='datatype'>void</code>) <b><span class='method'>query_write_callback</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This function returns the <tt>write_callback</tt>, which has been set with <code>set_nonblocking()</code> or <code>set_write_callback()</code>.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>set_nonblocking()</code>, <code>set_write_callback</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>query_write_oob_callback</b></span> </dt> <dd><p><code><code class='datatype'>function</code>(<code class='datatype'>mixed</code>:<code class='datatype'>void</code>) <b><span class='method'>query_write_oob_callback</span>(</b><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>read</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>read</span>(</b><b>)</b></code><br> <code><code class='datatype'>string</code> <b><span class='method'>read</span>(</b><code class='datatype'>int</code> <code class='argument'>len</code><b>)</b></code><br> <code><code class='datatype'>string</code> <b><span class='method'>read</span>(</b><code class='datatype'>int</code> <code class='argument'>len</code>, <code class='datatype'>bool</code> <code class='argument'>not_all</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt>
45f8092003-10-15Martin Stjernholm <dd class='body--doc'><p>Read data from a file or a stream.</p>
5bfef52003-04-01Martin Nilsson <p> Attempts to read <code>len</code> bytes from the file, and return it as a
45f8092003-10-15Martin Stjernholm  string. Less than <code>len</code> bytes can be returned if</p> <ul> <li><p>end-of-file is encountered for a normal file, or</p> </li><li><p>it's a socket or pipe that has been closed from the other end, or</p>
a5bdb12003-10-15Martin Stjernholm </li><li><p>nonblocking mode is used, or</p> </li><li><p><code>not_all</code> isn't set and an error occurred (see below).</p>
45f8092003-10-15Martin Stjernholm </li></ul><p>If <code>not_all</code> is nonzero, <code>read()</code> will not try its best to read
a525602003-10-15Martin Stjernholm  as many bytes as you have asked for, but will merely return as much as the system read function will return. This mainly useful with stream devices which can return exactly one row or packet at a time.</p> <p> If something goes wrong and <code>not_all</code> is set, zero will be
a5bdb12003-10-15Martin Stjernholm  returned. If something goes wrong and <code>not_all</code> is zero or left out, then either zero or a string shorter than <code>len</code> is returned. If the problem persists then a later call to <code>read()</code> will fail and return zero, however.</p>
a525602003-10-15Martin Stjernholm <p> If everything went fine, a call to <code>errno()</code> directly afterwards will return zero. That includes an end due to end-of-file or remote close.</p>
5bfef52003-04-01Martin Nilsson <p> If no arguments are given, <code>read()</code> will read to the
45f8092003-10-15Martin Stjernholm  end of the file or stream.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>It's not necessary to set <code>not_all</code> to avoid blocking reading when nonblocking mode is used.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>When at the end of a file or stream, repeated calls to <code>read()</code> will return the empty string since it's not considered an error. The empty string is never returned in other cases, unless nonblocking mode is used or <code>len</code> is zero.</p>
5bfef52003-04-01Martin Nilsson </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>read_oob()</code>, <code>write()</code></p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>read_function</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>function</code>(:<code class='datatype'>string</code>) <b><span class='method'>read_function</span>(</b><code class='datatype'>int</code> <code class='argument'>nbytes</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Returns a function that when called will call <code>read</code> with nbytes as argument. Can be used to get various callback
0f4adf2003-07-22Henrik Grubbström (Grubba)  functions, eg for the fourth argument to <code>String.SplitIterator</code>.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>read_oob</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>read_oob</span>(</b><b>)</b></code><br> <code><code class='datatype'>string</code> <b><span class='method'>read_oob</span>(</b><code class='datatype'>int</code> <code class='argument'>len</code><b>)</b></code><br> <code><code class='datatype'>string</code> <b><span class='method'>read_oob</span>(</b><code class='datatype'>int</code> <code class='argument'>len</code>, <code class='datatype'>bool</code> <code class='argument'>not_all</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt>
a5bdb12003-10-15Martin Stjernholm <dd class='body--doc'><p>Attempts to read <code>len</code> bytes of out-of-band data from the stream, and returns it as a string. Less than <code>len</code> bytes can be returned if</p> <ul> <li><p>the stream has been closed from the other end, or</p> </li><li><p>nonblocking mode is used, or</p> </li><li><p><code>not_all</code> isn't set and an error occurred (see below).</p> </li></ul><p>If <code>not_all</code> is nonzero, <code>read_oob()</code> will only return as many bytes of out-of-band data as are currently available.</p> <p> If something goes wrong and <code>not_all</code> is set, zero will be returned. If something goes wrong and <code>not_all</code> is zero or left out, then either zero or a string shorter than <code>len</code> is returned. If the problem persists then a later call to <code>read()</code> will fail and return zero, however.</p> <p> If everything went fine, a call to <code>errno()</code> directly afterwards will return zero. That includes an end due to remote close.</p>
5bfef52003-04-01Martin Nilsson <p> If no arguments are given, <code>read_oob()</code> will read to the end of the stream.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>This function is only available if the option <tt>'--without-oob'</tt> was not specified when the Pike runtime was compiled.</p>
a5bdb12003-10-15Martin Stjernholm </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>It is not guaranteed that all out-of-band data sent from the other end
5bfef52003-04-01Martin Nilsson  will be received. Most streams only allow for a single byte of out-of-band data at a time.</p> </dd>
a5bdb12003-10-15Martin Stjernholm <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>It's not necessary to set <code>not_all</code> to avoid blocking reading when nonblocking mode is used.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>When at the end of a file or stream, repeated calls to <code>read()</code> will return the empty string since it's not considered an error. The empty string is never returned in other cases, unless nonblocking mode is used or <code>len</code> is zero.</p> </dd>
5bfef52003-04-01Martin Nilsson <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>read()</code>, <code>write_oob()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>seek</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>seek</span>(</b><code class='datatype'>int</code> <code class='argument'>pos</code><b>)</b></code><br> <code><code class='datatype'>int</code> <b><span class='method'>seek</span>(</b><code class='datatype'>int</code> <code class='argument'>unit</code>, <code class='datatype'>int</code> <code class='argument'>mult</code><b>)</b></code><br> <code><code class='datatype'>int</code> <b><span class='method'>seek</span>(</b><code class='datatype'>int</code> <code class='argument'>unit</code>, <code class='datatype'>int</code> <code class='argument'>mult</code>, <code class='datatype'>int</code> <code class='argument'>add</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Seek to a specified offset in a file.</p>
4121b12003-04-01Martin Stjernholm <p> If <code>mult</code> or <code>add</code> are specified, <code>pos</code> will be calculated as
5bfef52003-04-01Martin Nilsson  <code class='expr'><code>pos</code>&nbsp;=&nbsp;<code>unit</code>*<code>mult</code>&nbsp;+&nbsp;<code>add</code></code>.</p> <p> If <code>pos</code> is negative it will be relative to the start of the file, otherwise it will be an absolute offset from the start of the file.</p> </dd> <dt class='head--doc'>Returns</dt>
84ea4e2003-04-07Martin Nilsson <dd class='body--doc'><p>Returns the new offset, or <code class='expr'>-1</code> on failure.</p>
5bfef52003-04-01Martin Nilsson </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>The arguments <code>mult</code> and <code>add</code> are considered obsolete, and should not be used.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>tell()</code></p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_blocking</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_blocking</span>(</b><b>)</b></code></p></dd>
1f918f2002-05-26Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This function sets a stream to blocking mode. i.e. all reads and writes will wait until data has been transferred before returning.</p>
1f918f2002-05-26Martin Nilsson </dd>
0f4adf2003-07-22Henrik Grubbström (Grubba) <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Calling this function will also clear all non-blocking callbacks.</p> </dd>
c3fe742003-02-05Martin Nilsson <dt class='head--doc'>See also</dt>
0f4adf2003-07-22Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>set_nonblocking()</code>, <code>set_nonblocking_keep_callbacks()</code>, <code>set_blocking_keep_callbacks()</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>set_blocking</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_blocking</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Sets this file to blocking operation.</p> <p> This is the inverse operation of <code>set_nonblocking()</code>.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>set_nonblocking()</code></p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_nonblocking_keep_callbacks</b></span><br> <span class='homogen--type'>Method</span> <span class='homogen--name'><b>set_blocking_keep_callbacks</b></span><br>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_nonblocking_keep_callbacks</span>(</b><b>)</b></code><br> <code><code class='datatype'>void</code> <b><span class='method'>set_blocking_keep_callbacks</span>(</b><b>)</b></code></p></dd>
1f918f2002-05-26Martin Nilsson  <dt class='head--doc'>Description</dt>
0f4adf2003-07-22Henrik Grubbström (Grubba) <dd class='body--doc'><p>Toggle between blocking and nonblocking, without changing the callbacks.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>set_nonblocking()</code>, <code>set_blocking()</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>set_buffer</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_buffer</span>(</b><code class='datatype'>int</code> <code class='argument'>bufsize</code>, <code class='datatype'>string</code> <code class='argument'>mode</code><b>)</b></code><br> <code><code class='datatype'>void</code> <b><span class='method'>set_buffer</span>(</b><code class='datatype'>int</code> <code class='argument'>bufsize</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Set internal socket buffer.</p> <p> This function sets the internal buffer size of a socket or stream.</p> <p> The second argument allows you to set the read or write buffer by
84ea4e2003-04-07Martin Nilsson  specifying <code class='expr'>"r"</code> or <code class='expr'>"w"</code>.</p>
5bfef52003-04-01Martin Nilsson </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>It is not guaranteed that this function actually does anything, but it certainly helps to increase data transfer speed when it does.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>open_socket()</code>, <code>accept()</code></p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_close_callback</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_close_callback</span>(</b><code class='datatype'>function</code>(<code class='datatype'>mixed</code>:<code class='datatype'>void</code>) <code class='argument'>close_cb</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>This function sets the <tt>close_callback</tt> for the file. The <tt>close callback</tt> is called when the remote end of a socket or pipe is closed.</p> <p> The callback is called with the <tt>id</tt> of the file as argument.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>This function does not set the file nonblocking.</p> </dd>
0f4adf2003-07-22Henrik Grubbström (Grubba) <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>The <tt>close_callback</tt> can also be set by calling <code>set_nonblocking()</code>.</p> </dd>
c3fe742003-02-05Martin Nilsson <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>set_nonblocking()</code>, <code>close</code> <code>query_close_callback()</code>, <code>set_read_callback()</code>, <code>set_write_callback()</code>, <code>set_id()</code></p> </dd></dl>
e4e3f32002-04-06Martin Nilsson 
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>set_close_on_exec</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_close_on_exec</span>(</b><code class='datatype'>bool</code> <code class='argument'>yes_no</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Marks the file as to be closed in spawned processes.</p> <p> This function determines whether this file will be closed when calling exec().</p> <p> Default is that the file WILL be closed on exec except for stdin, stdout and stderr.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>Process.create_process()</code>, <code>exec()</code></p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_id</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_id</span>(</b><code class='datatype'>mixed</code> <code class='argument'>id</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This function sets the <tt>id</tt> of this file. The <tt>id</tt> is mainly used as an identifier that is sent as the first argument to all
84ea4e2003-04-07Martin Nilsson  callbacks. The default <tt>id</tt> is <code class='expr'>0</code> (zero). Another possible
c3fe742003-02-05Martin Nilsson  use of the <tt>id</tt> is to hold all data related to this file in a mapping or array.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>query_id()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>set_keepalive</b></span> </dt> <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>set_keepalive</span>(</b><code class='datatype'>bool</code> <code class='argument'>on_off</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>set_nonblocking</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_nonblocking</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Sets this file to nonblocking operation.</p> </dd>
5542072003-10-06Henrik Grubbström (Grubba) <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Nonblocking operation is not supported on all Stdio.File objects. Notably it is not guaranteed to be supported on objects returned by <code>pipe()</code> unless <code>PROP_NONBLOCK</code> was specified in the call to <code>pipe()</code>.</p> </dd>
5bfef52003-04-01Martin Nilsson <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>set_blocking()</code></p> </dd></dl>
45eff82002-06-11Johan Sundström <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_nonblocking</b></span>
45eff82002-06-11Johan Sundström </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_nonblocking</span>(</b><code class='datatype'>function</code>(<code class='datatype'>mixed</code>, <code class='datatype'>string</code>:<code class='datatype'>void</code>) <code class='argument'>read_callback</code>, <code class='datatype'>function</code>(<code class='datatype'>mixed</code>:<code class='datatype'>void</code>) <code class='argument'>write_callback</code>, <code class='datatype'>function</code>(<code class='datatype'>mixed</code>:<code class='datatype'>void</code>) <code class='argument'>close_callback</code><b>)</b></code><br> <code><code class='datatype'>void</code> <b><span class='method'>set_nonblocking</span>(</b><code class='datatype'>function</code>(<code class='datatype'>mixed</code>, <code class='datatype'>string</code>:<code class='datatype'>void</code>) <code class='argument'>read_callback</code>, <code class='datatype'>function</code>(<code class='datatype'>mixed</code>:<code class='datatype'>void</code>) <code class='argument'>write_callback</code>, <code class='datatype'>function</code>(<code class='datatype'>mixed</code>:<code class='datatype'>void</code>) <code class='argument'>close_callback</code>, <code class='datatype'>function</code>(<code class='datatype'>mixed</code>, <code class='datatype'>string</code>:<code class='datatype'>void</code>) <code class='argument'>read_oob_callback</code>, <code class='datatype'>function</code>(<code class='datatype'>mixed</code>:<code class='datatype'>void</code>) <code class='argument'>write_oob_callback</code><b>)</b></code><br> <code><code class='datatype'>void</code> <b><span class='method'>set_nonblocking</span>(</b><b>)</b></code></p></dd>
45eff82002-06-11Johan Sundström 
50af352002-07-15Martin Nilsson <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This function sets a stream to nonblocking mode. When data arrives on the stream, <code>read_callback</code> will be called with some or all of this data. When the stream has buffer space over for writing, <code>write_callback</code> will be called so that you can write more data to it. If the stream is closed at the other end, <code>close_callback</code> will be called. </p> <p> When out-of-band data arrives on the stream, <code>read_oob_callback</code> will be called with some or all of this data. When the stream allows out-of-band data to be sent, <code>write_oob_callback</code> will be called so that you can write out-of-band data to it.</p>
0f4adf2003-07-22Henrik Grubbström (Grubba) <p> All callbacks will have the <tt>id</tt> of the file as first argument when called (see <code>set_id()</code>).</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>Note</dt>
0f4adf2003-07-22Henrik Grubbström (Grubba) <dd class='body--doc'><p>If no arguments are given, the callbacks will be cleared.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Out-of-band data will not be supported if Pike was compiled with the option <tt>'--without-oob'</tt>.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>set_blocking()</code>, <code>set_id()</code>, <code>set_read_callback()</code>,
0f4adf2003-07-22Henrik Grubbström (Grubba)  <code>set_write_callback()</code>, <code>set_close_callback()</code> <code>set_nonblocking_keep_callbacks()</code>, <code>set_blocking_keep_callbacks()</code></p>
45eff82002-06-11Johan Sundström </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_read_callback</b></span>
45eff82002-06-11Johan Sundström </dt>
0f4adf2003-07-22Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_read_callback</span>(</b><code class='datatype'>function</code>(<code class='datatype'>mixed</code>, <code class='datatype'>string</code>:<code class='datatype'>void</code>) <code class='argument'>read_callback</code><b>)</b></code></p></dd>
45eff82002-06-11Johan Sundström 
50af352002-07-15Martin Nilsson <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This function sets the <tt>read_callback</tt> for the file. The <tt>read_callback</tt> is called whenever there is data to read from the file.</p>
0f4adf2003-07-22Henrik Grubbström (Grubba) <p> The callback is called with the <tt>id</tt> of the file as first argument and some or all of its data as second.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>This function does not set the file nonblocking.</p> </dd>
0f4adf2003-07-22Henrik Grubbström (Grubba) <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>The <tt>read_callback</tt> can also be set by calling <code>set_nonblocking()</code>.</p> </dd>
c3fe742003-02-05Martin Nilsson <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>set_nonblocking()</code>, <code>read()</code>, <code>query_read_callback()</code>, <code>set_write_callback()</code>, <code>set_close_callback()</code>, <code>set_read_oob_callback</code> <code>set_write_oob_callback()</code>, <code>set_id()</code></p>
45eff82002-06-11Johan Sundström </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_read_oob_callback</b></span>
45eff82002-06-11Johan Sundström </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_read_oob_callback</span>(</b><code class='datatype'>function</code>(<code class='datatype'>mixed</code>, <code class='datatype'>string</code>:<code class='datatype'>void</code>) <code class='argument'>read_oob_cb</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function.</p> </dd></dl>
45eff82002-06-11Johan Sundström  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_write_callback</b></span>
45eff82002-06-11Johan Sundström </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_write_callback</span>(</b><code class='datatype'>function</code>(<code class='datatype'>mixed</code>:<code class='datatype'>void</code>) <code class='argument'>write_cb</code><b>)</b></code></p></dd>
45eff82002-06-11Johan Sundström 
50af352002-07-15Martin Nilsson <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This function sets the <tt>write_callback</tt> for the file. The <tt>write_callback</tt> is called whenever there is buffer space available to write to for the file.</p> <p> The callback is called with the <tt>id</tt> of the file as argument.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>This function does not set the file nonblocking.</p> </dd>
0f4adf2003-07-22Henrik Grubbström (Grubba) <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>The <tt>write_callback</tt> can also be set by calling <code>set_nonblocking()</code>.</p> </dd>
c3fe742003-02-05Martin Nilsson <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>set_nonblocking()</code>, <code>write()</code>, <code>query_write_callback()</code>, <code>set_read_callback()</code>, <code>set_close_callback()</code>, <code>set_read_oob_callback</code> <code>set_write_oob_callback()</code>, <code>set_id()</code></p>
45eff82002-06-11Johan Sundström </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_write_oob_callback</b></span>
45eff82002-06-11Johan Sundström </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_write_oob_callback</span>(</b><code class='datatype'>function</code>(<code class='datatype'>mixed</code>:<code class='datatype'>void</code>) <code class='argument'>write_oob_cb</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function.</p> </dd></dl>
45eff82002-06-11Johan Sundström 
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>stat</b></span> </dt> <dd><p><code><code class='object unresolved'>Stat</code> <b><span class='method'>stat</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Get status for an open file.</p> <p> This function returns the same information as the function <code>file_stat()</code>,
84ea4e2003-04-07Martin Nilsson  but for the file it is called in. If file is not an open file, <code class='expr'>0</code>
5bfef52003-04-01Martin Nilsson  (zero) will be returned. Zero is also returned if file is a pipe or socket.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>See <code>file_stat()</code> for a description of the return value.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Prior to Pike 7.1 this function returned an array(int).</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>file_stat()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>sync</b></span> </dt> <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>sync</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Flush buffers to disk.</p> </dd> <dt class='head--doc'>Returns</dt>
84ea4e2003-04-07Martin Nilsson <dd class='body--doc'><p>Returns <code class='expr'>0</code> (zero) and sets errno on failure.</p> <p> Returns <code class='expr'>1</code> on success.</p>
5bfef52003-04-01Martin Nilsson </dd></dl>
c3fe742003-02-05Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>tcgetattr</b></span><br> <span class='homogen--type'>Method</span> <span class='homogen--name'><b>tcsetattr</b></span><br> </dt> <dd><p><code><code class='datatype'>mapping</code> <b><span class='method'>tcgetattr</span>(</b><b>)</b></code><br> <code><code class='datatype'>int</code> <b><span class='method'>tcsetattr</span>(</b><code class='datatype'>mapping</code> <code class='argument'>attr</code><b>)</b></code><br> <code><code class='datatype'>int</code> <b><span class='method'>tcsetattr</span>(</b><code class='datatype'>mapping</code> <code class='argument'>attr</code>, <code class='datatype'>string</code> <code class='argument'>when</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Gets/sets term attributes. The returned value/the <code>attr</code> parameter is a mapping on the form</p> <table class='box'><tr><td><code><code class='key'>"ispeed"</code> : <code class='datatype'>int(-1..)</code></code></td><td><p>In baud rate.</p> </td></tr> <tr><td><code><code class='key'>"ospeed"</code> : <code class='datatype'>int(-1..)</code></code></td><td><p>Out baud rate.</p> </td></tr> <tr><td><code><code class='key'>"csize"</code> : <code class='datatype'>int(-1..-1)</code>|<code class='datatype'>int(5..8)</code></code></td><td><p>Character size.</p> </td></tr> <tr><td><code><code class='key'>"rows"</code> : <code class='datatype'>int</code></code></td><td><p>Terminal rows.</p> </td></tr> <tr><td><code><code class='key'>"columns"</code> : <code class='datatype'>int</code></code></td><td><p>Terminal columns.</p> </td></tr> <tr><td><code><code class='key'>flag_name</code> : <code class='datatype'>bool</code></code></td><td><p>The value of a named flag. The flag name is the string describing the termios flags (IGNBRK, BRKINT, IGNPAR, PARMRK, INPCK, ISTRIP, INLCR, IGNCR, ICRNL, IUCLC, IXON, IXANY, IXOFF, IMAXBEL, OPOST, OLCUC, ONLCR, OCRNL, ONOCR, ONLRET, OFILL, OFDEL, OXTABS, ONOEOT, CSTOPB, CREAD, PARENB, PARODD, HUPCL, CLOCAL, CRTSCTS, ISIG, ICANON, XCASE, ECHO, ECHOE, ECHOK, ECHONL, ECHOCTL, ECHOPRT, ECHOKE, FLUSHO, NOFLSH, TOSTOP, PENDIN). See the manpage for termios or other documentation for more information. All flags are not available on all platforms.</p> </td></tr> <tr><td><code><code class='key'>character_name</code> : <code class='datatype'>int(8bit)</code></code></td><td><p>Sets the value of a control character (VINTR, VQUIT, VERASE, VKILL, VEOF, VTIME, VMIN, VSWTC, VSTART, VSTOP, VSUSP, VEOL, VREPRINT, VDISCARD, VWERASE, VLNEXT, VEOL2). All control characters are not available on all platforms.</p> </td></tr> </table><p>Negative values are not allowed as indata, but might appear in the result from <code>tcgetattr</code> when the actual value is unknown. <code>tcsetattr</code> returns 0 if failed.</p> <p> The argument <code>when</code> to <code>tcsetattr</code> describes when the changes are to take effect:</p> <table class='box'><tr><td><code><code class='key'>"TCSANOW"</code></code></td><td><p>The change occurs immediately (default).</p> </td></tr> <tr><td><code><code class='key'>"TCSADRAIN"</code></code></td><td><p>The change occurs after all output has been written.</p> </td></tr> <tr><td><code><code class='key'>"TCSAFLUSH"</code></code></td><td><p>The change occurs after all output has been written, and empties input buffers.</p> </td></tr> </table> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>// setting the terminal in raw mode: Stdio.stdin-&gt;tcsetattr((["ECHO":0,"ICANON":0,"VMIN":0,"VTIME":0]));</p> </pre></dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Unknown flags are ignored by <code>tcsetattr()</code>. <code>tcsetattr</code> always changes the attribute, so only include attributes that actually should be altered in the attribute mapping.</p> </dd> <dt class='head--doc'>Bugs</dt> <dd class='body--doc'><p>Terminal rows and columns setting by <code>tcsetattr()</code> is not currently supported.</p> </dd></dl>
5bfef52003-04-01Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>tell</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>tell</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns the current offset in the file.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>seek()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>truncate</b></span> </dt> <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>truncate</span>(</b><code class='datatype'>int</code> <code class='argument'>length</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Truncate a file.</p> <p> Truncates the file to the specified length <code>length</code>.</p> </dd> <dt class='head--doc'>Returns</dt>
84ea4e2003-04-07Martin Nilsson <dd class='body--doc'><p>Returns <code class='expr'>1</code> on success, and <code class='expr'>0</code> (zero) on failure.</p>
5bfef52003-04-01Martin Nilsson </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>open()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>trylock</b></span> </dt> <dd><p><code><code class='object unresolved'>Stdio.FileLockKey</code> <b><span class='method'>trylock</span>(</b><b>)</b></code><br> <code><code class='object unresolved'>Stdio.FileLockKey</code> <b><span class='method'>trylock</span>(</b><code class='datatype'>bool</code> <code class='argument'>is_recursive</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Attempts to place a file lock on this file.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>lock()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>write</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>write</span>(</b><code class='datatype'>string</code> <code class='argument'>data</code><b>)</b></code><br> <code><code class='datatype'>int</code> <b><span class='method'>write</span>(</b><code class='datatype'>string</code> <code class='argument'>format</code>, <code class='datatype'>mixed</code> ... <code class='argument'>extras</code><b>)</b></code><br> <code><code class='datatype'>int</code> <b><span class='method'>write</span>(</b><code class='datatype'>array</code>(<code class='datatype'>string</code>) <code class='argument'>data</code><b>)</b></code><br> <code><code class='datatype'>int</code> <b><span class='method'>write</span>(</b><code class='datatype'>array</code>(<code class='datatype'>string</code>) <code class='argument'>format</code>, <code class='datatype'>mixed</code> ... <code class='argument'>extras</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Write data to a file or a stream.</p> <p> Writes <code>data</code> and returns the number of bytes that were actually written.</p> <p> If more than one argument is given, <code>sprintf()</code> will be used to format them.</p> <p> If <code>data</code> is an array, it will be concatenated, and then written.</p> <p> 0 is returned in nonblocking mode if it was not possible to write anything without blocking.</p> <p> -1 is returned if something went wrong and no bytes were written.</p> </dd> <dt class='head--doc'>Note</dt>
45f8092003-10-15Martin Stjernholm <dd class='body--doc'><p>Writing of wide strings is not supported. You have to encode the data somehow, e.g. with <code>string_to_utf8</code> or with one of the charsets supported by <code>Locale.Charset.encoder</code>.</p>
5bfef52003-04-01Martin Nilsson </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>read()</code>, <code>write_oob()</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>write_oob</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>write_oob</span>(</b><code class='datatype'>string</code> <code class='argument'>data</code><b>)</b></code><br> <code><code class='datatype'>int</code> <b><span class='method'>write_oob</span>(</b><code class='datatype'>string</code> <code class='argument'>format</code>, <code class='datatype'>mixed</code> ... <code class='argument'>extras</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Write out-of-band data to a stream.</p> <p> Writes out-of-band data to a stream and returns how many bytes that were actually written.</p> <p> If more than one argument is given, <code>sprintf()</code> will be used to format them.</p> <p> -1 is returned if something went wrong and no bytes were written.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>This function is only available if the option <tt>'--without-oob'</tt> was not specified when the Pike runtime was compiled.</p>
a5bdb12003-10-15Martin Stjernholm </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>It is not guaranteed that all out-of-band data sent from the other end
5bfef52003-04-01Martin Nilsson  will be received. Most streams only allow for a single byte of out-of-band data at a time. Some streams will send the rest of the data as ordinary data.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>read_oob()</code>, <code>write()</code></p> </dd></dl>
c3fe742003-02-05Martin Nilsson </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Stdio.FILE</b></h2> </dt><dd><dl class='group--doc'>
45eff82002-06-11Johan Sundström <dt class='head--doc'>Description</dt>
0f4adf2003-07-22Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>Stdio.FILE</code> is a buffered version of <code>Stdio.File</code>, it inherits <code>Stdio.File</code> and has most of the functionality of <code>Stdio.File</code>. However, it has an input buffer that allows line-by-line input.</p> <p> It also has support for automatic charset conversion for both input and output (see <code>Stdio.FILE()-&gt;set_charset()</code>).</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>The output part of <code>Stdio.FILE</code> is currently not buffered.</p>
45eff82002-06-11Johan Sundström </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>_get_iterator</b></span>
45eff82002-06-11Johan Sundström </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><span class='class'>Stdio.FILE</span> <span class='method'>a</span>;<br> foreach( a; index; value ) or<br></code><code><code class='modifier'>protected</code> <code class='datatype'>object</code> <b><span class='method'>_get_iterator</span>(</b><b>)</b></code></p></dd>
45eff82002-06-11Johan Sundström  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Returns an iterator that will loop over the lines in this file.</p>
50af352002-07-15Martin Nilsson </dd>
c3fe742003-02-05Martin Nilsson <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>line_iterator()</code></p>
45eff82002-06-11Johan Sundström </dd></dl>
84d5df2002-09-16Johan Schön <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>getchar</b></span>
84d5df2002-09-16Johan Schön </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>getchar</span>(</b><b>)</b></code></p></dd>
84d5df2002-09-16Johan Schön  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This function returns one character from the input stream.</p>
84d5df2002-09-16Johan Schön </dd>
c3fe742003-02-05Martin Nilsson <dt class='head--doc'>Returns</dt>
0f4adf2003-07-22Henrik Grubbström (Grubba) <dd class='body--doc'><p>Returns the ISO-10646 (Unicode) value of the character.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>Note</dt>
84ea4e2003-04-07Martin Nilsson <dd class='body--doc'><p>Returns an <code class='expr'>int</code> and not a <code class='expr'>string</code> of length 1.</p>
84d5df2002-09-16Johan Schön </dd></dl>
45eff82002-06-11Johan Sundström <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>gets</b></span>
45eff82002-06-11Johan Sundström </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>gets</span>(</b><b>)</b></code></p></dd>
45eff82002-06-11Johan Sundström  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Read one line of input with support for input conversion.</p> </dd> <dt class='head--doc'>Returns</dt>
84ea4e2003-04-07Martin Nilsson <dd class='body--doc'><p>This function returns the line read if successful, and <code class='expr'>0</code> if
c3fe742003-02-05Martin Nilsson  no more lines are available.</p>
45eff82002-06-11Johan Sundström </dd>
50af352002-07-15Martin Nilsson <dt class='head--doc'>See also</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p><code>ngets()</code>, <code>read()</code>, <code>line_iterator()</code>, <code>set_charset()</code></p>
45eff82002-06-11Johan Sundström </dd></dl> <hr /> <dl class='group--doc'>
c3fe742003-02-05Martin Nilsson <dt class='head--type'><span class='homogen--type'>Inherit</span> <span class='homogen--name'><b>file</b></span>
45eff82002-06-11Johan Sundström </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><span class='datatype'>inherit File</span> : <span class='inherit'>file</span></code></p></dd> </dl>
e4e3f32002-04-06Martin Nilsson 
50af352002-07-15Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>line_iterator</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>object</code> <b><span class='method'>line_iterator</span>(</b><code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>trim</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Returns an iterator that will loop over the lines in this file.
0f4adf2003-07-22Henrik Grubbström (Grubba)  If <code>trim</code> is true, all <tt>'\r'</tt> characters will be removed from the input.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>_get_iterator()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
ab1f522003-07-10Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>ngets</b></span> </dt> <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>string</code>) <b><span class='method'>ngets</span>(</b><code class='datatype'>void</code>|<code class='datatype'>int(1..)</code> <code class='argument'>n</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Get <code>n</code> lines.</p> </dd> <dt class='head--doc'><span id='p-n'></span>Parameter <code class='parameter'>n</code></dt> <dd></dd><dd class='body--doc'><p>Number of lines to get, or all remaining if zero.</p> </dd></dl>
0f4adf2003-07-22Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>pipe</b></span> </dt> <dd><p><code><code class='object unresolved'>File</code> <b><span class='method'>pipe</span>(</b><code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>flags</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Same as <code>Stdio.File()-&gt;pipe()</code>.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Returns an <code>Stdio.File</code> object, NOT a <code>Stdio.FILE</code> object.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>printf</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>printf</span>(</b><code class='datatype'>string</code> <code class='argument'>format</code>, <code class='datatype'>mixed</code> ... <code class='argument'>data</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This function does approximately the same as: <code class='expr'><code>write</code>(<code>sprintf</code>(<code>format</code>,@<code>data</code>))</code>.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>write()</code>, <code>sprintf()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>read</b></span>
1f918f2002-05-26Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>read</span>(</b><code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>bytes</code>, <code class='datatype'>void</code>|<code class='datatype'>bool</code> <code class='argument'>now</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>Description</dt>
0f4adf2003-07-22Henrik Grubbström (Grubba) <dd class='body--doc'><p>Read <code>bytes</code> (wide-) characters with buffering and support for input conversion.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>Stdio.File()-&gt;read()</code>, <code>set_charset()</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_charset</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_charset</span>(</b><code class='datatype'>string</code> <code class='argument'>charset</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Sets the input and output charset of this file to the specified
0f4adf2003-07-22Henrik Grubbström (Grubba)  <code>charset</code>.</p> <p> The default charset is <tt>"ISO-8859-1"</tt>.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>ungets</b></span>
1f918f2002-05-26Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>ungets</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This function puts a string back in the input buffer. The string can then be read with eg <code>read()</code>, <code>gets()</code> or <code>getchar()</code>.</p>
1f918f2002-05-26Martin Nilsson </dd>
ab1f522003-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>The string must not contain line-feeds.</p> </dd>
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>See also</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p><code>read()</code>, <code>gets()</code>, <code>getchar()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>write</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>write</span>(</b><code class='datatype'>array</code>(<code class='datatype'>string</code>)|<code class='datatype'>string</code> <code class='argument'>what</code>, <code class='datatype'>mixed</code> ... <code class='argument'>fmt</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Write <code>what</code> with support for output_conversion.</p>
e4e3f32002-04-06Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>See also</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p><code>Stdio.File()-&gt;write()</code></p> </dd></dl> </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Stdio.Port</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Handles listening to socket ports. Whenever you need a bound socket that is open and listens for connections you should use this program.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>accept</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='object unresolved'>File</code> <b><span class='method'>accept</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This function completes a connection made from a remote machine to this port. It returns a two-way stream in the form of a clone of
0f4adf2003-07-22Henrik Grubbström (Grubba)  <code>Stdio.File</code>. The new file is by initially set to blocking mode.</p>
50af352002-07-15Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p><code>Stdio.File</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
9699552002-03-12Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>bind</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
b27ad92003-04-22Marcus Comstedt <dd><p><code><code class='datatype'>int</code> <b><span class='method'>bind</span>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code> <code class='argument'>port</code>, <code class='datatype'>void</code>|<code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>accept_callback</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>ip</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
7522f42003-06-02Martin Stjernholm <dd class='body--doc'><p>Bind opens a socket and binds it to port number on the local machine.
c3fe742003-02-05Martin Nilsson  If the second argument is present, the socket is set to nonblocking and the callback funcition is called whenever something connects to
7522f42003-06-02Martin Stjernholm  it. The callback will receive the id for this port as argument.
c3fe742003-02-05Martin Nilsson  Bind returns 1 on success, and zero on failiure.</p> <p> If the optional argument 'ip' is given, bind will try to bind to this ip name or number.</p>
50af352002-07-15Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p><code>accept</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>create</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><span class='object'>Stdio.Port</span> <span class='class'>Stdio.Port</span><b>(</b><b>)</b></code><br>
b27ad92003-04-22Marcus Comstedt <code><span class='object'>Stdio.Port</span> <span class='class'>Stdio.Port</span><b>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code> <code class='argument'>port</code><b>)</b></code><br> <code><span class='object'>Stdio.Port</span> <span class='class'>Stdio.Port</span><b>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code> <code class='argument'>port</code>, <code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>accept_callback</code><b>)</b></code><br> <code><span class='object'>Stdio.Port</span> <span class='class'>Stdio.Port</span><b>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code> <code class='argument'>port</code>, <code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>accept_callback</code>, <code class='datatype'>string</code> <code class='argument'>ip</code><b>)</b></code><br>
c3fe742003-02-05Martin Nilsson <code><span class='object'>Stdio.Port</span> <span class='class'>Stdio.Port</span><b>(</b><code class='argument'>"stdin"</code><b>)</b></code><br> <code><span class='object'>Stdio.Port</span> <span class='class'>Stdio.Port</span><b>(</b><code class='argument'>"stdin"</code>, <code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>accept_callback</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
84ea4e2003-04-07Martin Nilsson <dd class='body--doc'><p>If the first argument is other than <code class='expr'>"stdin"</code> the arguments will
c3fe742003-02-05Martin Nilsson  be passed to <code>bind()</code>.</p>
84ea4e2003-04-07Martin Nilsson <p> When create is called with <code class='expr'>"stdin"</code> as the first argument, a socket is created out of the file descriptor <code class='expr'>0</code>. This is only
0f4adf2003-07-22Henrik Grubbström (Grubba)  useful if it actually is a socket to begin with.</p>
50af352002-07-15Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p><code>bind</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>errno</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>errno</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>If the last call done on this port failed, errno will return an integer describing what went wrong. Refer to your unix manual for further information.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
c3fe742003-02-05Martin Nilsson <dt class='head--type'><span class='homogen--type'>Inherit</span> <span class='homogen--name'><b>_port</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><span class='datatype'>inherit _port</span> : <span class='inherit'>_port</span></code></p></dd> </dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>listen_fd</b></span>
1f918f2002-05-26Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>listen_fd</span>(</b><code class='datatype'>int</code> <code class='argument'>fd</code>, <code class='datatype'>void</code>|<code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>accept_callback</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This function does the same as port-&gt;bind, except that instead of creating a new socket and bind it to a port, it expects that the filedescriptor 'fd' is an already open port.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>This function is only for the advanced user, and is generally used when sockets are passed to Pike at exec time.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>bind</code>, <code>accept</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
c3fe742003-02-05Martin Nilsson 
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>port_accept</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='object unresolved'>Stdio.File</code> <b><span class='method'>port_accept</span>(</b><b>)</b></code></p></dd> </dl>
e4e3f32002-04-06Martin Nilsson 
50af352002-07-15Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>query_address</b></span>
50af352002-07-15Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>query_address</span>(</b><code class='datatype'>string</code> <code class='argument'>arg1</code><b>)</b></code></p></dd>
50af352002-07-15Martin Nilsson <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>query_id</b></span>
1f918f2002-05-26Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>query_id</span>(</b><b>)</b></code></p></dd>
1f918f2002-05-26Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>This function returns the id for this port. The id is normally the first argument to accept_callback.</p>
1f918f2002-05-26Martin Nilsson </dd>
c3fe742003-02-05Martin Nilsson <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>set_id</code></p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_id</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>set_id</span>(</b><code class='datatype'>mixed</code> <code class='argument'>id</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson 
c3fe742003-02-05Martin Nilsson <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>This function sets the id used for accept_callback by this port. The default id is <code>this_object()</code>.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>query_id</code></p> </dd></dl> </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Stdio.UDP</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>UDP (User Datagram Protocol) handling.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
c3fe742003-02-05Martin Nilsson <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>MSG_OOB</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>constant</code> Stdio.UDP.<code class='constant'>MSG_OOB</code></code></p></dd>
50af352002-07-15Martin Nilsson <dt class='head--fixme'>FIXME</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--fixme'><p>Document this constant.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
50af352002-07-15Martin Nilsson  <hr /> <dl class='group--doc'>
c3fe742003-02-05Martin Nilsson <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>MSG_PEEK</b></span>
50af352002-07-15Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>constant</code> Stdio.UDP.<code class='constant'>MSG_PEEK</code></code></p></dd>
50af352002-07-15Martin Nilsson <dt class='head--fixme'>FIXME</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--fixme'><p>Document this constant.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
50af352002-07-15Martin Nilsson 
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>bind</b></span>
1f918f2002-05-26Martin Nilsson </dt>
b27ad92003-04-22Marcus Comstedt <dd><p><code><code class='datatype'>object</code> <b><span class='method'>bind</span>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code> <code class='argument'>port</code><b>)</b></code><br> <code><code class='datatype'>object</code> <b><span class='method'>bind</span>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code> <code class='argument'>port</code>, <code class='datatype'>string</code> <code class='argument'>address</code><b>)</b></code></p></dd>
c3fe742003-02-05Martin Nilsson 
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Binds a port for recieving or transmitting UDP.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
c3fe742003-02-05Martin Nilsson 
c628122002-10-19Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>connect</b></span>
c628122002-10-19Martin Nilsson </dt>
b27ad92003-04-22Marcus Comstedt <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>connect</span>(</b><code class='datatype'>string</code> <code class='argument'>address</code>, <code class='datatype'>int</code>|<code class='datatype'>string</code> <code class='argument'>port</code><b>)</b></code></p></dd>
c628122002-10-19Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Establish an UDP connection.</p> <p> This function connects an UDP socket previously created with <code>Stdio.UDP()</code> to a remote socket. The <code>address</code> is the IP name or number for the remote machine.</p> </dd> <dt class='head--doc'>Returns</dt>
84ea4e2003-04-07Martin Nilsson <dd class='body--doc'><p>Returns <code class='expr'>1</code> on success, <code class='expr'>0</code> (zero) otherwise.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>If the socket is in nonblocking mode, you have to wait for a write or close callback before you know if the connection failed or not.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>bind()</code>, <code>query_address()</code></p>
c628122002-10-19Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>enable_broadcast</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>enable_broadcast</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Set the broadcast flag. If enabled then sockets receive packets sent to a broadcast address and they are allowed to send packets to a broadcast address.</p> </dd> <dt class='head--doc'>Returns</dt>
84ea4e2003-04-07Martin Nilsson <dd class='body--doc'><p>Returns <code class='expr'>1</code> on success, <code class='expr'>0</code> (zero) otherwise.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>This is normally only avalable to root users.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
c628122002-10-19Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>errno</b></span>
c628122002-10-19Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>errno</span>(</b><b>)</b></code></p></dd>
c628122002-10-19Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Returns the error code for the last command on this object. Error code is normally cleared when a command is successful.</p>
c628122002-10-19Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>get_type</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>int</code>) <b><span class='method'>get_type</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Returns socket type and protocol family.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
50af352002-07-15Martin Nilsson 
c3fe742003-02-05Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Inherit</span> <span class='homogen--name'><b>UDP</b></span> </dt> <dd><p><code><span class='datatype'>inherit files.UDP</span> : <span class='inherit'>UDP</span></code></p></dd> </dl>
c628122002-10-19Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>query_address</b></span>
c628122002-10-19Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>query_address</span>(</b><b>)</b></code></p></dd>
c628122002-10-19Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Returns the local address of a socket on the form "x.x.x.x port". If this file is not a socket, not connected or some other error occurs, zero is returned.</p>
c628122002-10-19Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>read</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>int</code>|<code class='datatype'>string</code>) <b><span class='method'>read</span>(</b><b>)</b></code><br> <code><code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>int</code>|<code class='datatype'>string</code>) <b><span class='method'>read</span>(</b><code class='datatype'>int</code> <code class='argument'>flag</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Read from the UDP socket.</p> <p> Flag <code>flag</code> is a bitfield, 1 for out of band data and 2 for peek</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>mapping(string:int|string) in the form ([
70becb2003-03-12Marcus Agehall  "data" : string received data "ip" : string received from this ip
c3fe742003-02-05Martin Nilsson  "port" : int ...and this port ])</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>set_read_callback()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>send</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
b27ad92003-04-22Marcus Comstedt <dd><p><code><code class='datatype'>int</code> <b><span class='method'>send</span>(</b><code class='datatype'>string</code> <code class='argument'>to</code>, <code class='datatype'>int</code>|<code class='datatype'>string</code> <code class='argument'>port</code>, <code class='datatype'>string</code> <code class='argument'>message</code><b>)</b></code><br> <code><code class='datatype'>int</code> <b><span class='method'>send</span>(</b><code class='datatype'>string</code> <code class='argument'>to</code>, <code class='datatype'>int</code>|<code class='datatype'>string</code> <code class='argument'>port</code>, <code class='datatype'>string</code> <code class='argument'>message</code>, <code class='datatype'>int</code> <code class='argument'>flags</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Send data to a UDP socket. The recepient address will be <code>to</code> and port will be <code>port</code>.</p> <p> Flag <code>flag</code> is a bitfield, 1 for out of band data and 2 for don't route flag.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>The number of bytes that were actually written.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_blocking</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>object</code> <b><span class='method'>set_blocking</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Sets this object to be blocking.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
9699552002-03-12Martin Nilsson 
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_nonblocking</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='object unresolved'>UDP</code> <b><span class='method'>set_nonblocking</span>(</b><b>)</b></code><br> <code><code class='object unresolved'>UDP</code> <b><span class='method'>set_nonblocking</span>(</b><code class='datatype'>function</code>(<code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>int</code>|<code class='datatype'>string</code>), <code class='datatype'>mixed</code> ... :<code class='datatype'>void</code>) <code class='argument'>read_cb</code>, <code class='datatype'>mixed</code> ... <code class='argument'>extra_args</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Set this object to nonblocking mode.</p> <p> If <code>read_cb</code> and <code>extra_args</code> are specified, they will be passed on to <code>set_read_callback()</code>.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>The called object.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_read_callback</b></span>
1f918f2002-05-26Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='object unresolved'>UDP</code> <b><span class='method'>set_read_callback</span>(</b><code class='datatype'>function</code>(<code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>int</code>|<code class='datatype'>string</code>), <code class='datatype'>mixed</code> ... :<code class='datatype void'>void</code>) <code class='argument'>read_cb</code>, <code class='datatype'>mixed</code> ... <code class='argument'>extra_args</code><b>)</b></code></p></dd>
1f918f2002-05-26Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>The <code>read_cb</code> function will receive a mapping similar to the mapping returned by <code>read()</code>:</p> <table class='box'><tr><td><code><code class='key'>"data"</code> : <code class='datatype'>string</code></code></td><td><p>Received data.</p> </td></tr> <tr><td><code><code class='key'>"ip"</code> : <code class='datatype'>string</code></code></td><td><p>Data was sent from this IP.</p> </td></tr> <tr><td><code><code class='key'>"port"</code> : <code class='datatype'>int</code></code></td><td><p>Data was sent from this port.</p> </td></tr> </table> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>The called object.</p>
c628122002-10-19Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p><code>read()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_type</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>object</code> <b><span class='method'>set_type</span>(</b><code class='datatype'>int</code> <code class='argument'>sock_type</code><b>)</b></code><br> <code><code class='datatype'>object</code> <b><span class='method'>set_type</span>(</b><code class='datatype'>int</code> <code class='argument'>sock_type</code>, <code class='datatype'>int</code> <code class='argument'>family</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Sets socket type and protocol family.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
c628122002-10-19Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>wait</b></span>
c628122002-10-19Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>wait</span>(</b><code class='datatype'>int</code>|<code class='datatype'>float</code> <code class='argument'>timeout</code><b>)</b></code></p></dd>
c628122002-10-19Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Check for data and wait max. <code>timeout</code> seconds.</p>
c628122002-10-19Martin Nilsson </dd>
c3fe742003-02-05Martin Nilsson <dt class='head--doc'>Returns</dt>
84ea4e2003-04-07Martin Nilsson <dd class='body--doc'><p>Returns <code class='expr'>1</code> if data are ready, <code class='expr'>0</code> (zero) otherwise.</p>
c628122002-10-19Martin Nilsson </dd></dl>
c3fe742003-02-05Martin Nilsson </dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Stdio.Terminfo</b></h2> </dt><dd>
c628122002-10-19Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>getFallbackTerm</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='modifier'>protected</code> <code class='object unresolved'>Termcap</code> <b><span class='method'>getFallbackTerm</span>(</b><code class='datatype'>string</code> <code class='argument'>term</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Returns an object describing the fallback terminal for the terminal <code>term</code>. This is usually equvivalent to <code>Stdio.Terminfo.getTerm("dumb")</code>.</p>
c628122002-10-19Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Stdio.Terminfo.getTerm</p>
c628122002-10-19Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>getTerm</b></span>
c628122002-10-19Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='object unresolved'>Termcap</code> <b><span class='method'>getTerm</span>(</b><code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>term</code><b>)</b></code></p></dd>
c628122002-10-19Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Returns an object describing the terminal term. If term is not specified, it will default to <code>getenv("TERM")</code> or if that fails to "dumb".</p> <p> Lookup of terminal information will first be done in the systems terminfo database, and if that fails in the termcap database. If neither database exists, a hardcoded entry for "dumb" will be used.</p>
c628122002-10-19Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Stdio.Terminfo.getTerminfo, Stdio.Terminfo.getTermcap, Stdio.getFallbackTerm</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
c3fe742003-02-05Martin Nilsson 
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>getTermcap</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='object unresolved'>Termcap</code> <b><span class='method'>getTermcap</span>(</b><code class='datatype'>string</code> <code class='argument'>term</code><b>)</b></code></p></dd>
932a632002-10-25Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Returns the terminal description object for <code>term</code> from the systems termcap database. Returns 0 if not found.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p>Stdio.Terminfo.getTerm, Stdio.Terminfo.getTerminfo</p>
932a632002-10-25Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>getTerminfo</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='object unresolved'>Terminfo</code> <b><span class='method'>getTerminfo</span>(</b><code class='datatype'>string</code> <code class='argument'>term</code><b>)</b></code></p></dd>
932a632002-10-25Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Returns the terminal description object for <code>term</code> from the systems terminfo database. Returns 0 if not found.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p>Stdio.Terminfo.getTerm, Stdio.Terminfo.getTermcap</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
6f7a292003-06-02Martin Stjernholm  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>is_tty</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>is_tty</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns 1 if <code>Stdio.stdin</code> is connected to an interactive terminal that can handle backspacing, carriage return without linefeed, and the like.</p> </dd></dl>
c3fe742003-02-05Martin Nilsson <dl><dt><h2 class='header'>Class <b class='ms datatype'>Stdio.Terminfo.Termcap</b></h2> </dt><dd><dl class='group--doc'>
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Termcap terminal description object.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'>
c3fe742003-02-05Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>aliases</b></span>
1f918f2002-05-26Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>string</code>) Stdio.Terminfo.Termcap.<b><span class='variable'>aliases</span></b></code></p></dd> </dl>
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>create</b></span>
9699552002-03-12Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><span class='object'>Stdio.Terminfo.Termcap</span> <span class='class'>Stdio.Terminfo.Termcap</span><b>(</b><code class='datatype'>string</code> <code class='argument'>cap</code>, <code class='object unresolved'>TermcapDB</code>|<code class='datatype'>void</code> <code class='argument'>tcdb</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>maxrecurse</code><b>)</b></code></p></dd> </dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
c3fe742003-02-05Martin Nilsson <dt class='head--type'><span class='homogen--type'>Inherit</span> <span class='homogen--name'><b>TermMachine</b></span>
9699552002-03-12Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><span class='datatype'>inherit TermMachine</span> : <span class='inherit'>TermMachine</span></code></p></dd> </dl>
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>tputs</b></span>
9699552002-03-12Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>tputs</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Put termcap string</p>
50af352002-07-15Martin Nilsson </dd></dl>
c3fe742003-02-05Martin Nilsson </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Stdio.Terminfo.Terminfo</b></h2>
50af352002-07-15Martin Nilsson </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Terminfo terminal description object</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'>
c3fe742003-02-05Martin Nilsson <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>aliases</b></span>
9699552002-03-12Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>string</code>) Stdio.Terminfo.Terminfo.<b><span class='variable'>aliases</span></b></code></p></dd> </dl>
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>create</b></span>
9699552002-03-12Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><span class='object'>Stdio.Terminfo.Terminfo</span> <span class='class'>Stdio.Terminfo.Terminfo</span><b>(</b><code class='datatype'>string</code> <code class='argument'>filename</code><b>)</b></code></p></dd> </dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
c3fe742003-02-05Martin Nilsson <dt class='head--type'><span class='homogen--type'>Inherit</span> <span class='homogen--name'><b>TermMachine</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><span class='datatype'>inherit TermMachine</span> : <span class='inherit'>TermMachine</span></code></p></dd> </dl>
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>tputs</b></span>
9699552002-03-12Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>tputs</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
9699552002-03-12Martin Nilsson </dd></dl>
c3fe742003-02-05Martin Nilsson </dd></dl></dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Stdio.Readline</b></h2> </dt><dd>
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>add_to_kill_ring</b></span>
9699552002-03-12Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>add_to_kill_ring</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>create</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><span class='object'>Stdio.Readline</span> <span class='class'>Stdio.Readline</span><b>(</b><code class='datatype'>object</code>|<code class='datatype'>void</code> <code class='argument'>infd</code>, <code class='datatype'>object</code>|<code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>interm</code>, <code class='datatype'>object</code>|<code class='datatype'>void</code> <code class='argument'>outfd</code>, <code class='datatype'>object</code>|<code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>outterm</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Creates a Readline object, that takes input from <code>infd</code> and has output on <code>outfd</code>.</p>
50af352002-07-15Martin Nilsson </dd>
c3fe742003-02-05Martin Nilsson <dt class='head--doc'><span id='p-infd'></span>Parameter <code class='parameter'>infd</code></dt>
d5f90f2003-06-27Martin Nilsson <dd></dd><dd class='body--doc'><p>Defaults to <code>Stdio.stdin</code>.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'><span id='p-interm'></span>Parameter <code class='parameter'>interm</code></dt> <dd></dd><dd class='body--doc'><p>Defaults to <code>Stdio.Terminfo.getTerm()</code>.</p> </dd> <dt class='head--doc'><span id='p-outfd'></span>Parameter <code class='parameter'>outfd</code></dt> <dd></dd><dd class='body--doc'><p>Defaults to <code>infd</code>, unless <code>infd</code> is 0, in which case <code>outfd</code> defaults to <code>Stdio.stdout</code>.</p> </dd> <dt class='head--doc'><span id='p-outterm'></span>Parameter <code class='parameter'>outterm</code></dt> <dd></dd><dd class='body--doc'><p>Defaults to <code>interm</code>.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>delete</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>delete</span>(</b><code class='datatype'>int</code> <code class='argument'>p1</code>, <code class='datatype'>int</code> <code class='argument'>p2</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>delta_history</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>delta_history</span>(</b><code class='datatype'>int</code> <code class='argument'>d</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Changes the line to a line from the history <code>d</code> steps from the current entry (0 being the current line, negative values older, and positive values newer).</p>
50af352002-07-15Martin Nilsson </dd>
c3fe742003-02-05Martin Nilsson <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Only effective if you have a history object.</p>
78c3e22003-01-03Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>edit</b></span>
78c3e22003-01-03Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>edit</span>(</b><code class='datatype'>string</code> <code class='argument'>data</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>local_prompt</code>, <code class='datatype'>array</code>(<code class='datatype'>string</code>)|<code class='datatype'>void</code> <code class='argument'>attrs</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
78c3e22003-01-03Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>enable_history</b></span>
78c3e22003-01-03Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>enable_history</span>(</b><code class='datatype'>array</code>(<code class='datatype'>string</code>)|<code class='object unresolved'>History</code>|<code class='datatype'>int</code> <code class='argument'>hist</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
78c3e22003-01-03Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>eof</b></span>
78c3e22003-01-03Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>eof</span>(</b><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
78c3e22003-01-03Martin Nilsson </dd></dl>
3a44ef2003-01-03Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>get_history</b></span>
3a44ef2003-01-03Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='object unresolved'>History</code> <b><span class='method'>get_history</span>(</b><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
3a44ef2003-01-03Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>get_input_controller</b></span>
3a44ef2003-01-03Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='object unresolved'>InputController</code> <b><span class='method'>get_input_controller</span>(</b><b>)</b></code></p></dd>
3a44ef2003-01-03Martin Nilsson 
c3fe742003-02-05Martin Nilsson <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>get current input control object</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Terminal input controller object</p>
3a44ef2003-01-03Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>get_output_controller</b></span>
3a44ef2003-01-03Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='object unresolved'>OutputController</code> <b><span class='method'>get_output_controller</span>(</b><b>)</b></code></p></dd>
3a44ef2003-01-03Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>get current output control object</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Terminal output controller object</p>
3a44ef2003-01-03Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>get_prompt</b></span>
3a44ef2003-01-03Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>get_prompt</span>(</b><b>)</b></code></p></dd>
3a44ef2003-01-03Martin Nilsson  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Return the current prompt string.</p>
3a44ef2003-01-03Martin Nilsson </dd></dl>
c3fe742003-02-05Martin Nilsson 
7867992003-01-03Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>getcursorpos</b></span>
7867992003-01-03Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>getcursorpos</span>(</b><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
7867992003-01-03Martin Nilsson </dd></dl>
3a44ef2003-01-03Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>getmark</b></span>
3a44ef2003-01-03Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>getmark</span>(</b><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
3a44ef2003-01-03Martin Nilsson </dd></dl>
7867992003-01-03Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>gettext</b></span>
7867992003-01-03Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>gettext</span>(</b><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
7867992003-01-03Martin Nilsson </dd></dl>
e8d6742002-12-05H. William Welliver III <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>history</b></span>
e8d6742002-12-05H. William Welliver III </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>history</span>(</b><code class='datatype'>int</code> <code class='argument'>n</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
e8d6742002-12-05H. William Welliver III </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>insert</b></span>
e8d6742002-12-05H. William Welliver III </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>insert</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code>, <code class='datatype'>int</code> <code class='argument'>p</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
e8d6742002-12-05H. William Welliver III </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>kill</b></span>
e8d6742002-12-05H. William Welliver III </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>kill</span>(</b><code class='datatype'>int</code> <code class='argument'>p1</code>, <code class='datatype'>int</code> <code class='argument'>p2</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
e8d6742002-12-05H. William Welliver III </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>kill_ring_yank</b></span>
e8d6742002-12-05H. William Welliver III </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>kill_ring_yank</span>(</b><b>)</b></code></p></dd>
e8d6742002-12-05H. William Welliver III <dt class='head--fixme'>FIXME</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--fixme'><p>Document this function</p>
e8d6742002-12-05H. William Welliver III </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>list_completions</b></span>
e8d6742002-12-05H. William Welliver III </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>list_completions</span>(</b><code class='datatype'>array</code>(<code class='datatype'>string</code>) <code class='argument'>c</code><b>)</b></code></p></dd>
e8d6742002-12-05H. William Welliver III <dt class='head--fixme'>FIXME</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--fixme'><p>Document this function</p>
e8d6742002-12-05H. William Welliver III </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>message</b></span>
e8d6742002-12-05H. William Welliver III </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>message</span>(</b><code class='datatype'>string</code> <code class='argument'>msg</code><b>)</b></code></p></dd>
e8d6742002-12-05H. William Welliver III  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Print a message to the output device</p>
e8d6742002-12-05H. William Welliver III </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>newline</b></span>
e8d6742002-12-05H. William Welliver III </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>newline</span>(</b><b>)</b></code></p></dd>
e8d6742002-12-05H. William Welliver III <dt class='head--fixme'>FIXME</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--fixme'><p>Document this function</p>
e8d6742002-12-05H. William Welliver III </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>pointmark</b></span>
e8d6742002-12-05H. William Welliver III </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>int</code>) <b><span class='method'>pointmark</span>(</b><b>)</b></code></p></dd>
e8d6742002-12-05H. William Welliver III <dt class='head--fixme'>FIXME</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--fixme'><p>Document this function</p>
e8d6742002-12-05H. William Welliver III </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>read</b></span>
e8d6742002-12-05H. William Welliver III </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>read</span>(</b><code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>prompt</code>, <code class='datatype'>array</code>(<code class='datatype'>string</code>)|<code class='datatype'>void</code> <code class='argument'>attrs</code><b>)</b></code></p></dd>
e8d6742002-12-05H. William Welliver III <dt class='head--fixme'>FIXME</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--fixme'><p>Document this function</p>
e8d6742002-12-05H. William Welliver III </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>redisplay</b></span>
e8d6742002-12-05H. William Welliver III </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>redisplay</span>(</b><code class='datatype'>int</code> <code class='argument'>clear</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>nobackup</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
e8d6742002-12-05H. William Welliver III </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>region</b></span>
e8d6742002-12-05H. William Welliver III </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>region</span>(</b><code class='datatype'>int</code> ... <code class='argument'>args</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
e8d6742002-12-05H. William Welliver III </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_blocking</b></span>
e8d6742002-12-05H. William Welliver III </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_blocking</span>(</b><b>)</b></code></p></dd>
e8d6742002-12-05H. William Welliver III <dt class='head--fixme'>FIXME</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--fixme'><p>Document this function</p>
e8d6742002-12-05H. William Welliver III </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_echo</b></span>
e8d6742002-12-05H. William Welliver III </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_echo</span>(</b><code class='datatype'>int</code> <code class='argument'>onoff</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Set text echo on or off.</p> </dd> <dt class='head--doc'><span id='p-onoff'></span>Parameter <code class='parameter'>onoff</code></dt> <dd></dd><dd class='body--doc'><p>1 for echo, 0 for no echo.</p>
e8d6742002-12-05H. William Welliver III </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_nonblocking</b></span>
e8d6742002-12-05H. William Welliver III </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_nonblocking</span>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code><b>)</b></code></p></dd>
e8d6742002-12-05H. William Welliver III <dt class='head--fixme'>FIXME</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--fixme'><p>Document this function</p>
e8d6742002-12-05H. William Welliver III </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>set_prompt</b></span>
e8d6742002-12-05H. William Welliver III </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>set_prompt</span>(</b><code class='datatype'>string</code> <code class='argument'>newp</code>, <code class='datatype'>array</code>(<code class='datatype'>string</code>)|<code class='datatype'>void</code> <code class='argument'>newattrs</code><b>)</b></code></p></dd>
e8d6742002-12-05H. William Welliver III  <dt class='head--doc'>Description</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--doc'><p>Set the prompt string.</p>
e8d6742002-12-05H. William Welliver III </dd>
c3fe742003-02-05Martin Nilsson <dt class='head--doc'><span id='p-newp'></span>Parameter <code class='parameter'>newp</code></dt> <dd></dd><dd class='body--doc'><p>New prompt string</p>
e8d6742002-12-05H. William Welliver III </dd>
c3fe742003-02-05Martin Nilsson <dt class='head--doc'><span id='p-newattrs'></span>Parameter <code class='parameter'>newattrs</code></dt> <dd></dd><dd class='body--doc'><p>Terminal attributes</p>
e8d6742002-12-05H. William Welliver III </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>setcursorpos</b></span>
e8d6742002-12-05H. William Welliver III </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>setcursorpos</span>(</b><code class='datatype'>int</code> <code class='argument'>p</code><b>)</b></code></p></dd>
e8d6742002-12-05H. William Welliver III <dt class='head--fixme'>FIXME</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--fixme'><p>Document this function</p>
e8d6742002-12-05H. William Welliver III </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>setmark</b></span>
e8d6742002-12-05H. William Welliver III </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>setmark</span>(</b><code class='datatype'>int</code> <code class='argument'>p</code><b>)</b></code></p></dd>
e8d6742002-12-05H. William Welliver III <dt class='head--fixme'>FIXME</dt>
c3fe742003-02-05Martin Nilsson <dd class='body--fixme'><p>Document this function</p>
e8d6742002-12-05H. William Welliver III </dd></dl>
c3fe742003-02-05Martin Nilsson 
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>write</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
c3fe742003-02-05Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>write</span>(</b><code class='datatype'>string</code> <code class='argument'>msg</code>, <code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>word_wrap</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
d5f90f2003-06-27Martin Nilsson <dl><dt><h2 class='header'>Class <b class='ms datatype'>Stdio.Readline.DefaultEditKeys</b></h2> </dt><dd> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>backward_char</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>backward_char</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>backward_delete_char</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>backward_delete_char</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>backward_kill_word</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>backward_kill_word</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>backward_word</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>backward_word</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>beginning_of_line</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>beginning_of_line</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>capitalize_word</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>capitalize_word</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>clear_screen</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>clear_screen</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>create</b></span> </dt> <dd><p><code><span class='object'>Stdio.Readline.DefaultEditKeys</span> <span class='class'>Stdio.Readline.DefaultEditKeys</span><b>(</b><code class='datatype'>object</code> <code class='argument'>readline</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>delete_char_or_eof</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>delete_char_or_eof</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>down_history</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>down_history</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>downcase_word</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>downcase_word</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>end_of_line</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>end_of_line</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>forward_char</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>forward_char</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>forward_word</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>forward_word</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>kill_line</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>kill_line</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>kill_region</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>kill_region</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>kill_ring_save</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>kill_ring_save</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>kill_whole_line</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>kill_whole_line</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>kill_word</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>kill_word</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>newline</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>newline</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>quoted_insert</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>quoted_insert</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>redisplay</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>redisplay</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>self_insert_command</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>self_insert_command</span>(</b><code class='datatype'>string</code> <code class='argument'>str</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>set_default_bindings</b></span> </dt> <dd><p><code><code class='modifier'>protected</code> <code class='datatype'>void</code> <b><span class='method'>set_default_bindings</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>set_mark</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_mark</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>swap_mark_and_point</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>swap_mark_and_point</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>transpose_chars</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>transpose_chars</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>up_history</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>up_history</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>upcase_word</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>upcase_word</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>yank</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>yank</span>(</b><b>)</b></code></p></dd> </dl> </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Stdio.Readline.History</b></h2> </dt><dd> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>create</b></span> </dt> <dd><p><code><span class='object'>Stdio.Readline.History</span> <span class='class'>Stdio.Readline.History</span><b>(</b><code class='datatype'>int</code> <code class='argument'>maxhist</code>, <code class='datatype'>void</code>|<code class='datatype'>array</code>(<code class='datatype'>string</code>) <code class='argument'>hist</code><b>)</b></code></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> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>encode</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>finishline</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>finishline</span>(</b><code class='datatype'>string</code> <code class='argument'>text</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>get_history_num</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>get_history_num</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>history</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>history</span>(</b><code class='datatype'>int</code> <code class='argument'>n</code>, <code class='datatype'>string</code> <code class='argument'>text</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>initline</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>initline</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>set_max_history</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_max_history</span>(</b><code class='datatype'>int</code> <code class='argument'>maxhist</code><b>)</b></code></p></dd> </dl> </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Stdio.Readline.InputController</b></h2>
f5e2962003-07-23Henrik Grubbström (Grubba) </dt><dd><dl class='group--doc'><dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Ought to have support for charset conversion.</p> </dd></dl>
d5f90f2003-06-27Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>bind</b></span> </dt> <dd><p><code><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <b><span class='method'>bind</span>(</b><code class='datatype'>string</code> <code class='argument'>k</code>, <code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>bindstr</b></span> </dt> <dd><p><code><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <b><span class='method'>bindstr</span>(</b><code class='datatype'>string</code> <code class='argument'>str</code>, <code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>bindtc</b></span> </dt> <dd><p><code><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <b><span class='method'>bindtc</span>(</b><code class='datatype'>string</code> <code class='argument'>cap</code>, <code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>create</b></span> </dt> <dd><p><code><span class='object'>Stdio.Readline.InputController</span> <span class='class'>Stdio.Readline.InputController</span><b>(</b><code class='datatype'>object</code>|<code class='datatype'>void</code> <code class='argument'>_infd</code>, <code class='datatype'>object</code>|<code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>_term</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>disable</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>disable</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>enable</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>enable</span>(</b><code class='datatype'>int</code> ... <code class='argument'>e</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>getbinding</b></span> </dt> <dd><p><code><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <b><span class='method'>getbinding</span>(</b><code class='datatype'>string</code> <code class='argument'>k</code>, <code class='datatype'>string</code> <code class='argument'>cap</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>getbindings</b></span> </dt> <dd><p><code><code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>function</code>(:<code class='datatype void'>void</code>)) <b><span class='method'>getbindings</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>getbindingstr</b></span> </dt> <dd><p><code><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <b><span class='method'>getbindingstr</span>(</b><code class='datatype'>string</code> <code class='argument'>str</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>getbindingtc</b></span> </dt> <dd><p><code><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <b><span class='method'>getbindingtc</span>(</b><code class='datatype'>string</code> <code class='argument'>cap</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>grabnextkey</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>grabnextkey</span>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>g</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>isenabled</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>isenabled</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>nullbindings</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>nullbindings</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Clears the bindings.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>parsekey</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>parsekey</span>(</b><code class='datatype'>string</code> <code class='argument'>k</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>run_blocking</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>run_blocking</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>set_close_callback</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_close_callback</span>(</b><code class='datatype'>function</code>(:<code class='datatype'>int</code>) <code class='argument'>ccb</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>unbind</b></span> </dt> <dd><p><code><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <b><span class='method'>unbind</span>(</b><code class='datatype'>string</code> <code class='argument'>k</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>unbindstr</b></span> </dt> <dd><p><code><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <b><span class='method'>unbindstr</span>(</b><code class='datatype'>string</code> <code class='argument'>str</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>unbindtc</b></span> </dt> <dd><p><code><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <b><span class='method'>unbindtc</span>(</b><code class='datatype'>string</code> <code class='argument'>cap</code><b>)</b></code></p></dd> </dl> </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Stdio.Readline.OutputController</b></h2>
f5e2962003-07-23Henrik Grubbström (Grubba) </dt><dd><dl class='group--doc'><dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Ought to have support for charset conversion.</p> </dd></dl>
d5f90f2003-06-27Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>beep</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>beep</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>bol</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>bol</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>check_columns</b></span> </dt>
f5e2962003-07-23Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int</code> <b><span class='method'>check_columns</span>(</b><b>)</b></code></p></dd>
d5f90f2003-06-27Martin Nilsson  <dt class='head--doc'>Description</dt>
f5e2962003-07-23Henrik Grubbström (Grubba) <dd class='body--doc'><p>Check and return the terminal width.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>In Pike 7.4 and earlier this function returned <code class='expr'>void</code>.</p>
d5f90f2003-06-27Martin Nilsson </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>get_number_of_columns</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>clear</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>clear</span>(</b><code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>partial</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>create</b></span> </dt> <dd><p><code><span class='object'>Stdio.Readline.OutputController</span> <span class='class'>Stdio.Readline.OutputController</span><b>(</b><code class='object unresolved'>.File</code>|<code class='datatype'>void</code> <code class='argument'>_outfd</code>, <code class='object unresolved'>.Terminfo.Termcap</code>|<code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>_term</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>disable</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>disable</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>enable</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>enable</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>erase</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>erase</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>get_number_of_columns</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>get_number_of_columns</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns the width of the terminal.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Does not check the width of the terminal.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>check_columns</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>low_erase</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>low_erase</span>(</b><code class='datatype'>int</code> <code class='argument'>n</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>low_move_backward</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>low_move_backward</span>(</b><code class='datatype'>int</code> <code class='argument'>n</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>low_move_downward</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>low_move_downward</span>(</b><code class='datatype'>int</code> <code class='argument'>n</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>low_move_forward</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>low_move_forward</span>(</b><code class='datatype'>int</code> <code class='argument'>n</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>low_move_upward</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>low_move_upward</span>(</b><code class='datatype'>int</code> <code class='argument'>n</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>low_write</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>low_write</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code>, <code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>word_break</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>move_backward</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>move_backward</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>move_forward</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>move_forward</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>newline</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>newline</span>(</b><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>turn_off</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>turn_off</span>(</b><code class='datatype'>string</code> ... <code class='argument'>atts</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Set the provided attributes to off.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>turn_on</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>turn_on</span>(</b><code class='datatype'>string</code> ... <code class='argument'>atts</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Set the provided attributes to on.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>write</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>write</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code>, <code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>word_break</code>, <code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>hide</code><b>)</b></code></p></dd> </dl> </dd></dl></dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Stdio</b></h2>
c90fc82003-06-27Martin Nilsson </dt><dd>
9699552002-03-12Martin Nilsson 
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>DN_ACCESS</b></span> </dt> <dd><p><code><code class='datatype'>constant</code> Stdio.<code class='constant'>DN_ACCESS</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Used in <code>File.notify()</code> to get a callback when files within a directory are accessed.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>DN_ATTRIB</b></span> </dt> <dd><p><code><code class='datatype'>constant</code> Stdio.<code class='constant'>DN_ATTRIB</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Used in <code>File.notify()</code> to get a callback when attributes of files within a directory are changed.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>DN_CREATE</b></span> </dt> <dd><p><code><code class='datatype'>constant</code> Stdio.<code class='constant'>DN_CREATE</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Used in <code>File.notify()</code> to get a callback when new files are created within a directory.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>DN_DELETE</b></span> </dt> <dd><p><code><code class='datatype'>constant</code> Stdio.<code class='constant'>DN_DELETE</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Used in <code>File.notify()</code> to get a callback when files are deleted within a directory.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>DN_MODIFY</b></span> </dt> <dd><p><code><code class='datatype'>constant</code> Stdio.<code class='constant'>DN_MODIFY</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Used in <code>File.notify()</code> to get a callback when files within a directory are modified.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>DN_MULTISHOT</b></span> </dt> <dd><p><code><code class='datatype'>constant</code> Stdio.<code class='constant'>DN_MULTISHOT</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Used in <code>File.notify()</code>. If DN_MULTISHOT is used, signals will be sent for all notifications the program has registred for. Otherwise only the first event the program is listening for will be received and then the program must reregister for the events to receive futher events.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>DN_RENAME</b></span> </dt> <dd><p><code><code class='datatype'>constant</code> Stdio.<code class='constant'>DN_RENAME</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Used in <code>File.notify()</code> to get a callback when files within a directory are renamed.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>IPPROTO</b></span> </dt> <dd><p><code><code class='datatype'>constant</code> Stdio.<code class='constant'>IPPROTO</code></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this constant.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>PROP_BIDIRECTIONAL</b></span> </dt> <dd><p><code><code class='datatype'>constant</code> Stdio.<code class='constant'>PROP_BIDIRECTIONAL</code></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this constant.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>PROP_BUFFERED</b></span> </dt> <dd><p><code><code class='datatype'>constant</code> Stdio.<code class='constant'>PROP_BUFFERED</code></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this constant.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>PROP_IPC</b></span> </dt> <dd><p><code><code class='datatype'>constant</code> Stdio.<code class='constant'>PROP_IPC</code></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this constant.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>PROP_NONBLOCK</b></span> </dt> <dd><p><code><code class='datatype'>constant</code> Stdio.<code class='constant'>PROP_NONBLOCK</code></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this constant.</p> </dd></dl>
069ad52003-10-05Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>PROP_REVERSE</b></span> </dt> <dd><p><code><code class='datatype'>constant</code> Stdio.<code class='constant'>PROP_REVERSE</code></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this constant.</p> </dd></dl>
5bfef52003-04-01Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>PROP_SHUTDOWN</b></span> </dt> <dd><p><code><code class='datatype'>constant</code> Stdio.<code class='constant'>PROP_SHUTDOWN</code></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this constant.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>__HAVE_OOB__</b></span> </dt> <dd><p><code><code class='datatype'>constant</code> Stdio.<code class='constant'>__HAVE_OOB__</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Exists and has the value 1 if OOB operations are available.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>__OOB__</b></span> </dt> <dd><p><code><code class='datatype'>constant</code> Stdio.<code class='constant'>__OOB__</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Implementation level of nonblocking I/O OOB support.</p> <table class='box'><tr><td><code><code class='key'>0</code></code></td><td><p>Nonblocking OOB support is not supported.</p> </td></tr> <tr><td><code><code class='key'>1</code></code></td><td><p>Nonblocking OOB works a little.</p> </td></tr> <tr><td><code><code class='key'>2</code></code></td><td><p>Nonblocking OOB almost works.</p> </td></tr> <tr><td><code><code class='key'>3</code></code></td><td><p>Nonblocking OOB works as intended.</p> </td></tr> <tr><td><code><code class='key'>-1</code></code></td><td><p>Unknown level of nonblocking OOB support.</p> </td></tr> </table><p>This constant only exists when OOB operations are available, i.e. when <code>__HAVE_OOB__</code> is 1.</p> </dd></dl> <hr /> <