Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > by-pkgid > 2fc07611b08d4a735fd34d5eb60d8e16 > files > 2118

ciao-1.10p8-3mdv2010.0.i586.rpm

<HTML>
<HEAD>
<!-- Created by texi2html 1.56k + clip patches and <A href="http://www.clip.dia.fi.upm.es/Software">lpdoc</A> from ciao.texi on 28 January 2007 -->

<LINK rel="stylesheet" href="ciao.css" type="text/css">
<TITLE>The Ciao Prolog System               - Basic builtin directives</TITLE>
</HEAD>
<BODY> 
Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_16.html">previous</A>, <A HREF="ciao_18.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>.
<P><HR><P>


<H1><A NAME="SEC132" HREF="ciao_toc.html#TOC132">Basic builtin directives</A></H1>
<P>
<A NAME="IDX1257"></A>


<P>
<STRONG>Author(s):</STRONG> Daniel Cabeza.


<P>
<STRONG>Version:</STRONG> 1.10#7 (2006/4/26, 19:22:13 CEST)


<P>
<STRONG>Version of last change:</STRONG> 1.9#29 (2002/11/20, 14:4:17 CET)


<P>
This chapter documents the basic 
<A NAME="IDX1258"></A>
builtin directives in Ciao, additional to the documented in other chapters. These 
<A NAME="IDX1259"></A>
directives are natively interpreted by the Ciao compiler (
<A NAME="IDX1260"></A>
<CODE>ciaoc</CODE>). 


<P>
Unlike in other Prolog systems, directives in Ciao are not goals to be <EM>executed</EM> by the compiler or top level. Instead, they are <EM>read</EM> and acted upon by these programs. The advantage of this is that the effect of the directives is consistent for executables, code loaded in the top level, code analyzed by the preprocessor, etc. 


<P>
As a result, by default only the builtin directives or declarations defined in this manual can be used in user programs. However, it is possible to define new declarations 
<A NAME="IDX1261"></A>
<A NAME="IDX1262"></A>
using the 
<A NAME="IDX1263"></A>
<CODE>new_declaration/1</CODE> and 
<A NAME="IDX1264"></A>
<CODE>new_declaration/2</CODE> directives (or using packages including them). Also, packages may define new directives via code translations.



<UL>
<LI><A HREF="ciao_17.html#SEC133">Usage and interface (builtin_directives)</A>
<LI><A HREF="ciao_17.html#SEC134">Documentation on internals (builtin_directives)</A>
</UL>



<H2><A NAME="SEC133" HREF="ciao_toc.html#TOC133">Usage and interface (<CODE>builtin_directives</CODE>)</A></H2>

<div class="cartouche">

<UL>

<LI><STRONG>Library usage:</STRONG>

These directives are builtin in Ciao, so nothing special has to be done to use them.
</UL>

</div class="cartouche">



<H2><A NAME="SEC134" HREF="ciao_toc.html#TOC134">Documentation on internals (<CODE>builtin_directives</CODE>)</A></H2>
<P>
<A NAME="IDX1265"></A>
<A NAME="IDX1266"></A>
<DL>
<DT><span class="define">DECLARATION:</span> <B>multifile/1:</B>
<DD><A NAME="IDX1267"></A>


<P>
<STRONG>Usage:</STRONG> :- <CODE>multifile Predicates</CODE>.
<KBD> * ISO * </KBD>

<UL>
<LI><EM>Description:</EM> Specifies that each predicate in <CODE>Predicates</CODE> may have clauses in more than one file. Each file that contains clauses for a

<A NAME="IDX1268"></A>
multifile predicate must contain a directive multifile for the predicate. The directive should precede all clauses of the affected predicates. This directive is defined as a prefix operator in the compiler. 
<LI><EM>The following properties should hold at call time:</EM>

