<!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> Program state </TITLE> </HEAD> <BODY TEXT=black BGCOLOR=white> <A HREF="manual045.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> <A HREF="manual023.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A> <A HREF="manual047.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="htoc227">7.23</A></B></FONT></TD> <TD WIDTH="100%" ALIGN=center><FONT SIZE=4><B>Program state</B></FONT></TD> </TR></TABLE></DIV></TD> </TR></TABLE><UL> <LI><A HREF="manual046.html#toc183"> <TT>consult/1</TT>, <TT>'.'/2</TT> - program consult</A> <LI><A HREF="manual046.html#toc184"> <TT>load/1</TT></A> <LI><A HREF="manual046.html#toc185"> <TT>listing/1</TT>, <TT>listing/0</TT></A> </UL> <BR> <A NAME="toc183"></A><TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%"> <TR><TD BGCOLOR="#98e7ff"><DIV ALIGN=center><TABLE> <TR><TD><B><A NAME="htoc228">7.23.1</A></B></TD> <TD WIDTH="100%" ALIGN=center><B><TT>consult/1</TT>, <TT>'.'/2</TT> - program consult</B></TD> </TR></TABLE></DIV></TD> </TR></TABLE> <A NAME="consult/1"></A> <BR> <B>Templates</B> <DL COMPACT=compact><DT><DD><TT> consult(+atom_or_atom_list)<BR> '.'(+atom, +atom_list)</TT></DL> <B>Description</B><BR> <BR> <TT>consult(Files)</TT> compiles and loads into memory each file of the list <TT>Files</TT>. Each file is compiled for byte-code using the GNU Prolog compiler (section <A HREF="manual008.html#The-GNU-Prolog-compiler">3.4</A>) then loaded using <TT>load/1</TT> (section <A HREF="#load/1">7.23.2</A>). It is possible to specify <TT>user</TT> as a file name to directly enter the program from the terminal. <TT>Files</TT> can be also a single file name (i.e. an atom). Refer to the section concerning the consult of a Prolog program for more information (section <A HREF="manual006.html#Consulting-a-Prolog-program">3.2.3</A>).<BR> <BR> The final file name of a file is computed using the predicates <TT>prolog_file_name/2</TT> (section <A HREF="manual049.html#prolog-file-name/2">7.26.3</A>) and <TT>absolute_file_name/2</TT> (section <A HREF="manual049.html#absolute-file-name/2">7.26.1</A>).<BR> <BR> <TT>[ File | Files ]</TT>, i.e. <TT>'.'(File, Files)</TT> is equivalent to <TT>consult([ File | Files ])</TT>.<BR> <BR> <B>Errors</B><BR> <TABLE CELLSPACING=2 CELLPADDING=0> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Files</TT> is a partial list or a list with an element <TT>E</TT> which is a variable</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Files</TT> is neither a partial list nor a list nor an atom</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>type_error(list, Files)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left>an element <TT>E</TT> of the <TT>Files</TT> list is neither a variable nor an atom</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>type_error(atom, E)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left>an element <TT>E</TT> of the <TT>Files</TT> list is an atom but not a valid pathname</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>domain_error(os_path, E)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left>an element <TT>E</TT> of the <TT>Files</TT> list is a valid pathname but does not correspond to an existing source</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>existence_error(source_sink, E)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left>an error occurs executing a directive</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left>see <TT>call/1</TT> errors (section <A HREF="manual022.html#call/1">6.2.3</A>)</TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR></TABLE><BR> <B>Portability</B><BR> <BR> GNU Prolog predicates.<BR> <BR> <A NAME="toc184"></A><TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%"> <TR><TD BGCOLOR="#98e7ff"><DIV ALIGN=center><TABLE> <TR><TD><B><A NAME="htoc229">7.23.2</A></B></TD> <TD WIDTH="100%" ALIGN=center><TT><B>load/1</B></TT></TD> </TR></TABLE></DIV></TD> </TR></TABLE> <A NAME="load/1"></A> <BR> <B>Templates</B> <DL COMPACT=compact><DT><DD><TT> load(+atom_or_atom_list)</TT></DL> <B>Description</B><BR> <BR> <TT>load(Files)</TT> loads into memory each file of the list <TT>Files</TT>. Each file must have been previously compiled for byte-code using the GNU Prolog compiler (section <A HREF="manual008.html#The-GNU-Prolog-compiler">3.4</A>). <TT>Files</TT> can be also a single file name (i.e. an atom).<BR> <BR> The final file name of a file is computed using the predicates <TT>absolute_file_name/2</TT> (section <A HREF="manual049.html#absolute-file-name/2">7.26.1</A>). If no suffix is given <TT>'.wbc'</TT> is appended to the file name.<BR> <BR> <B>Errors</B><BR> <TABLE CELLSPACING=2 CELLPADDING=0> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Files</TT> is a partial list or a list with an element <TT>E</TT> which is a variable</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Files</TT> is neither a partial list nor a list nor an atom</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>type_error(list, Files)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left>an element <TT>E</TT> of the <TT>Files</TT> list is neither a variable nor an atom</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>type_error(atom, E)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left>an element <TT>E</TT> of the <TT>Files</TT> list is an atom but not a valid pathname</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>domain_error(os_path, E)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left>an element <TT>E</TT> of the <TT>Files</TT> list is a valid pathname but does not correspond to an existing source</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>existence_error(source_sink, E)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left>an error occurs executing a directive</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left>see <TT>call/1</TT> errors (section <A HREF="manual022.html#call/1">6.2.3</A>)</TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR></TABLE><BR> <B>Portability</B><BR> <BR> GNU Prolog predicate.<BR> <BR> <A NAME="toc185"></A><TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%"> <TR><TD BGCOLOR="#98e7ff"><DIV ALIGN=center><TABLE> <TR><TD><B><A NAME="htoc230">7.23.3</A></B></TD> <TD WIDTH="100%" ALIGN=center><B><TT>listing/1</TT>, <TT>listing/0</TT></B></TD> </TR></TABLE></DIV></TD> </TR></TABLE> <A NAME="listing/1"></A> <BR> <B>Templates</B> <DL COMPACT=compact><DT><DD><TT> listing(+predicate_indicator)<BR> listing(+atom)<BR> listing</TT></DL> <B>Description</B><BR> <BR> <TT>listing(Pred)</TT> lists the clauses of the consulted predicate whose predicate indicator is <TT>Pred</TT>. <TT>Pred</TT> can also be a single atom in which case all predicates whose name is <TT>Pred</TT> are listed (of any arity). This predicate uses <TT>portray_clause/2</TT> (section <A HREF="manual037.html#portray-clause/2">7.14.8</A>) to output the clauses. <BR> <BR> <TT>listing</TT> lists all clauses of all consulted predicates.<BR> <BR> <B>Errors</B><BR> <TABLE CELLSPACING=2 CELLPADDING=0> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Pred</TT> is a variable</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR> <TR><TD VALIGN=top ALIGN=left><TT>Pred</TT> is neither a variable nor predicate indicator or an atom</TD> <TD VALIGN=top ALIGN=center NOWRAP> </TD> <TD VALIGN=top ALIGN=left><TT>type_error(predicate_indicator, Pred)</TT></TD> </TR> <TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD> </TR></TABLE><BR> <B>Portability</B><BR> <BR> GNU Prolog predicate.<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="manual045.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> <A HREF="manual023.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A> <A HREF="manual047.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> </BODY> </HTML>