<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <META name="GENERATOR" content="hevea 1.06-7 of 2001-11-14"> <TITLE> DEC-10 compatibility input/output </TITLE> </HEAD> <BODY TEXT=black BGCOLOR=white> <A HREF="manual038.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> <A HREF="manual023.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A> <A HREF="manual040.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> <HR> <TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%"> <TR><TD BGCOLOR="#66dbff"><DIV ALIGN=center><TABLE> <TR><TD><FONT SIZE=4><B><A NAME="htoc171">7.16</A></B></FONT></TD> <TD WIDTH="100%" ALIGN=center><FONT SIZE=4><B>DEC-10 compatibility input/output</B></FONT></TD> </TR></TABLE></DIV></TD> </TR></TABLE><UL> <LI><A HREF="manual039.html#toc134"> Introduction</A> <LI><A HREF="manual039.html#toc135"> <TT>see/1</TT>, <TT>tell/1</TT>, <TT>append/1</TT></A> <LI><A HREF="manual039.html#toc136"> <TT>seeing/1</TT>, <TT>telling/1</TT></A> <LI><A HREF="manual039.html#toc137"> <TT>seen/0</TT>, <TT>told/0</TT></A> <LI><A HREF="manual039.html#toc138"> <TT>get0/1</TT>, <TT>get/1</TT>, <TT>skip/1</TT></A> <LI><A HREF="manual039.html#toc139"> <TT>put/1</TT>, <TT>tab/1</TT></A> </UL> <BR> <A NAME="toc134"></A><TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%"> <TR><TD BGCOLOR="#98e7ff"><DIV ALIGN=center><TABLE> <TR><TD><B><A NAME="htoc172">7.16.1</A></B></TD> <TD WIDTH="100%" ALIGN=center><B>Introduction</B></TD> </TR></TABLE></DIV></TD> </TR></TABLE> The DEC-10 Prolog I/O predicates manipulate streams implicitly since they only refer to current input/output streams (section <A HREF="manual033.html#Introduction:(Streams)">7.10.1</A>). The current input and output streams are initially set to <TT>user_input</TT> and <TT>user_output</TT> respectively. The predicate <TT>see/1</TT> (resp. <TT>tell/1</TT>, <TT>append/1</TT>) can be used for setting the current input (resp. output) stream to newly opened streams for particular files. The predicate <TT>seen/0</TT> (resp. <TT>told/0</TT>) close the current input (resp. output) stream, and resets it to the standard input (resp. output). The predicate <TT>seeing/1</TT> (resp. <TT>telling/1</TT>) is used for retrieving the file name associated with the current input (resp. output) stream. The file name <TT>user</TT> stands for the standard input or output, depending on context (<TT>user_input</TT> and <TT>user_output</TT> can also be used). The DEC-10 Prolog I/O predicates are only provided for compatibility, they are now obsolete and their use is discouraged. The predicates for explicit stream manipulation should be used instead (section <A HREF="manual033.html#Streams">7.10</A>).<BR> <BR> <A NAME="toc135"></A><TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%"> <TR><TD BGCOLOR="#98e7ff"><DIV ALIGN=center><TABLE> <TR><TD><B><A NAME="htoc173">7.16.2</A></B></TD> <TD WIDTH="100%" ALIGN=center><B><TT>see/1</TT>, <TT>tell/1</TT>, <TT>append/1</TT></B></TD> </TR></TABLE></DIV></TD> </TR></TABLE> <BR> <B>Templates</B> <DL COMPACT=compact><DT><DD><TT> see(+source_sink)<BR> see(+stream)<BR> tell(+source_sink)<BR> tell(+stream)<BR> append(+source_sink)<BR> append(+stream)</TT></DL> <B>Description</B><BR> <BR> <TT>see(FileName)</TT> sets the current input stream to <TT>FileName</TT>. If there is a stream opened by <TT>see/1</TT> associated with the same <TT>FileName</TT> already, then it becomes the current input stream. Otherwise, <TT>FileName</TT> is opened for reading and becomes the current input stream.<BR> <BR> <TT>tell(FileName)</TT> sets the current output stream to <TT>FileName</TT>. If there is a stream opened by <TT>tell/1</TT> associated with the same <TT>FileName</TT> already, then it becomes the current output stream. Otherwise, <TT>FileName</TT> is opened for writing and becomes the current output stream.<BR> <BR> <TT>append(FileName)</TT> like <TT>tell/1</TT> but <TT>FileName</TT> is opened for writing + append.<BR> <BR> A stream-term (obtained with any other built-in predicate) can also be provided as <TT>FileName</TT> to these predicates.<BR> <BR> <B>Errors</B><BR> <BR> See errors associated to <TT>open/4</TT> (section <A HREF="manual033.html#open/4">7.10.6</A>).<BR> <BR> <B>Portability</B><BR> <BR> GNU Prolog predicates.<BR> <BR> <A NAME="toc136"></A><TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%"> <TR><TD BGCOLOR="#98e7ff"><DIV ALIGN=center><TABLE> <TR><TD><B><A NAME="htoc174">7.16.3</A></B></TD> <TD WIDTH="100%" ALIGN=center><B><TT>seeing/1</TT>, <TT>telling/1</TT></B></TD> </TR></TABLE></DIV></TD> </TR></TABLE> <BR> <B>Templates</B> <DL COMPACT=compact><DT><DD><TT> seeing(?source_sink)<BR> telling(?source_sink)</TT></DL> <B>Description</B><BR> <BR> <TT>seeing(FileName)</TT> succeeds if <TT>FileName</TT> unifies with the name of the current input file, if it was opened by <TT>see/1</TT>; else with the current input stream-term, if this is not <TT>user_input</TT>, otherwise with <TT>user</TT>. <BR> <BR> <TT>telling(FileName)</TT> succeeds if <TT>FileName</TT> unifies with the name of the current output file, if it was opened by <TT>tell/1</TT> or <TT>append/1</TT>; else with the current output stream-term, if this is not <TT>user_output</TT>, otherwise with <TT>user</TT>. <BR> <BR> <B>Errors</B><BR> <BR> None.<BR> <BR> <B>Portability</B><BR> <BR> GNU Prolog predicates.<BR> <BR> <A NAME="toc137"></A><TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%"> <TR><TD BGCOLOR="#98e7ff"><DIV ALIGN=center><TABLE> <TR><TD><B><A NAME="htoc175">7.16.4</A></B></TD> <TD WIDTH="100%" ALIGN=center><B><TT>seen/0</TT>, <TT>told/0</TT></B></TD> </TR></TABLE></DIV></TD> </TR></TABLE> <BR> <B>Templates</B> <DL COMPACT=compact><DT><DD><TT> seen<BR> told</TT></DL> <B>Description</B><BR> <BR> <TT>seen</TT> closes the current input, and resets it to <TT>user_input</TT>.<BR> <BR> <TT>told</TT> closes the current output, and resets it to <TT>user_output</TT>.<BR> <BR> <B>Errors</B><BR> <BR> None.<BR> <BR> <B>Portability</B><BR> <BR> GNU Prolog predicates.<BR> <BR> <A NAME="toc138"></A><TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%"> <TR><TD BGCOLOR="#98e7ff"><DIV ALIGN=center><TABLE> <TR><TD><B><A NAME="htoc176">7.16.5</A></B></TD> <TD WIDTH="100%" ALIGN=center><B><TT>get0/1</TT>, <TT>get/1</TT>, <TT>skip/1</TT></B></TD> </TR></TABLE></DIV></TD> </TR></TABLE> <BR> <B>Templates</B> <DL COMPACT=compact><DT><DD><TT> get0(?in_character_code)<BR> get(?in_character_code)<BR> skip(+character_code)</TT></DL> <B>Description</B><BR> <BR> <TT>get0(Code)</TT> succeeds if <TT>Code</TT> unifies with the next character code read from the current input stream. Thus it is equivalent to <TT>get_code(Code)</TT> (section <A HREF="manual035.html#get-char/2">7.12.1</A>).<BR> <BR> <TT>get(Code)</TT> succeeds if <TT>Code</TT> unifies with the next character code read from the current input stream that is not a layout character.<BR> <BR> <TT>skip(Code)</TT> skips just past the next character code <TT>Code</TT> from the current input stream.<BR> <BR> <B>Errors</B><BR> <BR> See errors for <TT>get_code/2</TT> (section <A HREF="manual035.html#get-char/2">7.12.1</A>).<BR> <BR> <B>Portability</B><BR> <BR> GNU Prolog predicates.<BR> <BR> <A NAME="toc139"></A><TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%"> <TR><TD BGCOLOR="#98e7ff"><DIV ALIGN=center><TABLE> <TR><TD><B><A NAME="htoc177">7.16.6</A></B></TD> <TD WIDTH="100%" ALIGN=center><B><TT>put/1</TT>, <TT>tab/1</TT></B></TD> </TR></TABLE></DIV></TD> </TR></TABLE> <BR> <B>Templates</B> <DL COMPACT=compact><DT><DD><TT> put(+character_code)<BR> tab(+evaluable)</TT></DL> <B>Description</B><BR> <BR> <TT>put(Code)</TT> writes the character whose code is <TT>Code</TT> onto the current output stream. It is equivalent to <TT>put_code(Code)</TT> (section <A HREF="manual035.html#put-char/2">7.12.5</A>).<BR> <BR> <TT>tab(N)</TT> writes <TT>N</TT> spaces onto the current output stream. <TT>N</TT> may be an arithmetic expression.<BR> <BR> <B>Errors</B><BR> <BR> See errors for <TT>put_code/2</TT> (section <A HREF="manual035.html#put-char/2">7.12.5</A>) and for arithmetic expressions (section <A HREF="manual029.html#Evaluation-of-an-arithmetic-expression">7.6.1</A>).<BR> <BR> <B>Portability</B><BR> <BR> GNU Prolog predicates.<BR> <BR> <HR SIZE=2> Copyright (C) 1999-2002 Daniel Diaz <BR> <BR> Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. <BR> <BR> <A HREF="index.html#copyright">More about the copyright</A> <HR> <A HREF="manual038.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> <A HREF="manual023.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A> <A HREF="manual040.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> </BODY> </HTML>