<CODE>Predicates</CODE> is a sequence or list of <CODE>predname</CODE>s.
 (<CODE>basic_props:sequence_or_list/2</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX1269"></A>
<A NAME="IDX1270"></A>
<DL>
<DT><span class="define">DECLARATION:</span> <B>discontiguous/1:</B>
<DD><A NAME="IDX1271"></A>


<P>
<STRONG>Usage:</STRONG> :- <CODE>discontiguous Predicates</CODE>.
<KBD> * ISO * </KBD>

<UL>
<LI><EM>Description:</EM> Specifies that each predicate in <CODE>Predicates</CODE> may be defined in this file by clauses which are not in consecutive order. Otherwise, a warning is signaled by the compiler when clauses of a predicate are not consecutive (this behavior is controllable by the

<A NAME="IDX1272"></A>
prolog flag <EM>discontiguous_warnings</EM>). The directive should precede all clauses of the affected predicates. This directive is defined as a prefix operator in the compiler. 
<LI><EM>The following properties should hold at call time:</EM>

<CODE>Predicates</CODE> is a sequence or list of <CODE>predname</CODE>s.
 (<CODE>basic_props:sequence_or_list/2</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX1273"></A>
<A NAME="IDX1274"></A>
<DL>
<DT><span class="define">DECLARATION:</span> <B>impl_defined/1:</B>
<DD><A NAME="IDX1275"></A>


<P>
<STRONG>Usage:</STRONG> :- <CODE>impl_defined(Predicates)</CODE>.

<UL>
<LI><EM>Description:</EM> Specifies that each predicate in <CODE>Predicates</CODE> is <EM>impl</EM>icitly <EM>defined</EM> in the current prolog source, either because it is a builtin predicate or because it is defined in a C file. Otherwise, a warning is signaled by the compiler when an exported predicate is not defined in the module or imported from other module.

<LI><EM>The following properties should hold at call time:</EM>

<CODE>Predicates</CODE> is a sequence or list of <CODE>predname</CODE>s.
 (<CODE>basic_props:sequence_or_list/2</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX1276"></A>
<A NAME="IDX1277"></A>
<DL>
<DT><span class="define">DECLARATION:</span> <B>redefining/1:</B>
<DD><A NAME="IDX1278"></A>


<P>
<STRONG>Usage:</STRONG> :- <CODE>redefining(Predicate)</CODE>.

<UL>
<LI><EM>Description:</EM> Specifies that this module redefines predicate <CODE>Predicate</CODE>, also imported from other module, or imports it from more than one module. This prevents the compiler giving warnings about redefinitions of that predicate. <CODE>Predicate</CODE> can be partially (or totally) uninstantiated, to allow disabling those warnings for several (or all) predicates at once.

<LI><EM>The following properties should hold at call time:</EM>

<CODE>Predicate</CODE> is <EM>compatible</EM> with <CODE>predname</CODE>
 (<CODE>basic_props:compat/2</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX1279"></A>
<A NAME="IDX1280"></A>
<DL>
<DT><span class="define">DECLARATION:</span> <B>initialization/1:</B>
<DD><A NAME="IDX1281"></A>


<P>
<STRONG>Usage:</STRONG> :- <CODE>initialization(Goal)</CODE>.
<KBD> * ISO * </KBD>

<UL>
<LI><EM>Description:</EM> <CODE>Goal</CODE> will be executed at the start of the execution of any program containing the current code. The initialization of a module/file never runs before the initializations of the modules from which the module/file imports (excluding circular dependences).

<LI><EM>The following properties should hold at call time:</EM>

<CODE>Goal</CODE> is a term which represents a goal, i.e., an atom or a structure.
 (<CODE>basic_props:callable/1</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX1282"></A>
<A NAME="IDX1283"></A>
<DL>
<DT><span class="define">DECLARATION:</span> <B>on_abort/1:</B>
<DD><A NAME="IDX1284"></A>


<P>
<STRONG>Usage:</STRONG> :- <CODE>on_abort(Goal)</CODE>.

<UL>
<LI><EM>Description:</EM> <CODE>Goal</CODE> will be executed after an abort of the execution of any program containing the current code.

<LI><EM>The following properties should hold at call time:</EM>

<CODE>Goal</CODE> is a term which represents a goal, i.e., an atom or a structure.
 (<CODE>basic_props:callable/1</CODE>)
</UL>

</DL>

<P><HR><P>
Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_16.html">previous</A>, <A HREF="ciao_18.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>.
</BODY>
</HTML>