UNPKG

@ciao-lang/ts-ciao-interface

Version:

Simple Ciao interface for node.

220 lines 50.4 kB
<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="theme-color" content="#273f79"/><link rel="stylesheet" href="lpdoc.css" type="text/css"/><script type="text/javascript" src="lpdoc.js"></script><title>Basic file/stream handling &mdash; The Ciao System v1.22</title></head><body><div class="lpdoc-page fixleftbar"><a href="#" id="sidebar-toggle-button" class="lpdoc-navbutton"><span id="sidebar-button-arrow">&#9776;</span></a><div id="sidebar" class="lpdoc-sidebar"><div style="height: 40px; margin-left: auto; margin-right: auto"><img src="ciao-logo_autofig.png" width=auto height=100%></div><div class="lpdoc-nav"><span class="lpdoc-on-right"><a class="lpdoc-navbutton" href="streams.html">&#x2191;</a><a class="lpdoc-navbutton" href="streams.html">&#x2190;</a><a class="lpdoc-navbutton" href="io_basic.html">&#x2192;</a><a class="lpdoc-navbutton" href="ciaosearch.html">&#x1F50D;</a></span><span><a href="ciaofulltoc.html">TOC</a></span></div><hr></hr><ul class="lpdoc-itemize-sectpath"><li><a href="ciao.html">The Ciao System</a> &raquo;<br/> </li><li><a href="StdLibs.html">PART VII - Standard libraries</a> &raquo;<br/> </li><li><a href="streams.html">Stream handling and operations</a> &raquo;<br/> </li><li><a href=""><strong>Basic file/stream handling</strong></a></li></ul><hr></hr><em>ON THIS PAGE</em><ul><li><a href="#Usage and interface">Usage and interface</a></li><li><a href="#Documentation on exports">Documentation on exports</a></li><li><a href="#Documentation on multifiles">Documentation on multifiles</a></li><li><a href="#Documentation on imports">Documentation on imports</a></li></ul></div><div class="lpdoc-main"><div id=""><h1>Basic file/stream handling</h1><a class="lpdoc-idx-anchor" href="ciaosearch.html#stream_basic"></a> <strong>Author(s):</strong> <a class="lpdoc-idx-anchor" id="Daniel Cabeza" href="ciaosearch.html#Daniel Cabeza">Daniel Cabeza</a>, <a class="lpdoc-idx-anchor" id="Mats Carlsson" href="ciaosearch.html#Mats Carlsson">Mats Carlsson</a>.<p> This module provides basic predicates for handling files and streams, in order to make input/output on them.<br/><div id="Usage and interface"><h2>Usage and interface</h2><div class="lpdoc-cartouche"><ul><li><strong>Library usage:</strong><br/><tt>:- use_module(engine(stream_basic)).</tt><li><strong>Exports:</strong><br/><ul class="lpdoc-itemize-minus"><li><em>Predicates:</em><br/><a class="lpdoc-idx-anchor" id="0" href="#open/3"><tt>open/3</tt></a>, <a class="lpdoc-idx-anchor" id="1" href="iso_incomplete.html#open/4"><tt>open/4</tt></a>, <a class="lpdoc-idx-anchor" id="2" href="iso_incomplete.html#close/1"><tt>close/1</tt></a>, <a class="lpdoc-idx-anchor" id="3" href="iso_incomplete.html#set_input/1"><tt>set_input/1</tt></a>, <a class="lpdoc-idx-anchor" id="4" href="#current_input/1"><tt>current_input/1</tt></a>, <a class="lpdoc-idx-anchor" id="5" href="iso_incomplete.html#set_output/1"><tt>set_output/1</tt></a>, <a class="lpdoc-idx-anchor" id="6" href="#current_output/1"><tt>current_output/1</tt></a>, <a class="lpdoc-idx-anchor" id="7" href="#character_count/2"><tt>character_count/2</tt></a>, <a class="lpdoc-idx-anchor" id="8" href="#line_count/2"><tt>line_count/2</tt></a>, <a class="lpdoc-idx-anchor" id="9" href="#line_position/2"><tt>line_position/2</tt></a>, <a class="lpdoc-idx-anchor" id="10" href="#flush_output/1"><tt>flush_output/1</tt></a>, <a class="lpdoc-idx-anchor" id="11" href="#flush_output/0"><tt>flush_output/0</tt></a>, <a class="lpdoc-idx-anchor" id="12" href="#clearerr/1"><tt>clearerr/1</tt></a>, <a class="lpdoc-idx-anchor" id="13" href="#current_stream/3"><tt>current_stream/3</tt></a>, <a class="lpdoc-idx-anchor" id="14" href="#stream_code/2"><tt>stream_code/2</tt></a>, <a class="lpdoc-idx-anchor" id="15" href="iso_incomplete.html#absolute_file_name/2"><tt>absolute_file_name/2</tt></a>, <a class="lpdoc-idx-anchor" id="16" href="#absolute_file_name/7"><tt>absolute_file_name/7</tt></a>, <a class="lpdoc-idx-anchor" id="17" href="#pipe/2"><tt>pipe/2</tt></a>, <a class="lpdoc-idx-anchor" id="18" href="#fixed_absolute_file_name/3"><tt>fixed_absolute_file_name/3</tt></a>. <li><em>Regular Types:</em><br/><a class="lpdoc-idx-anchor" id="19" href="#open_option_list/1"><tt>open_option_list/1</tt></a>, <a class="lpdoc-idx-anchor" id="20" href="#sourcename/1"><tt>sourcename/1</tt></a>, <a class="lpdoc-idx-anchor" id="21" href="#stream/1"><tt>stream/1</tt></a>, <a class="lpdoc-idx-anchor" id="22" href="#stream_alias/1"><tt>stream_alias/1</tt></a>, <a class="lpdoc-idx-anchor" id="23" href="#io_mode/1"><tt>io_mode/1</tt></a>, <a class="lpdoc-idx-anchor" id="24" href="#atm_or_int/1"><tt>atm_or_int/1</tt></a>. <li><em>Multifiles:</em><br/><a class="lpdoc-idx-anchor" id="25" href="#file_search_path/2"><tt>file_search_path/2</tt></a>, <a class="lpdoc-idx-anchor" id="26" href="#library_directory/1"><tt>library_directory/1</tt></a>. </ul></ul></div></div><div id="Documentation on exports"><h2>Documentation on exports</h2><div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="open/3" href="ciaosearch.html#open/3">open/3</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>open(File,Mode,Stream)</tt> </span><p>Open <span class="lpdoc-var">File</span> with mode <span class="lpdoc-var">Mode</span> and return in <span class="lpdoc-var">Stream</span> the stream associated with the file. No extension is implicit in <span class="lpdoc-var">File</span>.<p><span class="lpdoc-usage-header">Usage 1:</span><span class="lpdoc-usage-decl"><span class="lpdoc-on-right"><span class="lpdoc-iso">ISO</span></span><span></span> </span><p>Normal use.</p><ul class="lpdoc-itemize-minus"><li><em>Call and exit should be compatible with:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="27" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="28" href="#sourcename/1"><tt>stream_basic:sourcename/1</tt></a>)</span><span><span class="lpdoc-var">File</span> is a source name. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="29" href="#io_mode/1"><tt>stream_basic:io_mode/1</tt></a>)</span><span><span class="lpdoc-var">Mode</span> is an opening mode (&apos;read&apos;, &apos;write&apos; or &apos;append&apos;). </span> <li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="30" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties should hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="31" href="basic_props.html#native/1"><tt>basic_props:native/1</tt></a>)</span><span>This predicate is understood natively by CiaoPP. </span> </ul><p><span class="lpdoc-usage-header">Usage 2:</span><p>In the special case that <span class="lpdoc-var">File</span> is an integer, it is assumed to be a file descriptor passed to Prolog from a foreign function call. The file descriptor is connected to a Prolog stream (invoking the C POSIX function <tt>fdopen()</tt>) which is unified with <span class="lpdoc-var">Stream</span>.</p><ul class="lpdoc-itemize-minus"><li><em>Call and exit should be compatible with:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="32" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="33" href="basic_props.html#int/1"><tt>basic_props:int/1</tt></a>)</span><span><span class="lpdoc-var">File</span> is an integer. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="34" href="#io_mode/1"><tt>stream_basic:io_mode/1</tt></a>)</span><span><span class="lpdoc-var">Mode</span> is an opening mode (&apos;read&apos;, &apos;write&apos; or &apos;append&apos;). </span> <li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="35" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="open/4" href="ciaosearch.html#open/4">open/4</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>open(File,Mode,Stream,Options)</tt> </span><p>Same as <tt>open(<span class="lpdoc-var">File</span>, <span class="lpdoc-var">Mode</span>, <span class="lpdoc-var">Stream</span>)</tt> with options <span class="lpdoc-var">Options</span>. See the definition of <a class="lpdoc-idx-anchor" id="36" href="#open_option_list/1"><tt>open_option_list/1</tt></a> for details.<p><span class="lpdoc-usage-header">Usage:</span><p></p><ul class="lpdoc-itemize-minus"><li><em>Call and exit should be compatible with:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="37" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="38" href="#sourcename/1"><tt>stream_basic:sourcename/1</tt></a>)</span><span><span class="lpdoc-var">File</span> is a source name. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="39" href="#io_mode/1"><tt>stream_basic:io_mode/1</tt></a>)</span><span><span class="lpdoc-var">Mode</span> is an opening mode (&apos;read&apos;, &apos;write&apos; or &apos;append&apos;). </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="41" href="#open_option_list/1"><tt>stream_basic:open_option_list/1</tt></a>)</span><span><span class="lpdoc-var">Options</span> is a list of options for <a class="lpdoc-idx-anchor" id="40" href="iso_incomplete.html#open/4"><tt>open/4</tt></a>. </span> <li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="42" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties should hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="43" href="basic_props.html#native/1"><tt>basic_props:native/1</tt></a>)</span><span>This predicate is understood natively by CiaoPP. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">REGTYPE</span><a class="lpdoc-idx-anchor" id="open_option_list/1" href="ciaosearch.html#open_option_list/1">open_option_list/1</a></div><div class="lpdoc-deftext">A list of options for <a class="lpdoc-idx-anchor" id="44" href="iso_incomplete.html#open/4"><tt>open/4</tt></a>, currently the meaningful options are:<p><dl> <p><dt><tt>lock</tt><dd> Try to set an advisory lock for the file. If the open mode is <tt>read</tt>, the lock is a read (shared) lock, else it is a write (exclusive) lock. If the lock cannot be acquired, the call waits until it is released (but can fail in exceptional cases).<p><dt><tt>lock_nb</tt><dd> Same as <tt>lock</tt>, but the call immediately fails if the lock cannot be acquired.<p><dt><tt>lock(Lock_Mode)</tt><dd> Same as <tt>lock</tt>, but specifying in <tt>Lock_Mode</tt> whether the lock is <tt>read</tt> (also <tt>shared</tt>) or <tt>write</tt> (also <tt>exclusive</tt>). This option has be included for compatibility with the SWI-Prolog locking options, because in general the type of lock should match the open mode as in the <tt>lock</tt> option.<p><dt><tt>lock_nb(Lock_Mode)</tt><dd> Same as the previous option but with the <tt>lock_nb</tt> behavior.<p></dl> <p>All file locking is implemented via the POSIX function fcntl(). Please refer to its manual page for details.<p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>open_option_list(L)</tt> </span><p><span class="lpdoc-var">L</span> is a list of options for <a class="lpdoc-idx-anchor" id="45" href="iso_incomplete.html#open/4"><tt>open/4</tt></a>.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="close/1" href="ciaosearch.html#close/1">close/1</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>close(Stream)</tt> </span><p>Close the stream <span class="lpdoc-var">Stream</span>.<p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><span class="lpdoc-on-right"><span class="lpdoc-iso">ISO</span></span><span></span> </span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="46" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="47" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="48" href="basic_props.html#native/1"><tt>basic_props:native/1</tt></a>)</span><span>This predicate is understood natively by CiaoPP. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="set_input/1" href="ciaosearch.html#set_input/1">set_input/1</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>set_input(Stream)</tt> </span><p>Set the current input stream to <span class="lpdoc-var">Stream</span>. A notion of <a class="lpdoc-idx-anchor" id="49" href="ciaosearch.html#current input stream"><em>current input stream</em></a> is maintained by the system, so that input predicates with no explicit stream operate on the current input stream. Initially it is set to <tt>user_input</tt>.<p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><span class="lpdoc-on-right"><span class="lpdoc-iso">ISO</span></span><span></span> </span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="50" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="51" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="52" href="basic_props.html#native/1"><tt>basic_props:native/1</tt></a>)</span><span>This predicate is understood natively by CiaoPP. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="current_input/1" href="ciaosearch.html#current_input/1">current_input/1</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>current_input(Stream)</tt> </span><p>Unify <span class="lpdoc-var">Stream</span> with the <a class="lpdoc-idx-anchor" id="53" href="ciaosearch.html#current input stream">current input stream</a>. In addition to the ISO behavior, stream aliases are allowed. This is useful for most applications checking whether a stream is the standard input or output.<p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><span class="lpdoc-on-right"><span class="lpdoc-iso">ISO</span></span><span></span> </span><p></p><ul class="lpdoc-itemize-minus"><li><em>Calls should, and exit will be compatible with:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="54" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="55" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="56" href="basic_props.html#native/1"><tt>basic_props:native/1</tt></a>)</span><span>This predicate is understood natively by CiaoPP. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="set_output/1" href="ciaosearch.html#set_output/1">set_output/1</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>set_output(Stream)</tt> </span><p>Set the current output stream to <span class="lpdoc-var">Stream</span>. A notion of <a class="lpdoc-idx-anchor" id="57" href="ciaosearch.html#current output stream"><em>current output stream</em></a> is maintained by the system, so that output predicates with no explicit stream operate on the current output stream. Initially it is set to <tt>user_output</tt>.<p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><span class="lpdoc-on-right"><span class="lpdoc-iso">ISO</span></span><span></span> </span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="58" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="59" href="basic_props.html#native/1"><tt>basic_props:native/1</tt></a>)</span><span>This predicate is understood natively by CiaoPP. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="current_output/1" href="ciaosearch.html#current_output/1">current_output/1</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>current_output(Stream)</tt> </span><p>Unify <span class="lpdoc-var">Stream</span> with the <a class="lpdoc-idx-anchor" id="60" href="ciaosearch.html#current output stream">current output stream</a>. The same comment as for <a class="lpdoc-idx-anchor" id="61" href="#current_input/1"><tt>current_input/1</tt></a> applies.<p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><span class="lpdoc-on-right"><span class="lpdoc-iso">ISO</span></span><span></span> </span><p></p><ul class="lpdoc-itemize-minus"><li><em>Calls should, and exit will be compatible with:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="62" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="63" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="64" href="basic_props.html#native/1"><tt>basic_props:native/1</tt></a>)</span><span>This predicate is understood natively by CiaoPP. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="character_count/2" href="ciaosearch.html#character_count/2">character_count/2</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>character_count(Stream,Count)</tt> </span><p><span class="lpdoc-var">Count</span> characters have been read from or written to <span class="lpdoc-var">Stream</span>.<p><span class="lpdoc-usage-header">Usage:</span><p></p><ul class="lpdoc-itemize-minus"><li><em>Calls should, and exit will be compatible with:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="65" href="basic_props.html#int/1"><tt>basic_props:int/1</tt></a>)</span><span><span class="lpdoc-var">Count</span> is an integer. </span> <li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="66" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="67" href="basic_props.html#int/1"><tt>basic_props:int/1</tt></a>)</span><span><span class="lpdoc-var">Count</span> is an integer. </span> <li><em>The following properties hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="68" href="basic_props.html#native/1"><tt>basic_props:native/1</tt></a>)</span><span>This predicate is understood natively by CiaoPP. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="line_count/2" href="ciaosearch.html#line_count/2">line_count/2</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>line_count(Stream,Count)</tt> </span><p><span class="lpdoc-var">Count</span> lines have been read from or written to <span class="lpdoc-var">Stream</span>.<p><span class="lpdoc-usage-header">Usage:</span><p></p><ul class="lpdoc-itemize-minus"><li><em>Calls should, and exit will be compatible with:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="69" href="basic_props.html#int/1"><tt>basic_props:int/1</tt></a>)</span><span><span class="lpdoc-var">Count</span> is an integer. </span> <li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="70" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="71" href="basic_props.html#int/1"><tt>basic_props:int/1</tt></a>)</span><span><span class="lpdoc-var">Count</span> is an integer. </span> <li><em>The following properties hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="72" href="basic_props.html#native/1"><tt>basic_props:native/1</tt></a>)</span><span>This predicate is understood natively by CiaoPP. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="line_position/2" href="ciaosearch.html#line_position/2">line_position/2</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>line_position(Stream,Count)</tt> </span><p><span class="lpdoc-var">Count</span> characters have been read from or written to the current line of <span class="lpdoc-var">Stream</span>.<p><span class="lpdoc-usage-header">Usage:</span><p></p><ul class="lpdoc-itemize-minus"><li><em>Calls should, and exit will be compatible with:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="73" href="basic_props.html#int/1"><tt>basic_props:int/1</tt></a>)</span><span><span class="lpdoc-var">Count</span> is an integer. </span> <li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="74" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="75" href="basic_props.html#int/1"><tt>basic_props:int/1</tt></a>)</span><span><span class="lpdoc-var">Count</span> is an integer. </span> <li><em>The following properties hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="76" href="basic_props.html#native/1"><tt>basic_props:native/1</tt></a>)</span><span>This predicate is understood natively by CiaoPP. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="flush_output/1" href="ciaosearch.html#flush_output/1">flush_output/1</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>flush_output(Stream)</tt> </span><p>Flush any buffered data to output stream <span class="lpdoc-var">Stream</span>.<p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><span class="lpdoc-on-right"><span class="lpdoc-iso">ISO</span></span><span></span> </span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="77" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="78" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="79" href="basic_props.html#native/1"><tt>basic_props:native/1</tt></a>)</span><span>This predicate is understood natively by CiaoPP. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="flush_output/0" href="ciaosearch.html#flush_output/0">flush_output/0</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>flush_output</tt> </span><p>Behaves like <tt>current_output(S), flush_output(S)</tt></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="clearerr/1" href="ciaosearch.html#clearerr/1">clearerr/1</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>clearerr(Stream)</tt> </span><p>Clear the end-of-file and error indicators for input stream <span class="lpdoc-var">Stream</span>.<p><span class="lpdoc-usage-header">Usage:</span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="80" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="81" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="current_stream/3" href="ciaosearch.html#current_stream/3">current_stream/3</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>current_stream(Filename,Mode,Stream)</tt> </span><p><span class="lpdoc-var">Stream</span> is a stream which was opened in mode <span class="lpdoc-var">Mode</span> and which is connected to the absolute file name <span class="lpdoc-var">Filename</span> (an atom) or to the file descriptor <span class="lpdoc-var">Filename</span> (an integer). This predicate can be used for enumerating all currently open streams through backtracking.<p><span class="lpdoc-usage-header">Usage:</span><p></p><ul class="lpdoc-itemize-minus"><li><em>Calls should, and exit will be compatible with:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="83" href="#atm_or_int/1"><tt>stream_basic:atm_or_int/1</tt></a>)</span><span><a class="lpdoc-idx-anchor" id="82" href="ciaosearch.html#atm_or_int(Filename)"><tt>stream_basic:atm_or_int(Filename)</tt></a> </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="84" href="#io_mode/1"><tt>stream_basic:io_mode/1</tt></a>)</span><span><span class="lpdoc-var">Mode</span> is an opening mode (&apos;read&apos;, &apos;write&apos; or &apos;append&apos;). </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="85" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="87" href="#atm_or_int/1"><tt>stream_basic:atm_or_int/1</tt></a>)</span><span><a class="lpdoc-idx-anchor" id="86" href="ciaosearch.html#atm_or_int(Filename)"><tt>stream_basic:atm_or_int(Filename)</tt></a> </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="88" href="#io_mode/1"><tt>stream_basic:io_mode/1</tt></a>)</span><span><span class="lpdoc-var">Mode</span> is an opening mode (&apos;read&apos;, &apos;write&apos; or &apos;append&apos;). </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="89" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="90" href="basic_props.html#native/1"><tt>basic_props:native/1</tt></a>)</span><span>This predicate is understood natively by CiaoPP. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="stream_code/2" href="ciaosearch.html#stream_code/2">stream_code/2</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>stream_code(Stream,StreamCode)</tt> </span><p><span class="lpdoc-var">StreamCode</span> is the file descriptor (an integer) corresponding to the Prolog stream <span class="lpdoc-var">Stream</span>.<p><span class="lpdoc-usage-header">Usage 1:</span><p></p><ul class="lpdoc-itemize-minus"><li><em>Calls should, and exit will be compatible with:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="91" href="basic_props.html#int/1"><tt>basic_props:int/1</tt></a>)</span><span><span class="lpdoc-var">StreamCode</span> is an integer. </span> <li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="92" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> <li><em>The following properties hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="93" href="basic_props.html#int/1"><tt>basic_props:int/1</tt></a>)</span><span><span class="lpdoc-var">StreamCode</span> is an integer. </span> </ul><p><span class="lpdoc-usage-header">Usage 2:</span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="94" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="95" href="basic_props.html#int/1"><tt>basic_props:int/1</tt></a>)</span><span><span class="lpdoc-var">StreamCode</span> is an integer. </span> <li><em>The following properties hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="96" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Stream</span> is an open stream. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="absolute_file_name/2" href="ciaosearch.html#absolute_file_name/2">absolute_file_name/2</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>absolute_file_name(RelFileSpec,AbsFileSpec)</tt> </span><p>If <span class="lpdoc-var">RelFileSpec</span> is an absolute pathname then do an absolute lookup. If <span class="lpdoc-var">RelFileSpec</span> is a relative pathname then prefix the name with the name of the current directory and do an absolute lookup. If <span class="lpdoc-var">RelFileSpec</span> is a path alias, perform the lookup following the path alias rules (see <a class="lpdoc-idx-anchor" id="97" href="#sourcename/1"><tt>sourcename/1</tt></a>). In all cases: if a matching file with suffix <tt>.pl</tt> exists, then <span class="lpdoc-var">AbsFileSpec</span> will be unified with this file. Failure to open a file normally causes an exception. The behaviour can be controlled by the <tt>fileerrors</tt> <a class="lpdoc-idx-anchor" id="98" href="ciaosearch.html#prolog flag">prolog flag</a>.<p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>absolute_file_name(RelFileSpec,AbsFileSpec)</tt> </span><p><span class="lpdoc-var">AbsFileSpec</span> is the absolute name (with full path) of <span class="lpdoc-var">RelFileSpec</span>.</p><ul class="lpdoc-itemize-minus"><li><em>Call and exit should be compatible with:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="99" href="#sourcename/1"><tt>stream_basic:sourcename/1</tt></a>)</span><span><span class="lpdoc-var">RelFileSpec</span> is a source name. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="100" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">AbsFileSpec</span> is an atom. </span> <li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="101" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">RelFileSpec</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="102" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">AbsFileSpec</span> is a free variable. </span> <li><em>The following properties should hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="103" href="basic_props.html#native/1"><tt>basic_props:native/1</tt></a>)</span><span>This predicate is understood natively by CiaoPP. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="absolute_file_name/7" href="ciaosearch.html#absolute_file_name/7">absolute_file_name/7</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>absolute_file_name(Spec,Opt,Suffix,CurrDir,AbsFile,AbsBase,AbsDir)</tt> </span><p><span class="lpdoc-var">AbsFile</span> is the absolute name (with full path) of <span class="lpdoc-var">Spec</span>, which has an optional first suffix <span class="lpdoc-var">Opt</span> and an optional second suffix <span class="lpdoc-var">Suffix</span>, when the current directory is <span class="lpdoc-var">CurrDir</span>. <span class="lpdoc-var">AbsBase</span> is the same as <span class="lpdoc-var">AbsFile</span>, but without the second suffix, and <span class="lpdoc-var">AbsDir</span> is the absolute path of the directory where <span class="lpdoc-var">AbsFile</span> is. The Ciao compiler invokes this predicate with <span class="lpdoc-var">Opt</span>=<tt>&apos;_opt&apos;</tt> and <span class="lpdoc-var">Suffix</span>=<tt>&apos;.pl&apos;</tt> when searching source files.<p><span class="lpdoc-usage-header">Usage:</span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="104" href="#sourcename/1"><tt>stream_basic:sourcename/1</tt></a>)</span><span><span class="lpdoc-var">Spec</span> is a source name. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="105" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">Opt</span> is an atom. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="106" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">Suffix</span> is an atom. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="107" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">CurrDir</span> is an atom. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="108" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">AbsFile</span> is a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="109" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">AbsBase</span> is a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="110" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">AbsDir</span> is a free variable. </span> <li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="111" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">AbsFile</span> is an atom. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="112" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">AbsBase</span> is an atom. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="113" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">AbsDir</span> is an atom. </span> <li><em>The following properties should hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="114" href="basic_props.html#native/1"><tt>basic_props:native/1</tt></a>)</span><span>This predicate is understood natively by CiaoPP. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="pipe/2" href="ciaosearch.html#pipe/2">pipe/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><span class="lpdoc-on-right"><span class="lpdoc-iso">ISO</span></span><span></span> </span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="115" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">Arg1</span> is a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="116" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">Arg2</span> is a free variable. </span> <li><em>The following properties hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="117" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Arg1</span> is an open stream. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="118" href="#stream/1"><tt>stream_basic:stream/1</tt></a>)</span><span><span class="lpdoc-var">Arg2</span> is an open stream. </span> <li><em>The following properties hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="119" href="basic_props.html#native/1"><tt>basic_props:native/1</tt></a>)</span><span>This predicate is understood natively by CiaoPP. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">REGTYPE</span><a class="lpdoc-idx-anchor" id="sourcename/1" href="ciaosearch.html#sourcename/1">sourcename/1</a></div><div class="lpdoc-deftext">A source name is a flexible way of referring to a concrete file. A source name is either a relative or absolute filename given as:<p><ul> <p><li>an atom, or<p><li>a unary functor (which represents a <a class="lpdoc-idx-anchor" id="120" href="ciaosearch.html#path alias"><em>path alias</em></a>, see below) applied to a <em>relative</em> path, the latter being given as an atom.<p></ul> <p>In all cases certain filename extensions (e.g., <tt>.pl</tt>) can be implicit. In the first form above, file names can be relative to the current directory. Also, file names beginning with <tt>~</tt> or <tt>$</tt> are treated specially. For example,<p><dl> <p><dt><tt>&apos;~/ciao/sample.pl&apos;</tt><dd> is equivalent to <tt>&apos;/home/staff/herme/ciao/sample.pl&apos;</tt>, if <tt>/home/staff/herme</tt> is the user&apos;s home directory. (On POSIX systems, this is equivalent to <tt>&apos;$HOME/ciao/sample.pl&apos;</tt> as explained below.)<p><dt><tt>&apos;~bardo/prolog/sample.pl&apos;</tt><dd> is equivalent to <tt>&apos;/home/bardo/prolog/sample.pl&apos;</tt>, if <tt>/home/bardo</tt> is <tt>bardo</tt>&apos;s home directory.<p><dt><tt>&apos;$UTIL/sample.pl&apos;</tt><dd> is equivalent to <tt>&apos;/usr/local/src/utilities/sample.pl&apos;</tt>, if <tt>/usr/local/src/utilities</tt> is the value of the environment variable <tt>UTIL</tt>.<p></dl> <p>The second form allows using path aliases. Such aliases allow refering to files not with absolute file system paths but with paths which are relative to predefined (or user-defined) abstract names. For example, given the path alias <tt>myutils</tt> which has been defined to refer to path <tt>&apos;/home/bardo/utilities&apos;</tt>, if that directory contains the file <tt>stuff.pl</tt> then the term <tt>myutils(stuff)</tt> in a <a class="lpdoc-idx-anchor" id="121" href="toplevel_doc.html#use_module/1"><tt>use_module/1</tt></a> declaration would refer to the file <tt>&apos;/home/bardo/utilities/stuff.pl&apos;</tt> (the <tt>.pl</tt> extension is implicit in the <a class="lpdoc-idx-anchor" id="122" href="toplevel_doc.html#use_module/1"><tt>use_module/1</tt></a> declaration). As a special case, if that directory contains a subdirectory named <tt>stuff</tt> which in turn contains the file <tt>stuff.pl</tt>, the same term would refer to the file <tt>&apos;/home/bardo/utilities/stuff/stuff.pl&apos;</tt>. If a path alias is related to several paths, all paths are scanned in sequence until a match is found. For information on predefined path aliases or how to define new path aliases, see <a class="lpdoc-idx-anchor" id="123" href="#file_search_path/2"><tt>file_search_path/2</tt></a>. <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>sourcename(F)</tt> </span><p><span class="lpdoc-var">F</span> is a source name.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">REGTYPE</span><a class="lpdoc-idx-anchor" id="stream/1" href="ciaosearch.html#stream/1">stream/1</a></div><div class="lpdoc-deftext">Streams correspond to the file pointers used at the operating system level, and usually represent opened files. There are four special streams which correspond with the operating system standard streams: <dl> <p><dt><tt>user_input</tt><dd> The standard input stream, i.e. the terminal, usually.<p><dt><tt>user_output</tt><dd> The standard output stream, i.e. the terminal, usually.<p><dt><tt>user_error</tt><dd> The standard error stream.<p><dt><tt>user</tt><dd> The standard input or output stream, depending on context.<p></dl> <p><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>stream(S)</tt> </span><p><span class="lpdoc-var">S</span> is an open stream.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">REGTYPE</span><a class="lpdoc-idx-anchor" id="stream_alias/1" href="ciaosearch.html#stream_alias/1">stream_alias/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>stream_alias(S)</tt> </span><p><span class="lpdoc-var">S</span> is the alias of an open stream, i.e., an atom which represents a stream at Prolog level.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">REGTYPE</span><a class="lpdoc-idx-anchor" id="io_mode/1" href="ciaosearch.html#io_mode/1">io_mode/1</a></div><div class="lpdoc-deftext">Can have the following values: <dl> <p><dt><tt>read</tt><dd> Open the file for input.<p><dt><tt>write</tt><dd> Open the file for output. The file is created if it does not already exist, the file will otherwise be truncated.<p><dt><tt>append</tt><dd> Open the file for output. The file is created if it does not already exist, the file will otherwise be appended to.<p></dl><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>io_mode(M)</tt> </span><p><span class="lpdoc-var">M</span> is an opening mode (&apos;read&apos;, &apos;write&apos; or &apos;append&apos;).</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">REGTYPE</span><a class="lpdoc-idx-anchor" id="atm_or_int/1" href="ciaosearch.html#atm_or_int/1">atm_or_int/1</a></div><div class="lpdoc-deftext">A regular type, defined as follows:<pre class="lpdoc-codeblock">atm_or_int(X) :- atm(X). atm_or_int(X) :- int(X). </pre> </div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="fixed_absolute_file_name/3" href="ciaosearch.html#fixed_absolute_file_name/3">fixed_absolute_file_name/3</a></div><div class="lpdoc-deftext">No further documentation available for this predicate.</div></div><p> </div><div id="Documentation on multifiles"><h2>Documentation on multifiles</h2><div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="file_search_path/2" href="ciaosearch.html#file_search_path/2">file_search_path/2</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>file_search_path(Alias,Path)</tt> </span><p>The <a class="lpdoc-idx-anchor" id="124" href="ciaosearch.html#path alias">path alias</a> <span class="lpdoc-var">Alias</span> is linked to path <span class="lpdoc-var">Path</span>. Both arguments must be atoms. New facts (or clauses) of this predicate can be asserted to define new path aliases. Predefined path aliases in Ciao are:<p><dl> <p><dt><tt>library</tt><dd> Initially points to all Ciao library paths. See <a class="lpdoc-idx-anchor" id="125" href="#library_directory/1"><tt>library_directory/1</tt></a>.<p><dt><tt>engine</tt><dd> The path of the <a class="lpdoc-idx-anchor" id="126" href="ciaosearch.html#Ciao engine builtins">Ciao engine builtins</a>.<p><dt><tt>.</tt><dd> The current path (<tt>&apos;.&apos;</tt>).<p></dl> The predicate is <em>multifile</em>.<br/> The predicate is of type <em>dynamic</em>.<br/><span class="lpdoc-usage-decl"><tt>file_search_path(X,Y)</tt> </span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="127" href="basic_props.html#gnd/1"><tt>basic_props:gnd/1</tt></a>)</span><span><span class="lpdoc-var">X</span> is ground. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="128" href="basic_props.html#gnd/1"><tt>basic_props:gnd/1</tt></a>)</span><span><span class="lpdoc-var">Y</span> is ground. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="library_directory/1" href="ciaosearch.html#library_directory/1">library_directory/1</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>library_directory(Path)</tt> </span><p><span class="lpdoc-var">Path</span> is a library path (a path represented by the <a class="lpdoc-idx-anchor" id="129" href="ciaosearch.html#path alias">path alias</a> <tt>library</tt>). More library paths can be defined by asserting new facts (or clauses) of this predicate. The predicate is <em>multifile</em>.<br/> The predicate is of type <em>dynamic</em>.<br/><span class="lpdoc-usage-decl"><tt>library_directory(X)</tt> </span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="130" href="basic_props.html#gnd/1"><tt>basic_props:gnd/1</tt></a>)</span><span><span class="lpdoc-var">X</span> is ground. </span> </ul></div></div><p> </div><div id="Documentation on imports"><h2>Documentation on imports</h2>This module has the following direct dependencies:<ul class="lpdoc-itemize-minus"><li><em>Packages:</em><br/><a class="lpdoc-idx-anchor" id="131" href="ciaosearch.html#prelude"><tt>prelude</tt></a>, <a class="lpdoc-idx-anchor" id="132" href="ciaosearch.html#initial"><tt>initial</tt></a>, <a class="lpdoc-idx-anchor" id="133" href="condcomp_doc.html"><tt>condcomp</tt></a>, <a class="lpdoc-idx-anchor" id="134" href="assertions_doc.html"><tt>assertions</tt></a>, <a class="lpdoc-idx-anchor" id="135" href="ciaos