@ciao-lang/ts-ciao-interface
Version:
Simple Ciao interface for node.
11 lines • 4.25 kB
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>Conditional compilation — 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">☰</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="BasicLang.html">↑</a><a class="lpdoc-navbutton" href="packages.html">←</a><a class="lpdoc-navbutton" href="basiccontrol.html">→</a><a class="lpdoc-navbutton" href="ciaosearch.html">🔍</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> »<br/> </li><li><a href="BasicLang.html">PART II - The Ciao basic language</a> »<br/> </li><li><a href=""><strong>Conditional compilation</strong></a></li></ul><hr></hr><em>ON THIS PAGE</em><ul><li><a href="#Conditions">Conditions</a></li><li><a href="#Usage and interface">Usage and interface</a></li></ul></div><div class="lpdoc-main"><div id=""><h1>Conditional compilation</h1><a class="lpdoc-idx-anchor" href="ciaosearch.html#condcomp"></a>
<strong>Author(s):</strong> <a class="lpdoc-idx-anchor" id="Jose F. Morales" href="ciaosearch.html#Jose F. Morales">Jose F. Morales</a>.<p>
This package defines a series of directives for conditional compilation that allow the inclusion or exclusion of code blocks (which may contain nested conditional directives) based on the truth value at compile time of special goals called <em>conditions</em>. The syntax for conditional directives is:<p><pre class="lpdoc-codeblock">:- if(Cond1).
<<Block1>>
:- elif(Cond2).
<<Block2>>
:- else.
<<BlockN>>
:- endif.
</pre> <p>where <tt>elif(_)</tt> can appear zero or more times and the <tt>else</tt> part is optional. The sentences in <tt>Block1</tt> are included if the condition in <tt>Cond1</tt> is satisfied, else <tt>Block2</tt> is included if <tt>Cond2</tt> is satisfied (and so on for each <tt>elif</tt>), and <tt>BlockN</tt> if no previous condition is satisfied.<p><div id="Conditions"><h2>Conditions</h2> <p>The valid conditions are restricted to a subset of goals that can be safely evaluated at compile time. At this moment, only the following ones are accepted:<p><ul> <li>Compile-time values of prolog flags (<tt>current_prolog_flag/2</tt>). <li>Conjunctions, disjunctions, or negations of conditions. <li>Calls to facts previously defined with <tt>:- compilation_fact(Fact)</tt>. This is an experimental feature that may change in the future. <li><tt>defined(F/N)</tt> (or <tt>defined(F)</tt>, equivalent to <tt>defined(F/0)</tt>), which succeeds only if there is a definition for the compilation fact <tt>F/N</tt>. </ul> </div><br/><div id="Usage and interface"><h2>Usage and interface</h2><div class="lpdoc-cartouche"><ul><li><strong>Library usage:</strong><br/>This module is imported by default (unless the <a class="lpdoc-idx-anchor" id="0" href="noprelude_doc.html"><tt>noprelude</tt></a> or <a class="lpdoc-idx-anchor" id="1" href="pure_doc.html"><tt>pure</tt></a> packages are used). <li><strong>Implicit imports:</strong><br/><ul class="lpdoc-itemize-minus"><li><em>Packages:</em><br/><a class="lpdoc-idx-anchor" id="2" href="ciaosearch.html#prelude"><tt>prelude</tt></a>, <a class="lpdoc-idx-anchor" id="3" href="ciaosearch.html#initial"><tt>initial</tt></a>, <a class="lpdoc-idx-anchor" id="4" href="assertions_doc.html"><tt>assertions</tt></a>, <a class="lpdoc-idx-anchor" id="5" href="ciaosearch.html#assertions/assertions_basic"><tt>assertions/assertions_basic</tt></a>.
</ul></ul></div></div></div><div class="lpdoc-footer">Generated with LPdoc using Ciao</div></div><div class="lpdoc-clearer"></div></div></body></html>