

<!DOCTYPE html>
<!-- Server: sfs-forge-5 -->


    

















<html lang="en" class="no-js">
<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
    <title>
  XSB / Src  (SVN)-old /
  [r2712]
  /trunk/XSB/docs/userman/system.tex
</title>
    

<meta name="viewport" content="width=1100">


<link rel="icon" sizes="180x180" href="https://a.fsdn.com/con/img/sandiego/logo-180x180.png" type="image/png">
<link rel="icon" sizes="any" href="https://a.fsdn.com/con/img/sandiego/svg/originals/sf-icon-orange-no_sf.svg" type="image/svg+xml">
<link rel="apple-touch-icon" sizes="180x180" href="https://a.fsdn.com/con/img/sandiego/logo-180x180.png">
<link rel="mask-icon" href="https://a.fsdn.com/con/img/sandiego/svg/originals/sf-icon-orange-no_sf.svg" color="#FF6600">


<script src="https://a.fsdn.com/allura/nf/1752697225/_ew_/theme/sftheme/js/sftheme/cmp2.js"></script>






    
    
    
    
    
    
    
    
    <link rel="stylesheet" href="https://a.fsdn.com/con/css/lato.css?">


<script>
if (!window.SF) { window.SF = {}; }
SF.sandiego = false;
SF.sandiego_chrome = true;
SF.cdn = "https://a.fsdn.com/con";
SF.fpid = '8a9d54e8-fd85-47ad-b637-84da1a7a1cf5';
SF.billboard_route = '/software/product/$slug/';
</script>
    
        <!-- ew:head_css -->

    
        <link rel="stylesheet"
                type="text/css"
                href="https://a.fsdn.com/allura/nf/1752697225/_ew_/_slim/css?href=allura%2Fcss%2Fforge%2Fhilite.css%3Ballura%2Fcss%2Fforge%2Ftooltipster.css"
                >
    
        <link rel="stylesheet"
                type="text/css"
                href="https://a.fsdn.com/allura/nf/1752697225/_ew_/allura/css/font-awesome.min.css"
                >
    
        <link rel="stylesheet"
                type="text/css"
                href="https://a.fsdn.com/allura/nf/1752697225/_ew_/theme/sftheme/css/forge.css"
                >
    
        
<!-- /ew:head_css -->

    
    
        <!-- ew:head_js -->

    
        <script type="text/javascript" src="https://a.fsdn.com/allura/nf/1752697225/_ew_/_slim/js?href=allura%2Fjs%2Fjquery-3.6.0.min.js%3Ballura%2Fjs%2Fjquery.cookie-1.4.1.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fshared_head.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Ftypescript%2Fcompliance.js"></script>
    
        
<!-- /ew:head_js -->

    

    
        <style type="text/css">
            /* make URL &amp; Project custom fields in support tickets not get hidden as much */
.project-forge.mountpoint-site-support .view_holder .grid-4:nth-child(5),
.project-forge.mountpoint-site-support .view_holder .grid-4:nth-child(6) {
  overflow: visible;
  font-size: 22px;
  width: 340px;
  line-height: 1;
  margin-bottom: 5px;
}
.project-forge.mountpoint-site-support .view_holder .grid-4:nth-child(5) label, .project-forge.mountpoint-site-support .view_holder .grid-4:nth-child(6) label {
  font-size: 14px;
}
        </style>
    
    
    <link rel="alternate" type="application/rss+xml" title="RSS" href="/p/xsb/src/feed.rss"/>
    <link rel="alternate" type="application/atom+xml" title="Atom" href="/p/xsb/src/feed.atom"/>
    <style type="text/css">
        #access_urls .btn-set {
            
            min-width: 14em;
        }
    </style>

    <style>.XwcwokwoSMOawjDpsOwVVTDtsOTwvCiBDvkY {
        display: none
    }</style>

    
    
    
        <link rel="canonical" href="https://sourceforge.net/p/xsb/src/2712/tree/trunk/XSB/docs/userman/system.tex" />
    


    

<script>
    var data = {hem: null };
    bizx.uids.gatherAndClean(data);
</script>



<script>
    function initPiwik(){
      var _paq = window._paq = window._paq || [];
      _paq.push(['trackPageView', document.title, {
            dimension1: 'xsb',
            dimension2: 'svn'
      }]);
      _paq.push(['enableLinkTracking']);
      
          _paq.push(['enableHeartBeatTimer']);
      
      (function() {
        var u="//analytics.slashdotmedia.com/";
        _paq.push(['setTrackerUrl', u+'sf.php']);
        _paq.push(['setSiteId', 39]);
        
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
        g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'sf.js'; s.parentNode.insertBefore(g,s);
      })();
    }
    bizx.cmp.ifConsent({ purposes: ['storage', 'measurement'], vendors: 'sdm'}, initPiwik);
</script>






<!-- Hubspot tracking -->






 <script>
    $(function() {
        bizx.cmp.ifConsent({ purposes: 'all' , vendors: 'narrative'}, function() {
            var current_time = (new Date()).getTime();
            let imageUrl = "https://io.narrative.io/?companyId=2440&id=first_party%3A8a9d54e8-fd85-47ad-b637-84da1a7a1cf5&id=site_name%3Asourceforge.net&id=url%3A%2Fp%2Fxsb%2Fsrc%2F2712%2Ftree%2Ftrunk%2FXSB%2Fdocs%2Fuserman%2Fsystem.tex&id=pagetitle%3A%24PAGE_TITLE&id=vertical%3AOpen+Source+Software&id=product%3AXSB";
            imageUrl = imageUrl.replace(encodeURIComponent("$PAGE_TITLE"), document.title);  

            imageUrl = URL.parse(imageUrl);
            let hem = bizx.uids.getHem();
            if (hem) {
                imageUrl.searchParams.append('id', 'hem:' + hem);
            }
            imageUrl.searchParams.append('rand', current_time);

            var image = new Image();
            image.src = imageUrl.toString();
            image.style.display = "none";
            image.style.height = 0;
            image.style.width = 0;
            document.body.appendChild(image);
        });
    });
</script>



</head>

<body class="
body_class sandiego_chrome  legacy_chrome  l-allow-natural-width 
" id="forge">

    
        <!-- ew:body_top_js -->

    
        
<!-- /ew:body_top_js -->

    





<div class="off-canvas position-right" id="offCanvas" data-off-canvas>
    <!-- Menu -->
    <ul class="header-nav-menulist">
        <li class="highlight search">
            
            
                
            
            
    <form method="get" action="/directory/" class="m-search-form">
    
        <input type="text" placeholder="Search for software or solutions" autocomplete="off" name="q" >
        
        <label >
            <input type="submit" class="bt" value="">
            


<svg  data-name="search" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1216 832q0-185-131.5-316.5t-316.5-131.5-316.5 131.5-131.5 316.5 131.5 316.5 316.5 131.5 316.5-131.5 131.5-316.5zm512 832q0 52-38 90t-90 38q-54 0-90-38l-343-342q-179 124-399 124-143 0-273.5-55.5t-225-150-150-225-55.5-273.5 55.5-273.5 150-225 225-150 273.5-55.5 273.5 55.5 225 150 150 225 55.5 273.5q0 220-124 399l343 343q37 37 37 90z"/></svg>
        </label>
    </form>
        </li>
        
        <li class="highlight"><a href="/auth/">Join/Login</a></li>
        
        <li><a href="/software/">Business Software</a></li>
        <li><a href="/directory/">Open Source Software</a></li>
        <li><a  href="/software/vendors/" title="For Vendors">For Vendors</a></li>
        <li><a href="/blog/" title="Blog">Blog</a></li>
        <li><a href="/about">About</a></li>
        <li><a id="header-nav-more" data-toggle="header-nav-more header-nav-more-content" data-toggler=".toggled">More</a></li>
        <li>
            <ul id="header-nav-more-content" class="toggled" data-toggler=".toggled">
                
    

    
    
        <li><a href="/articles/">Articles</a></li>
    
    

    
 
                
                <li><a href="/create">Create</a></li>
                
                <li><a href="https://sourceforge.net/articles/category/sourceforge-podcast/">SourceForge Podcast</a></li>
                
                    <li><a href="https://sourceforge.net/p/forge/documentation/Docs%20Home/">Site Documentation</a></li>
                
                <li><a href="/user/newsletters">Subscribe to our Newsletter</a></li>
                <li><a href="/support">Support Request</a></li>
            </ul>
        </li>
    </ul>
</div>
<div class="off-canvas-content" data-off-canvas-content>

    




<script>
    SF.linkout_icon = '<svg  data-name="sf-linkout-icon" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 300 300" style="enable-background:new 0 0 300 300;" xml:space="preserve"><polygon class="st0" points="243.2,243.2 56.8,243.2 56.8,56.8 123,56.8 123,9 9,9 9,291 291,291 291,179.4 243.2,179 "/><polygon class="st0" points="128.5,213 155,186.5 176,165.5 206.7,196.3 235.5,132.5 248.9,102.6 290.6,9.8 291,9 290.6,9.2 197.4,51.1 169.1,63.8 103.7,93.3 137,126.5 115.9,147.5 89.5,174 "/></svg>';
</script>


<div class="l-header-nav  sandiego">

    <section class="sandiego l-header-nav-top show-for-large">
        <div class="row">
            <a href="/" title="Home" class="sf-logo">
                
    
    <img src="https://a.fsdn.com/con/images/sandiego/sf-logo-full.svg"  alt="SourceForge logo" class="sf-logo-full"/>
            </a>
            <nav class="links">
                
                    <a href="/user/newsletters" title="Subscribe to our newsletter"><span class="newsletter-icon">


<svg  data-name="mmSF_11mail" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 42 42" enable-background="new 0 0 42 42" xml:space="preserve"><path fill="#FFFFFF" d="M0,6v30h42V6H0z M24.2,21.2c-0.8,0.8-2.3,2-3.2,2c-0.9,0-2.4-1.2-3.2-2L5.8,9.7h30.3L24.2,21.2z M13.7,21l-9.9,9.4V11.6L13.7,21z M15.7,23L15.7,23c0.5,0.5,2.9,2.9,5.3,2.9c2.4,0,4.8-2.4,5.2-2.8l0.1-0.1l9.8,9.4H5.8L15.7,23z M28.3,21l9.9-9.5v18.9L28.3,21z"/></svg></span></a>
                
                <a href="/software/vendors/" title="For Vendors">For Vendors</a>
                
                
                    <a href="/support" title="Help">Help</a>
                    <a href="/create/" title="Create">Create</a>
                

                
                <a href="/user/registration" title="Join" >Join</a>
                <a href="/auth/" title="Login">Login</a>
                
            </nav>
        </div>
    </section>

    <section class="sandiego l-header-nav-top hide-for-large">
        <div class="row">
            <a href="/" title="Home" class="sf-logo">
                
    
    <img src="https://a.fsdn.com/con/images/sandiego/sf-logo-full.svg"  alt="SourceForge logo" class="sf-logo-full"/>
            </a>
            <div class="title-bar-right">
                <button type="button" aria-label="Toggle Main Menu" class="menu-icon" data-toggle="offCanvas"></button>
            </div>
        </div>
    </section>
    <section class="sandiego l-header-nav-bottom">
        <nav class="row">
            <a href="/" title="Home" class="sf-logo">
                
    
    <img src="https://a.fsdn.com/con/images/sandiego/sf-logo-full.svg"  alt="SourceForge logo" class="sf-logo-full"/>
            </a>
            <div class="links">
                
    
        <div class="nav-dropdown">
            <a href="/software/">Business Software</a>
            
        </div>
        <div class="nav-dropdown">
            <a href="/directory/" title="Browse">Open Source Software</a>
            
        </div>
        <div class="nav-dropdown">
            <a href="https://sourceforge.net/articles/category/sourceforge-podcast/">SourceForge Podcast</a>
        </div>
        <div class="nav-dropdown">
            <a>Resources</a>
            <ul class="nav-dropdown-menu">
                  <li><a href="/articles/">Articles</a></li>
                  
                  <li><a href="/software/case-studies/">Case Studies</a></li>
                  
                  <li><a href="/blog/">Blog</a></li>
            </ul>
        </div>
    

                <div class="dev-menu-when-stuck">
                    Menu
                    <ul class="dev-menu-dropdown header-nav-menulist">
                        <li><a href="/support">Help</a></li>
                        <li><a href="/create">Create</a></li>
                        <li><a href="/user/registration/" title="Join" >Join</a></li>
                        <li><a href="/auth/" title="Login">Login</a></li>
                    </ul>
                </div>
                <div class="search-toggle-when-stuck">
                    <a class="search-toggle">
                        


<svg  data-name="search" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1216 832q0-185-131.5-316.5t-316.5-131.5-316.5 131.5-131.5 316.5 131.5 316.5 316.5 131.5 316.5-131.5 131.5-316.5zm512 832q0 52-38 90t-90 38q-54 0-90-38l-343-342q-179 124-399 124-143 0-273.5-55.5t-225-150-150-225-55.5-273.5 55.5-273.5 150-225 225-150 273.5-55.5 273.5 55.5 225 150 150 225 55.5 273.5q0 220-124 399l343 343q37 37 37 90z"/></svg>
                    </a>
                </div>
            </div>

            <div class="search">
                
                
    
    
        <div class="main-nav-link">
            
            
            <a href="https://www.avast.com/lp-free-av?full_trSrc=mmm_srf_dlp_008_406_a&amp;utm_medium=referral&amp;utm_source=sourceforge&amp;utm_campaign=srf_dlp_008_406_a:site_banner" rel="nofollow" target="_blank" id="main-nav-badge-link" data-label="avastjuly">
                <img src="https://a.fsdn.com/con/assets/maxnav/sourceforge/ai-protection-32-75dd98b2.png"  srcset="https://a.fsdn.com/con/assets/maxnav/sourceforge/ai-protection-75de80f6.png 2x"  alt="" id="main-nav-image"/>
            </a>
        </div>
    


                
                    
                
                
                
                
    <form method="get" action="/directory/" class="m-search-form">
    
    <div class="typeahead__container">
      <div class="typeahead__field">
        <div class="typeahead__query">
        
        <input type="text" placeholder="Search for software or solutions" autocomplete="off" name="q" >
        
        </div>
        
        <label >
            <input type="submit" class="bt" value="">
            


<svg  data-name="search" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1216 832q0-185-131.5-316.5t-316.5-131.5-316.5 131.5-131.5 316.5 131.5 316.5 316.5 131.5 316.5-131.5 131.5-316.5zm512 832q0 52-38 90t-90 38q-54 0-90-38l-343-342q-179 124-399 124-143 0-273.5-55.5t-225-150-150-225-55.5-273.5 55.5-273.5 150-225 225-150 273.5-55.5 273.5 55.5 225 150 150 225 55.5 273.5q0 220-124 399l343 343q37 37 37 90z"/></svg>
        </label>
      </div>
    </div>
    
    </form>
                
            </div>
        </nav>
        
    </section>
    
</div>
    
    
    <div class="notification-on-project-page">
    
        
    
    
    
    </div>
    
    


    <section id="page-body" class=" neighborhood-Projects project-xsb mountpoint-src 

">
        <div id="nav_menu_holder">
            
                
                    
    <div class="sandiego"> 
            
            
            
            
<section class="project-masthead"> 
    
    

    
<div class="backdrop" style="box-sizing: content-box; padding-bottom: 24px"></div>

    <div class="content">
    
        
    <nav id="breadcrumbs" class="breadcrumbs rtl">
        <ul itemscope itemtype="http://schema.org/BreadcrumbList">
            <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
                <a itemprop="item" href="/"><span itemprop="name">Home</span></a>
                <meta itemprop="position" content="1"/>
            </li>
            <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
                <a itemprop="item" href="/directory/"><span itemprop="name">Browse</span></a>
                <meta itemprop="position" content="2"/>
            </li>
            
            
                
                
            
            
                
            
            
                <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
                    <a itemprop="item" href="/p/xsb/"><span itemprop="name">XSB</span></a>
                <meta itemprop="position" content="3"/>
                </li>
            
                <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
                    <span itemprop="name">Src  (SVN)-old</span>
                <meta itemprop="position" content="4"/>
                </li>
            
        </ul>
    </nav>
    
    
    
        
                
                
<div class="overview">
    


<div class="project-icon   " >
    
    
    <img itemprop="image" alt="XSB" title="XSB" 
    
    
    src="https://a.fsdn.com/allura/p/xsb/icon?1368563712"
    /></div>


    
    <div class="title "> 

        <meta itemprop="name" content="XSB"/>
        <h1  >XSB Src  (SVN)-old
        </h1>
        
            
            
          
        
            
            
            <div class="as-h3 brought-by">
                
                Brought to you by:
                
                    <a href="/u/carlandersen/profile/">carlandersen</a>,
                    
                
                    <a href="/u/dwarren/profile/">dwarren</a>,
                    
                
                    <a href="/u/evansbj/profile/">evansbj</a>,
                    
                
                    <a href="/u/kifer/profile/">kifer</a>,
                    
                
                    
                        and <a href="/p/xsb/_members/">3 others</a>
                    
                
            </div>
            
        

        

        
    </div>


    

</div>

                
                
    
  
            
            
        
    </div>
</section>

        </div>
    

                
            
        </div>
        <div id="top_nav" class="">
            
                
<div id="top_nav_admin">
<ul class="dropdown">
  
  
    <li class="">
        <a href="/projects/xsb/" class="tool-summary-32" >
            Summary
        </a>
        
        
    </li>
  
    <li class="">
        <a href="/projects/xsb/files/" class="tool-files-sf-32" >
            Files
        </a>
        
        
    </li>
  
    <li class="">
        <a href="/projects/xsb/reviews/" class="tool-reviews-32" >
            Reviews
        </a>
        
        
    </li>
  
    <li class="">
        <a href="/projects/xsb/support" class="tool-support-32" >
            Support
        </a>
        
        
    </li>
  
    <li class="">
        <a href="/p/xsb/mailman/" class="tool-mailman-32" >
            Mail Lists
        </a>
        
        
    </li>
  
    <li class="">
        <a href="/p/xsb/_list/tickets" class="tool-tickets-32" >
            Tickets ▾
        </a>
        
        
            <ul>
                
                    <li class=""><a href="/p/xsb/bugs/" >Bugs</a></li>
                
                    <li class=""><a href="/p/xsb/feature-requests/" >Feature Requests</a></li>
                
                    <li class=""><a href="/p/xsb/support-requests/" >Support Requests</a></li>
                
                    <li class=""><a href="/p/xsb/patches/" >Patches</a></li>
                
            </ul>
        
    </li>
  
    <li class="">
        <a href="/p/xsb/news/" class="tool-blog-32" >
            News
        </a>
        
        
    </li>
  
    <li class="">
        <a href="/p/xsb/code/" class="tool-git-32" >
            Sources (GIT)
        </a>
        
        
    </li>
  
    <li class="selected">
        <a href="/p/xsb/src/" class="tool-svn-32" >
            Src  (SVN)-old
        </a>
        
        
    </li>
  
  
</ul>
</div>


            
        </div>
        <div id="content_base">
            

    
                
                    
<a id="sidebar-activate" href="#">
    <span class="btn-label">Menu</span>
    <span class="btn-arrow-down">▾</span>
    <span class="btn-arrow-up">▴</span>
</a>

                        


<div id="sidebar">
  
    <div class="placeholder-no-searchbox">&nbsp;</div>
  
    
    
      
      
        
    
      <ul class="sidebarmenu">
      
    
  <li>
      
        <a class="icon" href="/p/xsb/src/commit_browser" rel="nofollow" title="Browse Commits"><i class="fa fa-list"></i>
      
      <span>Browse Commits</span>
      </a>
  </li>
  
      
        
    
  <li>
      
        <a href="/p/xsb/src/"  rel="nofollow" >
      
      <span>Browse Files</span>
      </a>
  </li>
  
      
    
    
      </ul>
      
    
    
</div>



<script>
$('#sidebar-admin-header').on('click', function(e){
    $("#sidebar-admin-menu").toggleClass("hidden");
    $(this).toggleClass("expanded");
    e.preventDefault();
});
</script>

                    

                    
                
                
                    
                
                <div class="grid-20 pad">
                    <h2 class="dark title">
                        <span>
<a href="/p/xsb/src/2712/" rel="nofollow">[r2712]</a>:

  
      <a href="./../../../../" rel="nofollow"><b class="fa fa-folder-open-o" title="Root directory"></b></a> /
  
  
    <a href="./../../../" rel="nofollow">trunk</a> /
  
    <a href="./../../" rel="nofollow">XSB</a> /
  
    <a href="./../" rel="nofollow">docs</a> /
  
    <a href="./" rel="nofollow">userman</a> /
  
 system.tex
</span>
                        <!-- actions -->
                        <small>
                            

    
    <a class="icon" href="#" id="maximize-content" title="Maximize"><i class="fa fa-expand"></i>&nbsp;Maximize</a>
    <a class="icon" href="#" id="restore-content" title="Restore"><i class="fa fa-compress"></i>&nbsp;Restore</a>
<a class="icon" href="/p/xsb/src/2712/log/?path=/trunk/XSB/docs/userman/system.tex" rel="nofollow" title="History"><i class="fa fa-calendar"></i>&nbsp;History</a>

                        </small>
                        <!-- /actions -->
                    </h2>
                    
                    <div>
                        
  

                        
  
    <p><a rel="nofollow" href="?format=raw">Download this file</a></p>
    <div class="clip grid-19 codebrowser">
      <h3>
        1676 lines (1487 with data), 75.8 kB
      </h3>
      
        <div class="codehilite"><table class="codehilitetable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">   1</span>
<span class="normal">   2</span>
<span class="normal">   3</span>
<span class="normal">   4</span>
<span class="normal">   5</span>
<span class="normal">   6</span>
<span class="normal">   7</span>
<span class="normal">   8</span>
<span class="normal">   9</span>
<span class="normal">  10</span>
<span class="normal">  11</span>
<span class="normal">  12</span>
<span class="normal">  13</span>
<span class="normal">  14</span>
<span class="normal">  15</span>
<span class="normal">  16</span>
<span class="normal">  17</span>
<span class="normal">  18</span>
<span class="normal">  19</span>
<span class="normal">  20</span>
<span class="normal">  21</span>
<span class="normal">  22</span>
<span class="normal">  23</span>
<span class="normal">  24</span>
<span class="normal">  25</span>
<span class="normal">  26</span>
<span class="normal">  27</span>
<span class="normal">  28</span>
<span class="normal">  29</span>
<span class="normal">  30</span>
<span class="normal">  31</span>
<span class="normal">  32</span>
<span class="normal">  33</span>
<span class="normal">  34</span>
<span class="normal">  35</span>
<span class="normal">  36</span>
<span class="normal">  37</span>
<span class="normal">  38</span>
<span class="normal">  39</span>
<span class="normal">  40</span>
<span class="normal">  41</span>
<span class="normal">  42</span>
<span class="normal">  43</span>
<span class="normal">  44</span>
<span class="normal">  45</span>
<span class="normal">  46</span>
<span class="normal">  47</span>
<span class="normal">  48</span>
<span class="normal">  49</span>
<span class="normal">  50</span>
<span class="normal">  51</span>
<span class="normal">  52</span>
<span class="normal">  53</span>
<span class="normal">  54</span>
<span class="normal">  55</span>
<span class="normal">  56</span>
<span class="normal">  57</span>
<span class="normal">  58</span>
<span class="normal">  59</span>
<span class="normal">  60</span>
<span class="normal">  61</span>
<span class="normal">  62</span>
<span class="normal">  63</span>
<span class="normal">  64</span>
<span class="normal">  65</span>
<span class="normal">  66</span>
<span class="normal">  67</span>
<span class="normal">  68</span>
<span class="normal">  69</span>
<span class="normal">  70</span>
<span class="normal">  71</span>
<span class="normal">  72</span>
<span class="normal">  73</span>
<span class="normal">  74</span>
<span class="normal">  75</span>
<span class="normal">  76</span>
<span class="normal">  77</span>
<span class="normal">  78</span>
<span class="normal">  79</span>
<span class="normal">  80</span>
<span class="normal">  81</span>
<span class="normal">  82</span>
<span class="normal">  83</span>
<span class="normal">  84</span>
<span class="normal">  85</span>
<span class="normal">  86</span>
<span class="normal">  87</span>
<span class="normal">  88</span>
<span class="normal">  89</span>
<span class="normal">  90</span>
<span class="normal">  91</span>
<span class="normal">  92</span>
<span class="normal">  93</span>
<span class="normal">  94</span>
<span class="normal">  95</span>
<span class="normal">  96</span>
<span class="normal">  97</span>
<span class="normal">  98</span>
<span class="normal">  99</span>
<span class="normal"> 100</span>
<span class="normal"> 101</span>
<span class="normal"> 102</span>
<span class="normal"> 103</span>
<span class="normal"> 104</span>
<span class="normal"> 105</span>
<span class="normal"> 106</span>
<span class="normal"> 107</span>
<span class="normal"> 108</span>
<span class="normal"> 109</span>
<span class="normal"> 110</span>
<span class="normal"> 111</span>
<span class="normal"> 112</span>
<span class="normal"> 113</span>
<span class="normal"> 114</span>
<span class="normal"> 115</span>
<span class="normal"> 116</span>
<span class="normal"> 117</span>
<span class="normal"> 118</span>
<span class="normal"> 119</span>
<span class="normal"> 120</span>
<span class="normal"> 121</span>
<span class="normal"> 122</span>
<span class="normal"> 123</span>
<span class="normal"> 124</span>
<span class="normal"> 125</span>
<span class="normal"> 126</span>
<span class="normal"> 127</span>
<span class="normal"> 128</span>
<span class="normal"> 129</span>
<span class="normal"> 130</span>
<span class="normal"> 131</span>
<span class="normal"> 132</span>
<span class="normal"> 133</span>
<span class="normal"> 134</span>
<span class="normal"> 135</span>
<span class="normal"> 136</span>
<span class="normal"> 137</span>
<span class="normal"> 138</span>
<span class="normal"> 139</span>
<span class="normal"> 140</span>
<span class="normal"> 141</span>
<span class="normal"> 142</span>
<span class="normal"> 143</span>
<span class="normal"> 144</span>
<span class="normal"> 145</span>
<span class="normal"> 146</span>
<span class="normal"> 147</span>
<span class="normal"> 148</span>
<span class="normal"> 149</span>
<span class="normal"> 150</span>
<span class="normal"> 151</span>
<span class="normal"> 152</span>
<span class="normal"> 153</span>
<span class="normal"> 154</span>
<span class="normal"> 155</span>
<span class="normal"> 156</span>
<span class="normal"> 157</span>
<span class="normal"> 158</span>
<span class="normal"> 159</span>
<span class="normal"> 160</span>
<span class="normal"> 161</span>
<span class="normal"> 162</span>
<span class="normal"> 163</span>
<span class="normal"> 164</span>
<span class="normal"> 165</span>
<span class="normal"> 166</span>
<span class="normal"> 167</span>
<span class="normal"> 168</span>
<span class="normal"> 169</span>
<span class="normal"> 170</span>
<span class="normal"> 171</span>
<span class="normal"> 172</span>
<span class="normal"> 173</span>
<span class="normal"> 174</span>
<span class="normal"> 175</span>
<span class="normal"> 176</span>
<span class="normal"> 177</span>
<span class="normal"> 178</span>
<span class="normal"> 179</span>
<span class="normal"> 180</span>
<span class="normal"> 181</span>
<span class="normal"> 182</span>
<span class="normal"> 183</span>
<span class="normal"> 184</span>
<span class="normal"> 185</span>
<span class="normal"> 186</span>
<span class="normal"> 187</span>
<span class="normal"> 188</span>
<span class="normal"> 189</span>
<span class="normal"> 190</span>
<span class="normal"> 191</span>
<span class="normal"> 192</span>
<span class="normal"> 193</span>
<span class="normal"> 194</span>
<span class="normal"> 195</span>
<span class="normal"> 196</span>
<span class="normal"> 197</span>
<span class="normal"> 198</span>
<span class="normal"> 199</span>
<span class="normal"> 200</span>
<span class="normal"> 201</span>
<span class="normal"> 202</span>
<span class="normal"> 203</span>
<span class="normal"> 204</span>
<span class="normal"> 205</span>
<span class="normal"> 206</span>
<span class="normal"> 207</span>
<span class="normal"> 208</span>
<span class="normal"> 209</span>
<span class="normal"> 210</span>
<span class="normal"> 211</span>
<span class="normal"> 212</span>
<span class="normal"> 213</span>
<span class="normal"> 214</span>
<span class="normal"> 215</span>
<span class="normal"> 216</span>
<span class="normal"> 217</span>
<span class="normal"> 218</span>
<span class="normal"> 219</span>
<span class="normal"> 220</span>
<span class="normal"> 221</span>
<span class="normal"> 222</span>
<span class="normal"> 223</span>
<span class="normal"> 224</span>
<span class="normal"> 225</span>
<span class="normal"> 226</span>
<span class="normal"> 227</span>
<span class="normal"> 228</span>
<span class="normal"> 229</span>
<span class="normal"> 230</span>
<span class="normal"> 231</span>
<span class="normal"> 232</span>
<span class="normal"> 233</span>
<span class="normal"> 234</span>
<span class="normal"> 235</span>
<span class="normal"> 236</span>
<span class="normal"> 237</span>
<span class="normal"> 238</span>
<span class="normal"> 239</span>
<span class="normal"> 240</span>
<span class="normal"> 241</span>
<span class="normal"> 242</span>
<span class="normal"> 243</span>
<span class="normal"> 244</span>
<span class="normal"> 245</span>
<span class="normal"> 246</span>
<span class="normal"> 247</span>
<span class="normal"> 248</span>
<span class="normal"> 249</span>
<span class="normal"> 250</span>
<span class="normal"> 251</span>
<span class="normal"> 252</span>
<span class="normal"> 253</span>
<span class="normal"> 254</span>
<span class="normal"> 255</span>
<span class="normal"> 256</span>
<span class="normal"> 257</span>
<span class="normal"> 258</span>
<span class="normal"> 259</span>
<span class="normal"> 260</span>
<span class="normal"> 261</span>
<span class="normal"> 262</span>
<span class="normal"> 263</span>
<span class="normal"> 264</span>
<span class="normal"> 265</span>
<span class="normal"> 266</span>
<span class="normal"> 267</span>
<span class="normal"> 268</span>
<span class="normal"> 269</span>
<span class="normal"> 270</span>
<span class="normal"> 271</span>
<span class="normal"> 272</span>
<span class="normal"> 273</span>
<span class="normal"> 274</span>
<span class="normal"> 275</span>
<span class="normal"> 276</span>
<span class="normal"> 277</span>
<span class="normal"> 278</span>
<span class="normal"> 279</span>
<span class="normal"> 280</span>
<span class="normal"> 281</span>
<span class="normal"> 282</span>
<span class="normal"> 283</span>
<span class="normal"> 284</span>
<span class="normal"> 285</span>
<span class="normal"> 286</span>
<span class="normal"> 287</span>
<span class="normal"> 288</span>
<span class="normal"> 289</span>
<span class="normal"> 290</span>
<span class="normal"> 291</span>
<span class="normal"> 292</span>
<span class="normal"> 293</span>
<span class="normal"> 294</span>
<span class="normal"> 295</span>
<span class="normal"> 296</span>
<span class="normal"> 297</span>
<span class="normal"> 298</span>
<span class="normal"> 299</span>
<span class="normal"> 300</span>
<span class="normal"> 301</span>
<span class="normal"> 302</span>
<span class="normal"> 303</span>
<span class="normal"> 304</span>
<span class="normal"> 305</span>
<span class="normal"> 306</span>
<span class="normal"> 307</span>
<span class="normal"> 308</span>
<span class="normal"> 309</span>
<span class="normal"> 310</span>
<span class="normal"> 311</span>
<span class="normal"> 312</span>
<span class="normal"> 313</span>
<span class="normal"> 314</span>
<span class="normal"> 315</span>
<span class="normal"> 316</span>
<span class="normal"> 317</span>
<span class="normal"> 318</span>
<span class="normal"> 319</span>
<span class="normal"> 320</span>
<span class="normal"> 321</span>
<span class="normal"> 322</span>
<span class="normal"> 323</span>
<span class="normal"> 324</span>
<span class="normal"> 325</span>
<span class="normal"> 326</span>
<span class="normal"> 327</span>
<span class="normal"> 328</span>
<span class="normal"> 329</span>
<span class="normal"> 330</span>
<span class="normal"> 331</span>
<span class="normal"> 332</span>
<span class="normal"> 333</span>
<span class="normal"> 334</span>
<span class="normal"> 335</span>
<span class="normal"> 336</span>
<span class="normal"> 337</span>
<span class="normal"> 338</span>
<span class="normal"> 339</span>
<span class="normal"> 340</span>
<span class="normal"> 341</span>
<span class="normal"> 342</span>
<span class="normal"> 343</span>
<span class="normal"> 344</span>
<span class="normal"> 345</span>
<span class="normal"> 346</span>
<span class="normal"> 347</span>
<span class="normal"> 348</span>
<span class="normal"> 349</span>
<span class="normal"> 350</span>
<span class="normal"> 351</span>
<span class="normal"> 352</span>
<span class="normal"> 353</span>
<span class="normal"> 354</span>
<span class="normal"> 355</span>
<span class="normal"> 356</span>
<span class="normal"> 357</span>
<span class="normal"> 358</span>
<span class="normal"> 359</span>
<span class="normal"> 360</span>
<span class="normal"> 361</span>
<span class="normal"> 362</span>
<span class="normal"> 363</span>
<span class="normal"> 364</span>
<span class="normal"> 365</span>
<span class="normal"> 366</span>
<span class="normal"> 367</span>
<span class="normal"> 368</span>
<span class="normal"> 369</span>
<span class="normal"> 370</span>
<span class="normal"> 371</span>
<span class="normal"> 372</span>
<span class="normal"> 373</span>
<span class="normal"> 374</span>
<span class="normal"> 375</span>
<span class="normal"> 376</span>
<span class="normal"> 377</span>
<span class="normal"> 378</span>
<span class="normal"> 379</span>
<span class="normal"> 380</span>
<span class="normal"> 381</span>
<span class="normal"> 382</span>
<span class="normal"> 383</span>
<span class="normal"> 384</span>
<span class="normal"> 385</span>
<span class="normal"> 386</span>
<span class="normal"> 387</span>
<span class="normal"> 388</span>
<span class="normal"> 389</span>
<span class="normal"> 390</span>
<span class="normal"> 391</span>
<span class="normal"> 392</span>
<span class="normal"> 393</span>
<span class="normal"> 394</span>
<span class="normal"> 395</span>
<span class="normal"> 396</span>
<span class="normal"> 397</span>
<span class="normal"> 398</span>
<span class="normal"> 399</span>
<span class="normal"> 400</span>
<span class="normal"> 401</span>
<span class="normal"> 402</span>
<span class="normal"> 403</span>
<span class="normal"> 404</span>
<span class="normal"> 405</span>
<span class="normal"> 406</span>
<span class="normal"> 407</span>
<span class="normal"> 408</span>
<span class="normal"> 409</span>
<span class="normal"> 410</span>
<span class="normal"> 411</span>
<span class="normal"> 412</span>
<span class="normal"> 413</span>
<span class="normal"> 414</span>
<span class="normal"> 415</span>
<span class="normal"> 416</span>
<span class="normal"> 417</span>
<span class="normal"> 418</span>
<span class="normal"> 419</span>
<span class="normal"> 420</span>
<span class="normal"> 421</span>
<span class="normal"> 422</span>
<span class="normal"> 423</span>
<span class="normal"> 424</span>
<span class="normal"> 425</span>
<span class="normal"> 426</span>
<span class="normal"> 427</span>
<span class="normal"> 428</span>
<span class="normal"> 429</span>
<span class="normal"> 430</span>
<span class="normal"> 431</span>
<span class="normal"> 432</span>
<span class="normal"> 433</span>
<span class="normal"> 434</span>
<span class="normal"> 435</span>
<span class="normal"> 436</span>
<span class="normal"> 437</span>
<span class="normal"> 438</span>
<span class="normal"> 439</span>
<span class="normal"> 440</span>
<span class="normal"> 441</span>
<span class="normal"> 442</span>
<span class="normal"> 443</span>
<span class="normal"> 444</span>
<span class="normal"> 445</span>
<span class="normal"> 446</span>
<span class="normal"> 447</span>
<span class="normal"> 448</span>
<span class="normal"> 449</span>
<span class="normal"> 450</span>
<span class="normal"> 451</span>
<span class="normal"> 452</span>
<span class="normal"> 453</span>
<span class="normal"> 454</span>
<span class="normal"> 455</span>
<span class="normal"> 456</span>
<span class="normal"> 457</span>
<span class="normal"> 458</span>
<span class="normal"> 459</span>
<span class="normal"> 460</span>
<span class="normal"> 461</span>
<span class="normal"> 462</span>
<span class="normal"> 463</span>
<span class="normal"> 464</span>
<span class="normal"> 465</span>
<span class="normal"> 466</span>
<span class="normal"> 467</span>
<span class="normal"> 468</span>
<span class="normal"> 469</span>
<span class="normal"> 470</span>
<span class="normal"> 471</span>
<span class="normal"> 472</span>
<span class="normal"> 473</span>
<span class="normal"> 474</span>
<span class="normal"> 475</span>
<span class="normal"> 476</span>
<span class="normal"> 477</span>
<span class="normal"> 478</span>
<span class="normal"> 479</span>
<span class="normal"> 480</span>
<span class="normal"> 481</span>
<span class="normal"> 482</span>
<span class="normal"> 483</span>
<span class="normal"> 484</span>
<span class="normal"> 485</span>
<span class="normal"> 486</span>
<span class="normal"> 487</span>
<span class="normal"> 488</span>
<span class="normal"> 489</span>
<span class="normal"> 490</span>
<span class="normal"> 491</span>
<span class="normal"> 492</span>
<span class="normal"> 493</span>
<span class="normal"> 494</span>
<span class="normal"> 495</span>
<span class="normal"> 496</span>
<span class="normal"> 497</span>
<span class="normal"> 498</span>
<span class="normal"> 499</span>
<span class="normal"> 500</span>
<span class="normal"> 501</span>
<span class="normal"> 502</span>
<span class="normal"> 503</span>
<span class="normal"> 504</span>
<span class="normal"> 505</span>
<span class="normal"> 506</span>
<span class="normal"> 507</span>
<span class="normal"> 508</span>
<span class="normal"> 509</span>
<span class="normal"> 510</span>
<span class="normal"> 511</span>
<span class="normal"> 512</span>
<span class="normal"> 513</span>
<span class="normal"> 514</span>
<span class="normal"> 515</span>
<span class="normal"> 516</span>
<span class="normal"> 517</span>
<span class="normal"> 518</span>
<span class="normal"> 519</span>
<span class="normal"> 520</span>
<span class="normal"> 521</span>
<span class="normal"> 522</span>
<span class="normal"> 523</span>
<span class="normal"> 524</span>
<span class="normal"> 525</span>
<span class="normal"> 526</span>
<span class="normal"> 527</span>
<span class="normal"> 528</span>
<span class="normal"> 529</span>
<span class="normal"> 530</span>
<span class="normal"> 531</span>
<span class="normal"> 532</span>
<span class="normal"> 533</span>
<span class="normal"> 534</span>
<span class="normal"> 535</span>
<span class="normal"> 536</span>
<span class="normal"> 537</span>
<span class="normal"> 538</span>
<span class="normal"> 539</span>
<span class="normal"> 540</span>
<span class="normal"> 541</span>
<span class="normal"> 542</span>
<span class="normal"> 543</span>
<span class="normal"> 544</span>
<span class="normal"> 545</span>
<span class="normal"> 546</span>
<span class="normal"> 547</span>
<span class="normal"> 548</span>
<span class="normal"> 549</span>
<span class="normal"> 550</span>
<span class="normal"> 551</span>
<span class="normal"> 552</span>
<span class="normal"> 553</span>
<span class="normal"> 554</span>
<span class="normal"> 555</span>
<span class="normal"> 556</span>
<span class="normal"> 557</span>
<span class="normal"> 558</span>
<span class="normal"> 559</span>
<span class="normal"> 560</span>
<span class="normal"> 561</span>
<span class="normal"> 562</span>
<span class="normal"> 563</span>
<span class="normal"> 564</span>
<span class="normal"> 565</span>
<span class="normal"> 566</span>
<span class="normal"> 567</span>
<span class="normal"> 568</span>
<span class="normal"> 569</span>
<span class="normal"> 570</span>
<span class="normal"> 571</span>
<span class="normal"> 572</span>
<span class="normal"> 573</span>
<span class="normal"> 574</span>
<span class="normal"> 575</span>
<span class="normal"> 576</span>
<span class="normal"> 577</span>
<span class="normal"> 578</span>
<span class="normal"> 579</span>
<span class="normal"> 580</span>
<span class="normal"> 581</span>
<span class="normal"> 582</span>
<span class="normal"> 583</span>
<span class="normal"> 584</span>
<span class="normal"> 585</span>
<span class="normal"> 586</span>
<span class="normal"> 587</span>
<span class="normal"> 588</span>
<span class="normal"> 589</span>
<span class="normal"> 590</span>
<span class="normal"> 591</span>
<span class="normal"> 592</span>
<span class="normal"> 593</span>
<span class="normal"> 594</span>
<span class="normal"> 595</span>
<span class="normal"> 596</span>
<span class="normal"> 597</span>
<span class="normal"> 598</span>
<span class="normal"> 599</span>
<span class="normal"> 600</span>
<span class="normal"> 601</span>
<span class="normal"> 602</span>
<span class="normal"> 603</span>
<span class="normal"> 604</span>
<span class="normal"> 605</span>
<span class="normal"> 606</span>
<span class="normal"> 607</span>
<span class="normal"> 608</span>
<span class="normal"> 609</span>
<span class="normal"> 610</span>
<span class="normal"> 611</span>
<span class="normal"> 612</span>
<span class="normal"> 613</span>
<span class="normal"> 614</span>
<span class="normal"> 615</span>
<span class="normal"> 616</span>
<span class="normal"> 617</span>
<span class="normal"> 618</span>
<span class="normal"> 619</span>
<span class="normal"> 620</span>
<span class="normal"> 621</span>
<span class="normal"> 622</span>
<span class="normal"> 623</span>
<span class="normal"> 624</span>
<span class="normal"> 625</span>
<span class="normal"> 626</span>
<span class="normal"> 627</span>
<span class="normal"> 628</span>
<span class="normal"> 629</span>
<span class="normal"> 630</span>
<span class="normal"> 631</span>
<span class="normal"> 632</span>
<span class="normal"> 633</span>
<span class="normal"> 634</span>
<span class="normal"> 635</span>
<span class="normal"> 636</span>
<span class="normal"> 637</span>
<span class="normal"> 638</span>
<span class="normal"> 639</span>
<span class="normal"> 640</span>
<span class="normal"> 641</span>
<span class="normal"> 642</span>
<span class="normal"> 643</span>
<span class="normal"> 644</span>
<span class="normal"> 645</span>
<span class="normal"> 646</span>
<span class="normal"> 647</span>
<span class="normal"> 648</span>
<span class="normal"> 649</span>
<span class="normal"> 650</span>
<span class="normal"> 651</span>
<span class="normal"> 652</span>
<span class="normal"> 653</span>
<span class="normal"> 654</span>
<span class="normal"> 655</span>
<span class="normal"> 656</span>
<span class="normal"> 657</span>
<span class="normal"> 658</span>
<span class="normal"> 659</span>
<span class="normal"> 660</span>
<span class="normal"> 661</span>
<span class="normal"> 662</span>
<span class="normal"> 663</span>
<span class="normal"> 664</span>
<span class="normal"> 665</span>
<span class="normal"> 666</span>
<span class="normal"> 667</span>
<span class="normal"> 668</span>
<span class="normal"> 669</span>
<span class="normal"> 670</span>
<span class="normal"> 671</span>
<span class="normal"> 672</span>
<span class="normal"> 673</span>
<span class="normal"> 674</span>
<span class="normal"> 675</span>
<span class="normal"> 676</span>
<span class="normal"> 677</span>
<span class="normal"> 678</span>
<span class="normal"> 679</span>
<span class="normal"> 680</span>
<span class="normal"> 681</span>
<span class="normal"> 682</span>
<span class="normal"> 683</span>
<span class="normal"> 684</span>
<span class="normal"> 685</span>
<span class="normal"> 686</span>
<span class="normal"> 687</span>
<span class="normal"> 688</span>
<span class="normal"> 689</span>
<span class="normal"> 690</span>
<span class="normal"> 691</span>
<span class="normal"> 692</span>
<span class="normal"> 693</span>
<span class="normal"> 694</span>
<span class="normal"> 695</span>
<span class="normal"> 696</span>
<span class="normal"> 697</span>
<span class="normal"> 698</span>
<span class="normal"> 699</span>
<span class="normal"> 700</span>
<span class="normal"> 701</span>
<span class="normal"> 702</span>
<span class="normal"> 703</span>
<span class="normal"> 704</span>
<span class="normal"> 705</span>
<span class="normal"> 706</span>
<span class="normal"> 707</span>
<span class="normal"> 708</span>
<span class="normal"> 709</span>
<span class="normal"> 710</span>
<span class="normal"> 711</span>
<span class="normal"> 712</span>
<span class="normal"> 713</span>
<span class="normal"> 714</span>
<span class="normal"> 715</span>
<span class="normal"> 716</span>
<span class="normal"> 717</span>
<span class="normal"> 718</span>
<span class="normal"> 719</span>
<span class="normal"> 720</span>
<span class="normal"> 721</span>
<span class="normal"> 722</span>
<span class="normal"> 723</span>
<span class="normal"> 724</span>
<span class="normal"> 725</span>
<span class="normal"> 726</span>
<span class="normal"> 727</span>
<span class="normal"> 728</span>
<span class="normal"> 729</span>
<span class="normal"> 730</span>
<span class="normal"> 731</span>
<span class="normal"> 732</span>
<span class="normal"> 733</span>
<span class="normal"> 734</span>
<span class="normal"> 735</span>
<span class="normal"> 736</span>
<span class="normal"> 737</span>
<span class="normal"> 738</span>
<span class="normal"> 739</span>
<span class="normal"> 740</span>
<span class="normal"> 741</span>
<span class="normal"> 742</span>
<span class="normal"> 743</span>
<span class="normal"> 744</span>
<span class="normal"> 745</span>
<span class="normal"> 746</span>
<span class="normal"> 747</span>
<span class="normal"> 748</span>
<span class="normal"> 749</span>
<span class="normal"> 750</span>
<span class="normal"> 751</span>
<span class="normal"> 752</span>
<span class="normal"> 753</span>
<span class="normal"> 754</span>
<span class="normal"> 755</span>
<span class="normal"> 756</span>
<span class="normal"> 757</span>
<span class="normal"> 758</span>
<span class="normal"> 759</span>
<span class="normal"> 760</span>
<span class="normal"> 761</span>
<span class="normal"> 762</span>
<span class="normal"> 763</span>
<span class="normal"> 764</span>
<span class="normal"> 765</span>
<span class="normal"> 766</span>
<span class="normal"> 767</span>
<span class="normal"> 768</span>
<span class="normal"> 769</span>
<span class="normal"> 770</span>
<span class="normal"> 771</span>
<span class="normal"> 772</span>
<span class="normal"> 773</span>
<span class="normal"> 774</span>
<span class="normal"> 775</span>
<span class="normal"> 776</span>
<span class="normal"> 777</span>
<span class="normal"> 778</span>
<span class="normal"> 779</span>
<span class="normal"> 780</span>
<span class="normal"> 781</span>
<span class="normal"> 782</span>
<span class="normal"> 783</span>
<span class="normal"> 784</span>
<span class="normal"> 785</span>
<span class="normal"> 786</span>
<span class="normal"> 787</span>
<span class="normal"> 788</span>
<span class="normal"> 789</span>
<span class="normal"> 790</span>
<span class="normal"> 791</span>
<span class="normal"> 792</span>
<span class="normal"> 793</span>
<span class="normal"> 794</span>
<span class="normal"> 795</span>
<span class="normal"> 796</span>
<span class="normal"> 797</span>
<span class="normal"> 798</span>
<span class="normal"> 799</span>
<span class="normal"> 800</span>
<span class="normal"> 801</span>
<span class="normal"> 802</span>
<span class="normal"> 803</span>
<span class="normal"> 804</span>
<span class="normal"> 805</span>
<span class="normal"> 806</span>
<span class="normal"> 807</span>
<span class="normal"> 808</span>
<span class="normal"> 809</span>
<span class="normal"> 810</span>
<span class="normal"> 811</span>
<span class="normal"> 812</span>
<span class="normal"> 813</span>
<span class="normal"> 814</span>
<span class="normal"> 815</span>
<span class="normal"> 816</span>
<span class="normal"> 817</span>
<span class="normal"> 818</span>
<span class="normal"> 819</span>
<span class="normal"> 820</span>
<span class="normal"> 821</span>
<span class="normal"> 822</span>
<span class="normal"> 823</span>
<span class="normal"> 824</span>
<span class="normal"> 825</span>
<span class="normal"> 826</span>
<span class="normal"> 827</span>
<span class="normal"> 828</span>
<span class="normal"> 829</span>
<span class="normal"> 830</span>
<span class="normal"> 831</span>
<span class="normal"> 832</span>
<span class="normal"> 833</span>
<span class="normal"> 834</span>
<span class="normal"> 835</span>
<span class="normal"> 836</span>
<span class="normal"> 837</span>
<span class="normal"> 838</span>
<span class="normal"> 839</span>
<span class="normal"> 840</span>
<span class="normal"> 841</span>
<span class="normal"> 842</span>
<span class="normal"> 843</span>
<span class="normal"> 844</span>
<span class="normal"> 845</span>
<span class="normal"> 846</span>
<span class="normal"> 847</span>
<span class="normal"> 848</span>
<span class="normal"> 849</span>
<span class="normal"> 850</span>
<span class="normal"> 851</span>
<span class="normal"> 852</span>
<span class="normal"> 853</span>
<span class="normal"> 854</span>
<span class="normal"> 855</span>
<span class="normal"> 856</span>
<span class="normal"> 857</span>
<span class="normal"> 858</span>
<span class="normal"> 859</span>
<span class="normal"> 860</span>
<span class="normal"> 861</span>
<span class="normal"> 862</span>
<span class="normal"> 863</span>
<span class="normal"> 864</span>
<span class="normal"> 865</span>
<span class="normal"> 866</span>
<span class="normal"> 867</span>
<span class="normal"> 868</span>
<span class="normal"> 869</span>
<span class="normal"> 870</span>
<span class="normal"> 871</span>
<span class="normal"> 872</span>
<span class="normal"> 873</span>
<span class="normal"> 874</span>
<span class="normal"> 875</span>
<span class="normal"> 876</span>
<span class="normal"> 877</span>
<span class="normal"> 878</span>
<span class="normal"> 879</span>
<span class="normal"> 880</span>
<span class="normal"> 881</span>
<span class="normal"> 882</span>
<span class="normal"> 883</span>
<span class="normal"> 884</span>
<span class="normal"> 885</span>
<span class="normal"> 886</span>
<span class="normal"> 887</span>
<span class="normal"> 888</span>
<span class="normal"> 889</span>
<span class="normal"> 890</span>
<span class="normal"> 891</span>
<span class="normal"> 892</span>
<span class="normal"> 893</span>
<span class="normal"> 894</span>
<span class="normal"> 895</span>
<span class="normal"> 896</span>
<span class="normal"> 897</span>
<span class="normal"> 898</span>
<span class="normal"> 899</span>
<span class="normal"> 900</span>
<span class="normal"> 901</span>
<span class="normal"> 902</span>
<span class="normal"> 903</span>
<span class="normal"> 904</span>
<span class="normal"> 905</span>
<span class="normal"> 906</span>
<span class="normal"> 907</span>
<span class="normal"> 908</span>
<span class="normal"> 909</span>
<span class="normal"> 910</span>
<span class="normal"> 911</span>
<span class="normal"> 912</span>
<span class="normal"> 913</span>
<span class="normal"> 914</span>
<span class="normal"> 915</span>
<span class="normal"> 916</span>
<span class="normal"> 917</span>
<span class="normal"> 918</span>
<span class="normal"> 919</span>
<span class="normal"> 920</span>
<span class="normal"> 921</span>
<span class="normal"> 922</span>
<span class="normal"> 923</span>
<span class="normal"> 924</span>
<span class="normal"> 925</span>
<span class="normal"> 926</span>
<span class="normal"> 927</span>
<span class="normal"> 928</span>
<span class="normal"> 929</span>
<span class="normal"> 930</span>
<span class="normal"> 931</span>
<span class="normal"> 932</span>
<span class="normal"> 933</span>
<span class="normal"> 934</span>
<span class="normal"> 935</span>
<span class="normal"> 936</span>
<span class="normal"> 937</span>
<span class="normal"> 938</span>
<span class="normal"> 939</span>
<span class="normal"> 940</span>
<span class="normal"> 941</span>
<span class="normal"> 942</span>
<span class="normal"> 943</span>
<span class="normal"> 944</span>
<span class="normal"> 945</span>
<span class="normal"> 946</span>
<span class="normal"> 947</span>
<span class="normal"> 948</span>
<span class="normal"> 949</span>
<span class="normal"> 950</span>
<span class="normal"> 951</span>
<span class="normal"> 952</span>
<span class="normal"> 953</span>
<span class="normal"> 954</span>
<span class="normal"> 955</span>
<span class="normal"> 956</span>
<span class="normal"> 957</span>
<span class="normal"> 958</span>
<span class="normal"> 959</span>
<span class="normal"> 960</span>
<span class="normal"> 961</span>
<span class="normal"> 962</span>
<span class="normal"> 963</span>
<span class="normal"> 964</span>
<span class="normal"> 965</span>
<span class="normal"> 966</span>
<span class="normal"> 967</span>
<span class="normal"> 968</span>
<span class="normal"> 969</span>
<span class="normal"> 970</span>
<span class="normal"> 971</span>
<span class="normal"> 972</span>
<span class="normal"> 973</span>
<span class="normal"> 974</span>
<span class="normal"> 975</span>
<span class="normal"> 976</span>
<span class="normal"> 977</span>
<span class="normal"> 978</span>
<span class="normal"> 979</span>
<span class="normal"> 980</span>
<span class="normal"> 981</span>
<span class="normal"> 982</span>
<span class="normal"> 983</span>
<span class="normal"> 984</span>
<span class="normal"> 985</span>
<span class="normal"> 986</span>
<span class="normal"> 987</span>
<span class="normal"> 988</span>
<span class="normal"> 989</span>
<span class="normal"> 990</span>
<span class="normal"> 991</span>
<span class="normal"> 992</span>
<span class="normal"> 993</span>
<span class="normal"> 994</span>
<span class="normal"> 995</span>
<span class="normal"> 996</span>
<span class="normal"> 997</span>
<span class="normal"> 998</span>
<span class="normal"> 999</span>
<span class="normal">1000</span>
<span class="normal">1001</span>
<span class="normal">1002</span>
<span class="normal">1003</span>
<span class="normal">1004</span>
<span class="normal">1005</span>
<span class="normal">1006</span>
<span class="normal">1007</span>
<span class="normal">1008</span>
<span class="normal">1009</span>
<span class="normal">1010</span>
<span class="normal">1011</span>
<span class="normal">1012</span>
<span class="normal">1013</span>
<span class="normal">1014</span>
<span class="normal">1015</span>
<span class="normal">1016</span>
<span class="normal">1017</span>
<span class="normal">1018</span>
<span class="normal">1019</span>
<span class="normal">1020</span>
<span class="normal">1021</span>
<span class="normal">1022</span>
<span class="normal">1023</span>
<span class="normal">1024</span>
<span class="normal">1025</span>
<span class="normal">1026</span>
<span class="normal">1027</span>
<span class="normal">1028</span>
<span class="normal">1029</span>
<span class="normal">1030</span>
<span class="normal">1031</span>
<span class="normal">1032</span>
<span class="normal">1033</span>
<span class="normal">1034</span>
<span class="normal">1035</span>
<span class="normal">1036</span>
<span class="normal">1037</span>
<span class="normal">1038</span>
<span class="normal">1039</span>
<span class="normal">1040</span>
<span class="normal">1041</span>
<span class="normal">1042</span>
<span class="normal">1043</span>
<span class="normal">1044</span>
<span class="normal">1045</span>
<span class="normal">1046</span>
<span class="normal">1047</span>
<span class="normal">1048</span>
<span class="normal">1049</span>
<span class="normal">1050</span>
<span class="normal">1051</span>
<span class="normal">1052</span>
<span class="normal">1053</span>
<span class="normal">1054</span>
<span class="normal">1055</span>
<span class="normal">1056</span>
<span class="normal">1057</span>
<span class="normal">1058</span>
<span class="normal">1059</span>
<span class="normal">1060</span>
<span class="normal">1061</span>
<span class="normal">1062</span>
<span class="normal">1063</span>
<span class="normal">1064</span>
<span class="normal">1065</span>
<span class="normal">1066</span>
<span class="normal">1067</span>
<span class="normal">1068</span>
<span class="normal">1069</span>
<span class="normal">1070</span>
<span class="normal">1071</span>
<span class="normal">1072</span>
<span class="normal">1073</span>
<span class="normal">1074</span>
<span class="normal">1075</span>
<span class="normal">1076</span>
<span class="normal">1077</span>
<span class="normal">1078</span>
<span class="normal">1079</span>
<span class="normal">1080</span>
<span class="normal">1081</span>
<span class="normal">1082</span>
<span class="normal">1083</span>
<span class="normal">1084</span>
<span class="normal">1085</span>
<span class="normal">1086</span>
<span class="normal">1087</span>
<span class="normal">1088</span>
<span class="normal">1089</span>
<span class="normal">1090</span>
<span class="normal">1091</span>
<span class="normal">1092</span>
<span class="normal">1093</span>
<span class="normal">1094</span>
<span class="normal">1095</span>
<span class="normal">1096</span>
<span class="normal">1097</span>
<span class="normal">1098</span>
<span class="normal">1099</span>
<span class="normal">1100</span>
<span class="normal">1101</span>
<span class="normal">1102</span>
<span class="normal">1103</span>
<span class="normal">1104</span>
<span class="normal">1105</span>
<span class="normal">1106</span>
<span class="normal">1107</span>
<span class="normal">1108</span>
<span class="normal">1109</span>
<span class="normal">1110</span>
<span class="normal">1111</span>
<span class="normal">1112</span>
<span class="normal">1113</span>
<span class="normal">1114</span>
<span class="normal">1115</span>
<span class="normal">1116</span>
<span class="normal">1117</span>
<span class="normal">1118</span>
<span class="normal">1119</span>
<span class="normal">1120</span>
<span class="normal">1121</span>
<span class="normal">1122</span>
<span class="normal">1123</span>
<span class="normal">1124</span>
<span class="normal">1125</span>
<span class="normal">1126</span>
<span class="normal">1127</span>
<span class="normal">1128</span>
<span class="normal">1129</span>
<span class="normal">1130</span>
<span class="normal">1131</span>
<span class="normal">1132</span>
<span class="normal">1133</span>
<span class="normal">1134</span>
<span class="normal">1135</span>
<span class="normal">1136</span>
<span class="normal">1137</span>
<span class="normal">1138</span>
<span class="normal">1139</span>
<span class="normal">1140</span>
<span class="normal">1141</span>
<span class="normal">1142</span>
<span class="normal">1143</span>
<span class="normal">1144</span>
<span class="normal">1145</span>
<span class="normal">1146</span>
<span class="normal">1147</span>
<span class="normal">1148</span>
<span class="normal">1149</span>
<span class="normal">1150</span>
<span class="normal">1151</span>
<span class="normal">1152</span>
<span class="normal">1153</span>
<span class="normal">1154</span>
<span class="normal">1155</span>
<span class="normal">1156</span>
<span class="normal">1157</span>
<span class="normal">1158</span>
<span class="normal">1159</span>
<span class="normal">1160</span>
<span class="normal">1161</span>
<span class="normal">1162</span>
<span class="normal">1163</span>
<span class="normal">1164</span>
<span class="normal">1165</span>
<span class="normal">1166</span>
<span class="normal">1167</span>
<span class="normal">1168</span>
<span class="normal">1169</span>
<span class="normal">1170</span>
<span class="normal">1171</span>
<span class="normal">1172</span>
<span class="normal">1173</span>
<span class="normal">1174</span>
<span class="normal">1175</span>
<span class="normal">1176</span>
<span class="normal">1177</span>
<span class="normal">1178</span>
<span class="normal">1179</span>
<span class="normal">1180</span>
<span class="normal">1181</span>
<span class="normal">1182</span>
<span class="normal">1183</span>
<span class="normal">1184</span>
<span class="normal">1185</span>
<span class="normal">1186</span>
<span class="normal">1187</span>
<span class="normal">1188</span>
<span class="normal">1189</span>
<span class="normal">1190</span>
<span class="normal">1191</span>
<span class="normal">1192</span>
<span class="normal">1193</span>
<span class="normal">1194</span>
<span class="normal">1195</span>
<span class="normal">1196</span>
<span class="normal">1197</span>
<span class="normal">1198</span>
<span class="normal">1199</span>
<span class="normal">1200</span>
<span class="normal">1201</span>
<span class="normal">1202</span>
<span class="normal">1203</span>
<span class="normal">1204</span>
<span class="normal">1205</span>
<span class="normal">1206</span>
<span class="normal">1207</span>
<span class="normal">1208</span>
<span class="normal">1209</span>
<span class="normal">1210</span>
<span class="normal">1211</span>
<span class="normal">1212</span>
<span class="normal">1213</span>
<span class="normal">1214</span>
<span class="normal">1215</span>
<span class="normal">1216</span>
<span class="normal">1217</span>
<span class="normal">1218</span>
<span class="normal">1219</span>
<span class="normal">1220</span>
<span class="normal">1221</span>
<span class="normal">1222</span>
<span class="normal">1223</span>
<span class="normal">1224</span>
<span class="normal">1225</span>
<span class="normal">1226</span>
<span class="normal">1227</span>
<span class="normal">1228</span>
<span class="normal">1229</span>
<span class="normal">1230</span>
<span class="normal">1231</span>
<span class="normal">1232</span>
<span class="normal">1233</span>
<span class="normal">1234</span>
<span class="normal">1235</span>
<span class="normal">1236</span>
<span class="normal">1237</span>
<span class="normal">1238</span>
<span class="normal">1239</span>
<span class="normal">1240</span>
<span class="normal">1241</span>
<span class="normal">1242</span>
<span class="normal">1243</span>
<span class="normal">1244</span>
<span class="normal">1245</span>
<span class="normal">1246</span>
<span class="normal">1247</span>
<span class="normal">1248</span>
<span class="normal">1249</span>
<span class="normal">1250</span>
<span class="normal">1251</span>
<span class="normal">1252</span>
<span class="normal">1253</span>
<span class="normal">1254</span>
<span class="normal">1255</span>
<span class="normal">1256</span>
<span class="normal">1257</span>
<span class="normal">1258</span>
<span class="normal">1259</span>
<span class="normal">1260</span>
<span class="normal">1261</span>
<span class="normal">1262</span>
<span class="normal">1263</span>
<span class="normal">1264</span>
<span class="normal">1265</span>
<span class="normal">1266</span>
<span class="normal">1267</span>
<span class="normal">1268</span>
<span class="normal">1269</span>
<span class="normal">1270</span>
<span class="normal">1271</span>
<span class="normal">1272</span>
<span class="normal">1273</span>
<span class="normal">1274</span>
<span class="normal">1275</span>
<span class="normal">1276</span>
<span class="normal">1277</span>
<span class="normal">1278</span>
<span class="normal">1279</span>
<span class="normal">1280</span>
<span class="normal">1281</span>
<span class="normal">1282</span>
<span class="normal">1283</span>
<span class="normal">1284</span>
<span class="normal">1285</span>
<span class="normal">1286</span>
<span class="normal">1287</span>
<span class="normal">1288</span>
<span class="normal">1289</span>
<span class="normal">1290</span>
<span class="normal">1291</span>
<span class="normal">1292</span>
<span class="normal">1293</span>
<span class="normal">1294</span>
<span class="normal">1295</span>
<span class="normal">1296</span>
<span class="normal">1297</span>
<span class="normal">1298</span>
<span class="normal">1299</span>
<span class="normal">1300</span>
<span class="normal">1301</span>
<span class="normal">1302</span>
<span class="normal">1303</span>
<span class="normal">1304</span>
<span class="normal">1305</span>
<span class="normal">1306</span>
<span class="normal">1307</span>
<span class="normal">1308</span>
<span class="normal">1309</span>
<span class="normal">1310</span>
<span class="normal">1311</span>
<span class="normal">1312</span>
<span class="normal">1313</span>
<span class="normal">1314</span>
<span class="normal">1315</span>
<span class="normal">1316</span>
<span class="normal">1317</span>
<span class="normal">1318</span>
<span class="normal">1319</span>
<span class="normal">1320</span>
<span class="normal">1321</span>
<span class="normal">1322</span>
<span class="normal">1323</span>
<span class="normal">1324</span>
<span class="normal">1325</span>
<span class="normal">1326</span>
<span class="normal">1327</span>
<span class="normal">1328</span>
<span class="normal">1329</span>
<span class="normal">1330</span>
<span class="normal">1331</span>
<span class="normal">1332</span>
<span class="normal">1333</span>
<span class="normal">1334</span>
<span class="normal">1335</span>
<span class="normal">1336</span>
<span class="normal">1337</span>
<span class="normal">1338</span>
<span class="normal">1339</span>
<span class="normal">1340</span>
<span class="normal">1341</span>
<span class="normal">1342</span>
<span class="normal">1343</span>
<span class="normal">1344</span>
<span class="normal">1345</span>
<span class="normal">1346</span>
<span class="normal">1347</span>
<span class="normal">1348</span>
<span class="normal">1349</span>
<span class="normal">1350</span>
<span class="normal">1351</span>
<span class="normal">1352</span>
<span class="normal">1353</span>
<span class="normal">1354</span>
<span class="normal">1355</span>
<span class="normal">1356</span>
<span class="normal">1357</span>
<span class="normal">1358</span>
<span class="normal">1359</span>
<span class="normal">1360</span>
<span class="normal">1361</span>
<span class="normal">1362</span>
<span class="normal">1363</span>
<span class="normal">1364</span>
<span class="normal">1365</span>
<span class="normal">1366</span>
<span class="normal">1367</span>
<span class="normal">1368</span>
<span class="normal">1369</span>
<span class="normal">1370</span>
<span class="normal">1371</span>
<span class="normal">1372</span>
<span class="normal">1373</span>
<span class="normal">1374</span>
<span class="normal">1375</span>
<span class="normal">1376</span>
<span class="normal">1377</span>
<span class="normal">1378</span>
<span class="normal">1379</span>
<span class="normal">1380</span>
<span class="normal">1381</span>
<span class="normal">1382</span>
<span class="normal">1383</span>
<span class="normal">1384</span>
<span class="normal">1385</span>
<span class="normal">1386</span>
<span class="normal">1387</span>
<span class="normal">1388</span>
<span class="normal">1389</span>
<span class="normal">1390</span>
<span class="normal">1391</span>
<span class="normal">1392</span>
<span class="normal">1393</span>
<span class="normal">1394</span>
<span class="normal">1395</span>
<span class="normal">1396</span>
<span class="normal">1397</span>
<span class="normal">1398</span>
<span class="normal">1399</span>
<span class="normal">1400</span>
<span class="normal">1401</span>
<span class="normal">1402</span>
<span class="normal">1403</span>
<span class="normal">1404</span>
<span class="normal">1405</span>
<span class="normal">1406</span>
<span class="normal">1407</span>
<span class="normal">1408</span>
<span class="normal">1409</span>
<span class="normal">1410</span>
<span class="normal">1411</span>
<span class="normal">1412</span>
<span class="normal">1413</span>
<span class="normal">1414</span>
<span class="normal">1415</span>
<span class="normal">1416</span>
<span class="normal">1417</span>
<span class="normal">1418</span>
<span class="normal">1419</span>
<span class="normal">1420</span>
<span class="normal">1421</span>
<span class="normal">1422</span>
<span class="normal">1423</span>
<span class="normal">1424</span>
<span class="normal">1425</span>
<span class="normal">1426</span>
<span class="normal">1427</span>
<span class="normal">1428</span>
<span class="normal">1429</span>
<span class="normal">1430</span>
<span class="normal">1431</span>
<span class="normal">1432</span>
<span class="normal">1433</span>
<span class="normal">1434</span>
<span class="normal">1435</span>
<span class="normal">1436</span>
<span class="normal">1437</span>
<span class="normal">1438</span>
<span class="normal">1439</span>
<span class="normal">1440</span>
<span class="normal">1441</span>
<span class="normal">1442</span>
<span class="normal">1443</span>
<span class="normal">1444</span>
<span class="normal">1445</span>
<span class="normal">1446</span>
<span class="normal">1447</span>
<span class="normal">1448</span>
<span class="normal">1449</span>
<span class="normal">1450</span>
<span class="normal">1451</span>
<span class="normal">1452</span>
<span class="normal">1453</span>
<span class="normal">1454</span>
<span class="normal">1455</span>
<span class="normal">1456</span>
<span class="normal">1457</span>
<span class="normal">1458</span>
<span class="normal">1459</span>
<span class="normal">1460</span>
<span class="normal">1461</span>
<span class="normal">1462</span>
<span class="normal">1463</span>
<span class="normal">1464</span>
<span class="normal">1465</span>
<span class="normal">1466</span>
<span class="normal">1467</span>
<span class="normal">1468</span>
<span class="normal">1469</span>
<span class="normal">1470</span>
<span class="normal">1471</span>
<span class="normal">1472</span>
<span class="normal">1473</span>
<span class="normal">1474</span>
<span class="normal">1475</span>
<span class="normal">1476</span>
<span class="normal">1477</span>
<span class="normal">1478</span>
<span class="normal">1479</span>
<span class="normal">1480</span>
<span class="normal">1481</span>
<span class="normal">1482</span>
<span class="normal">1483</span>
<span class="normal">1484</span>
<span class="normal">1485</span>
<span class="normal">1486</span>
<span class="normal">1487</span>
<span class="normal">1488</span>
<span class="normal">1489</span>
<span class="normal">1490</span>
<span class="normal">1491</span>
<span class="normal">1492</span>
<span class="normal">1493</span>
<span class="normal">1494</span>
<span class="normal">1495</span>
<span class="normal">1496</span>
<span class="normal">1497</span>
<span class="normal">1498</span>
<span class="normal">1499</span>
<span class="normal">1500</span>
<span class="normal">1501</span>
<span class="normal">1502</span>
<span class="normal">1503</span>
<span class="normal">1504</span>
<span class="normal">1505</span>
<span class="normal">1506</span>
<span class="normal">1507</span>
<span class="normal">1508</span>
<span class="normal">1509</span>
<span class="normal">1510</span>
<span class="normal">1511</span>
<span class="normal">1512</span>
<span class="normal">1513</span>
<span class="normal">1514</span>
<span class="normal">1515</span>
<span class="normal">1516</span>
<span class="normal">1517</span>
<span class="normal">1518</span>
<span class="normal">1519</span>
<span class="normal">1520</span>
<span class="normal">1521</span>
<span class="normal">1522</span>
<span class="normal">1523</span>
<span class="normal">1524</span>
<span class="normal">1525</span>
<span class="normal">1526</span>
<span class="normal">1527</span>
<span class="normal">1528</span>
<span class="normal">1529</span>
<span class="normal">1530</span>
<span class="normal">1531</span>
<span class="normal">1532</span>
<span class="normal">1533</span>
<span class="normal">1534</span>
<span class="normal">1535</span>
<span class="normal">1536</span>
<span class="normal">1537</span>
<span class="normal">1538</span>
<span class="normal">1539</span>
<span class="normal">1540</span>
<span class="normal">1541</span>
<span class="normal">1542</span>
<span class="normal">1543</span>
<span class="normal">1544</span>
<span class="normal">1545</span>
<span class="normal">1546</span>
<span class="normal">1547</span>
<span class="normal">1548</span>
<span class="normal">1549</span>
<span class="normal">1550</span>
<span class="normal">1551</span>
<span class="normal">1552</span>
<span class="normal">1553</span>
<span class="normal">1554</span>
<span class="normal">1555</span>
<span class="normal">1556</span>
<span class="normal">1557</span>
<span class="normal">1558</span>
<span class="normal">1559</span>
<span class="normal">1560</span>
<span class="normal">1561</span>
<span class="normal">1562</span>
<span class="normal">1563</span>
<span class="normal">1564</span>
<span class="normal">1565</span>
<span class="normal">1566</span>
<span class="normal">1567</span>
<span class="normal">1568</span>
<span class="normal">1569</span>
<span class="normal">1570</span>
<span class="normal">1571</span>
<span class="normal">1572</span>
<span class="normal">1573</span>
<span class="normal">1574</span>
<span class="normal">1575</span>
<span class="normal">1576</span>
<span class="normal">1577</span>
<span class="normal">1578</span>
<span class="normal">1579</span>
<span class="normal">1580</span>
<span class="normal">1581</span>
<span class="normal">1582</span>
<span class="normal">1583</span>
<span class="normal">1584</span>
<span class="normal">1585</span>
<span class="normal">1586</span>
<span class="normal">1587</span>
<span class="normal">1588</span>
<span class="normal">1589</span>
<span class="normal">1590</span>
<span class="normal">1591</span>
<span class="normal">1592</span>
<span class="normal">1593</span>
<span class="normal">1594</span>
<span class="normal">1595</span>
<span class="normal">1596</span>
<span class="normal">1597</span>
<span class="normal">1598</span>
<span class="normal">1599</span>
<span class="normal">1600</span>
<span class="normal">1601</span>
<span class="normal">1602</span>
<span class="normal">1603</span>
<span class="normal">1604</span>
<span class="normal">1605</span>
<span class="normal">1606</span>
<span class="normal">1607</span>
<span class="normal">1608</span>
<span class="normal">1609</span>
<span class="normal">1610</span>
<span class="normal">1611</span>
<span class="normal">1612</span>
<span class="normal">1613</span>
<span class="normal">1614</span>
<span class="normal">1615</span>
<span class="normal">1616</span>
<span class="normal">1617</span>
<span class="normal">1618</span>
<span class="normal">1619</span>
<span class="normal">1620</span>
<span class="normal">1621</span>
<span class="normal">1622</span>
<span class="normal">1623</span>
<span class="normal">1624</span>
<span class="normal">1625</span>
<span class="normal">1626</span>
<span class="normal">1627</span>
<span class="normal">1628</span>
<span class="normal">1629</span>
<span class="normal">1630</span>
<span class="normal">1631</span>
<span class="normal">1632</span>
<span class="normal">1633</span>
<span class="normal">1634</span>
<span class="normal">1635</span>
<span class="normal">1636</span>
<span class="normal">1637</span>
<span class="normal">1638</span>
<span class="normal">1639</span>
<span class="normal">1640</span>
<span class="normal">1641</span>
<span class="normal">1642</span>
<span class="normal">1643</span>
<span class="normal">1644</span>
<span class="normal">1645</span>
<span class="normal">1646</span>
<span class="normal">1647</span>
<span class="normal">1648</span>
<span class="normal">1649</span>
<span class="normal">1650</span>
<span class="normal">1651</span>
<span class="normal">1652</span>
<span class="normal">1653</span>
<span class="normal">1654</span>
<span class="normal">1655</span>
<span class="normal">1656</span>
<span class="normal">1657</span>
<span class="normal">1658</span>
<span class="normal">1659</span>
<span class="normal">1660</span>
<span class="normal">1661</span>
<span class="normal">1662</span>
<span class="normal">1663</span>
<span class="normal">1664</span>
<span class="normal">1665</span>
<span class="normal">1666</span>
<span class="normal">1667</span>
<span class="normal">1668</span>
<span class="normal">1669</span>
<span class="normal">1670</span>
<span class="normal">1671</span>
<span class="normal">1672</span>
<span class="normal">1673</span>
<span class="normal">1674</span>
<span class="normal">1675</span></pre></div></td><td class="code"><div><pre><div id="l1" class="code_block"><span class="k">\chapter</span><span class="nb">{</span>System Description<span class="nb">}</span>
</div><div id="l2" class="code_block"><span class="k">\label</span><span class="nb">{</span>system<span class="nb">}</span>
</div><div id="l3" class="code_block">
</div><div id="l4" class="code_block">Throughout this chapter, we use <span class="k">\verb</span>&#39;<span class="s">$</span><span class="nb">XSB_DIR&#39; to refer to the</span>
</div><div id="l5" class="code_block"><span class="nb">directory in which XSB was installed.</span>
</div><div id="l6" class="code_block">
</div><div id="l7" class="code_block"><span class="nv">\section</span><span class="nb">{Entering and Exiting XSB}</span>
</div><div id="l8" class="code_block"><span class="c">%=================================</span>
</div><div id="l9" class="code_block">
</div><div id="l10" class="code_block"><span class="nb">After the system has been installed, the emulator&#39;s executable code appears </span>
</div><div id="l11" class="code_block"><span class="nb">in the file:</span>
</div><div id="l12" class="code_block"><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l13" class="code_block"><span class="nb">                     </span><span class="s">$</span>XSB<span class="nb">_</span>DIR/bin/xsb
</div><div id="l14" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l15" class="code_block">or, if, after being built, XSB is later installed  at a central location,
</div><div id="l16" class="code_block"><span class="k">\verb</span>&#39;<span class="s">$</span><span class="nb">SHARED_XSB&#39;.</span>
</div><div id="l17" class="code_block"><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l18" class="code_block"><span class="nb">                     </span><span class="s">$</span>SHARED<span class="nb">_</span>XSB/bin/xsb
</div><div id="l19" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l20" class="code_block">and indeed, using this command, invokes XSB&#39;s top level interpreter
</div><div id="l21" class="code_block">which is the usual way of
</div><div id="l22" class="code_block">using XSB
</div><div id="l23" class="code_block">
</div><div id="l24" class="code_block"><span class="k">\version</span><span class="nb">{}</span> of XSB can also directly execute object code files from the
</div><div id="l25" class="code_block">command line interface.  Suppose you have a top-level routine <span class="nb">{</span><span class="k">\tt</span> go<span class="nb">}</span>
</div><div id="l26" class="code_block">in a file <span class="nb">{</span><span class="k">\tt</span> foo.P<span class="nb">}</span> that you would like to run from the UNIX or
</div><div id="l27" class="code_block">Windows command line.  As long as <span class="nb">{</span><span class="k">\tt</span> foo.P<span class="nb">}</span> contains a directive
</div><div id="l28" class="code_block"><span class="nb">{</span><span class="k">\tt</span> :- go.<span class="nb">}</span>, and <span class="nb">{</span><span class="k">\tt</span> foo<span class="nb">}</span> has been compiled to an object file (<span class="nb">{</span><span class="k">\tt</span>
</div><div id="l29" class="code_block">foo.O<span class="nb">}</span>), then
</div><div id="l30" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l31" class="code_block">                       <span class="s">$</span><span class="nb">XSB_DIR</span><span class="o">/</span><span class="nb">bin</span><span class="o">/</span><span class="nb">xsb </span><span class="o">-</span><span class="nb">B foo.O</span>
</div><div id="l32" class="code_block"><span class="nv">\end</span><span class="nb">{verbatim}</span>
</div><div id="l33" class="code_block"><span class="nb">will execute {</span><span class="nv">\tt</span><span class="nb"> go}, loading the appropriate files as needed.  In</span>
</div><div id="l34" class="code_block"><span class="nb">fact the command </span><span class="nv">\verb</span><span class="nb">&#39;</span><span class="s">$</span>XSB<span class="nb">_</span>DIR/bin/xsb&#39; is equivalent to the
</div><div id="l35" class="code_block">command:
</div><div id="l36" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l37" class="code_block">             <span class="s">$</span><span class="nb">XSB_DIR</span><span class="o">/</span><span class="nb">bin</span><span class="o">/</span><span class="nb">xsb </span><span class="o">-</span><span class="nb">B </span><span class="s">$</span>XSB<span class="nb">_</span>DIR/syslib/loader.O
</div><div id="l38" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l39" class="code_block"><span class="c">%%$</span>
</div><div id="l40" class="code_block">
</div><div id="l41" class="code_block">There are several ways to exit XSB.  A user may issue the
</div><div id="l42" class="code_block">command <span class="k">\verb</span>&#39;halt.&#39; or <span class="k">\verb</span>&#39;end<span class="nb">_</span>of<span class="nb">_</span>file&#39;, or simply type
</div><div id="l43" class="code_block"><span class="k">\verb</span>&#39;CTRL-d&#39; at the XSB prompt.  To interrupt XSB
</div><div id="l44" class="code_block">while it is executing a query, strike <span class="k">\verb</span>&#39;CTRL-c&#39;.
</div><div id="l45" class="code_block">
</div><div id="l46" class="code_block">
</div><div id="l47" class="code_block"><span class="k">\section</span><span class="nb">{</span>The System and its Directories<span class="nb">}</span>
</div><div id="l48" class="code_block"><span class="c">%=======================================</span>
</div><div id="l49" class="code_block">The XSB system, when installed, resides in a single directory that
</div><div id="l50" class="code_block">contains several subdirectories.  For completeness, we review the
</div><div id="l51" class="code_block">information in all subdirectories.
</div><div id="l52" class="code_block"><span class="k">\begin</span><span class="nb">{</span>enumerate<span class="nb">}</span>
</div><div id="l53" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> bin<span class="nb">}</span> contains scripts which call XSB executables
</div><div id="l54" class="code_block">for various configurations.
</div><div id="l55" class="code_block"><span class="c">%</span>
</div><div id="l56" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> build<span class="nb">}</span> contains XSB configuration scripts.  You must
</div><div id="l57" class="code_block">already be familiar with the <span class="nb">{</span><span class="k">\tt</span> build<span class="nb">}</span> directory, which is what you
</div><div id="l58" class="code_block">must have used to build XSB.
</div><div id="l59" class="code_block"><span class="c">%</span>
</div><div id="l60" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> config<span class="nb">}</span> contains executables and other files specific to
</div><div id="l61" class="code_block">particular configurations.
</div><div id="l62" class="code_block"><span class="c">%</span>
</div><div id="l63" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> docs<span class="nb">}</span> contains the user manuals and other documentation,
</div><div id="l64" class="code_block">including the technical documentation manual for developers.
</div><div id="l65" class="code_block"><span class="c">%</span>
</div><div id="l66" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> emu<span class="nb">}</span> contains the C source code for the XSB emulator, for
</div><div id="l67" class="code_block">I/O and for various interfaces.
</div><div id="l68" class="code_block"><span class="c">%</span>
</div><div id="l69" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> etc<span class="nb">}</span> contains miscellaneous files used by XSB.
</div><div id="l70" class="code_block"><span class="c">%</span>
</div><div id="l71" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> examples<span class="nb">}</span> contains some basic examples for Prolog, tabling,
</div><div id="l72" class="code_block">and HiLog.
</div><div id="l73" class="code_block"><span class="c">%</span>
</div><div id="l74" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> cmplib<span class="nb">}</span> contains Prolog source and object code for the
</div><div id="l75" class="code_block">compiler. 
</div><div id="l76" class="code_block"><span class="c">%</span>
</div><div id="l77" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> gpp<span class="nb">}</span> contains a copy of the Gnu pre-processor used to
</div><div id="l78" class="code_block">preprocess Prolog files.
</div><div id="l79" class="code_block"><span class="c">%</span>
</div><div id="l80" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> lib<span class="nb">}</span> contains Prolog source and object code for extended
</div><div id="l81" class="code_block">libraries. 
</div><div id="l82" class="code_block"><span class="c">%</span>
</div><div id="l83" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> packages<span class="nb">}</span> The directory <span class="nb">{</span><span class="k">\tt</span> packages<span class="nb">}</span> contains the various
</div><div id="l84" class="code_block">applications, such as FLORA, the XMC model checker and many others.
</div><div id="l85" class="code_block">These applications are written in XSB and can be quite useful, but are
</div><div id="l86" class="code_block">not part of the XSB system per se.
</div><div id="l87" class="code_block"><span class="c">%</span>
</div><div id="l88" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> Prolog<span class="k">\_includes</span><span class="nb">}</span> contains include files for the Prolog
</div><div id="l89" class="code_block">libraries, which are preprocessed using GPP.
</div><div id="l90" class="code_block"><span class="c">%</span>
</div><div id="l91" class="code_block"><span class="k">\item</span> <span class="nb">{</span><span class="k">\tt</span> syslib<span class="nb">}</span> contains Prolog source and object code for core XSB
</div><div id="l92" class="code_block">libraries. 
</div><div id="l93" class="code_block"><span class="k">\end</span><span class="nb">{</span>enumerate<span class="nb">}</span>
</div><div id="l94" class="code_block">
</div><div id="l95" class="code_block">Normally, only the documentation and files in the Prolog
</div><div id="l96" class="code_block">subdirectories, particularly <span class="nb">{</span><span class="k">\tt</span> examples<span class="nb">}</span>, <span class="nb">{</span><span class="k">\tt</span> lib<span class="nb">}</span>, and <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l97" class="code_block">packages<span class="nb">}</span> will be of interest to users.  All Prolog source programs
</div><div id="l98" class="code_block">are written in XSB, and all object (byte code) files contain SLG-WAM
</div><div id="l99" class="code_block">instructions that can be executed by the emulator.  These byte-coded
</div><div id="l100" class="code_block">instructions are machine-independent, so usually no installation
</div><div id="l101" class="code_block">procedure is needed for the byte code files.
</div><div id="l102" class="code_block">
</div><div id="l103" class="code_block"><span class="k">\section</span><span class="nb">{</span>The Module System of XSB<span class="nb">}</span> <span class="k">\label</span><span class="nb">{</span>Modules<span class="nb">}</span>
</div><div id="l104" class="code_block"><span class="c">%========================================================</span>
</div><div id="l105" class="code_block">XSB has been designed as a module-oriented Prolog system.  Modules
</div><div id="l106" class="code_block">provide a small step towards <span class="nb">{</span><span class="k">\em</span> logic programming ``in the large&#39;&#39;<span class="nb">}</span>
</div><div id="l107" class="code_block">that facilitates large programs or projects to be put together from
</div><div id="l108" class="code_block">components which can be developed, compiled and tested separately.
</div><div id="l109" class="code_block">Also module systems enforce the <span class="nb">{</span><span class="k">\em</span> principle of information hiding<span class="nb">}</span>
</div><div id="l110" class="code_block">and can provide a basis for <span class="nb">{</span><span class="k">\em</span> data abstraction<span class="nb">}</span>.
</div><div id="l111" class="code_block">
</div><div id="l112" class="code_block">The module system of XSB, unlike the module systems of most
</div><div id="l113" class="code_block">other Prolog systems is <span class="nb">{</span><span class="k">\em</span> atom-based<span class="nb">}</span>.  Briefly, the main
</div><div id="l114" class="code_block">difference between atom-based module systems and predicate-based ones
</div><div id="l115" class="code_block">is that in an atom-based module system <span class="nb">{</span><span class="k">\em</span> any symbol in a module can
</div><div id="l116" class="code_block">be imported, exported or be a local symbol<span class="nb">}</span> as opposed to the
</div><div id="l117" class="code_block">predicate-based ones where this can be done only for predicate
</div><div id="l118" class="code_block">symbols~<span class="k">\footnote</span><span class="nb">{</span>Operator symbols can be exported as any other
</div><div id="l119" class="code_block">symbols, but their precedence must be redeclared in the importing
</div><div id="l120" class="code_block">module.<span class="nb">}</span>.
</div><div id="l121" class="code_block">
</div><div id="l122" class="code_block">Usually the following three files are associated with a particular
</div><div id="l123" class="code_block">module:
</div><div id="l124" class="code_block"><span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l125" class="code_block"><span class="k">\item</span> A single <span class="nb">{</span><span class="k">\it</span> source<span class="nb">}</span> file, whose name is the module name plus 
</div><div id="l126" class="code_block">      the suffix ``<span class="nb">{</span><span class="k">\tt</span> .P<span class="nb">}</span>&#39;&#39;.  
</div><div id="l127" class="code_block"><span class="k">\item</span> An optional <span class="nb">{</span><span class="k">\it</span> header<span class="nb">}</span> file, whose name is the module name plus 
</div><div id="l128" class="code_block">      the suffix ``<span class="nb">{</span><span class="k">\tt</span> .H<span class="nb">}</span>&#39;&#39;.  
</div><div id="l129" class="code_block"><span class="k">\item</span> An <span class="nb">{</span><span class="k">\it</span> object (byte-code)<span class="nb">}</span> file, whose name consists of the module 
</div><div id="l130" class="code_block">      name plus the suffix ``<span class="nb">{</span><span class="k">\tt</span> .O<span class="nb">}</span>&#39;&#39;.
</div><div id="l131" class="code_block"><span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l132" class="code_block">The header file is normally used to contain declarations and
</div><div id="l133" class="code_block">directives while the source file usually contains the actual
</div><div id="l134" class="code_block">definitions of the predicates defined in that module.  The module
</div><div id="l135" class="code_block">hierarchy of XSB is therefore <span class="nb">{</span><span class="k">\em</span> flat<span class="nb">}</span> --- nested modules are not
</div><div id="l136" class="code_block">possible.
</div><div id="l137" class="code_block">
</div><div id="l138" class="code_block">In order for a file to be a module, it should contain one or more 
</div><div id="l139" class="code_block"><span class="nb">{</span><span class="k">\it</span> export declarations<span class="nb">}</span>, which specify that a set of symbols appearing
</div><div id="l140" class="code_block">in that module is visible and therefore can be used by any other module.
</div><div id="l141" class="code_block">A module can also contain <span class="nb">{</span><span class="k">\it</span> local declarations<span class="nb">}</span>, which specify that
</div><div id="l142" class="code_block">a set of symbols are <span class="nb">{</span><span class="k">\it</span> visible by this module only<span class="nb">}</span>, and therefore
</div><div id="l143" class="code_block">cannot be accessed by any other module.
</div><div id="l144" class="code_block">Any file (either module or not) may also contain <span class="nb">{</span><span class="k">\it</span> import declarations<span class="nb">}</span>,
</div><div id="l145" class="code_block">which allow symbols defined in and exported by other modules to be used
</div><div id="l146" class="code_block">in the current module.  We note that only exported symbols can be
</div><div id="l147" class="code_block">imported; for example importing a local symbol will cause an <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l148" class="code_block">environment conflict error<span class="nb">}</span>.
</div><div id="l149" class="code_block">
</div><div id="l150" class="code_block">Export, local, and import declarations can appear anywhere in the source
</div><div id="l151" class="code_block">or header files and have the following forms:
</div><div id="l152" class="code_block">
</div><div id="l153" class="code_block"><span class="k">\demo</span><span class="nb">{</span>:- export <span class="s">$</span><span class="nb">sym_</span><span class="m">1</span><span class="s">$</span>, <span class="k">\ldots</span>, <span class="s">$</span><span class="nb">sym_l</span><span class="s">$</span>. <span class="nb">}</span>
</div><div id="l154" class="code_block">
</div><div id="l155" class="code_block"><span class="k">\demo</span><span class="nb">{</span>:- local <span class="s">$</span><span class="nb">sym_</span><span class="m">1</span><span class="s">$</span>, <span class="k">\ldots</span>, <span class="s">$</span><span class="nb">sym_m</span><span class="s">$</span>. <span class="nb">}</span>
</div><div id="l156" class="code_block">
</div><div id="l157" class="code_block"><span class="k">\demo</span><span class="nb">{</span>:- import <span class="s">$</span><span class="nb">sym_</span><span class="m">1</span><span class="s">$</span>, <span class="k">\ldots</span>, <span class="s">$</span><span class="nb">sym_n</span><span class="s">$</span> from <span class="s">$</span><span class="nb">module</span><span class="s">$</span>. <span class="nb">}</span>
</div><div id="l158" class="code_block">
</div><div id="l159" class="code_block"><span class="k">\noindent</span>
</div><div id="l160" class="code_block">where <span class="s">$</span><span class="nb">sym_i</span><span class="s">$</span> has the form <span class="s">$</span><span class="nb">functor</span><span class="o">/</span><span class="nb">arity</span><span class="s">$</span>.
</div><div id="l161" class="code_block">
</div><div id="l162" class="code_block">If the user does not want to use modules, he can simply
</div><div id="l163" class="code_block">bypass the module system by not supplying any export declarations.
</div><div id="l164" class="code_block">Such export-less files (non-modules) will be loaded into the module 
</div><div id="l165" class="code_block"><span class="nb">{</span><span class="k">\tt</span> usermod<span class="nb">}</span>, which is the working module of the XSB interpreter.
</div><div id="l166" class="code_block">
</div><div id="l167" class="code_block">Currently the module name is stored in its byte code file, which means
</div><div id="l168" class="code_block">that if the byte code file is renamed, the module name is not altered,
</div><div id="l169" class="code_block">and hence may cause confusion to the user and/or the system.  So, it
</div><div id="l170" class="code_block">is advisable that the user not rename byte code files generated for
</div><div id="l171" class="code_block">modules by the XSB compiler.  However, byte code files generated for
</div><div id="l172" class="code_block">non-modules can be safely renamed.  We will try to fix the problem
</div><div id="l173" class="code_block">described above in future releases.
</div><div id="l174" class="code_block">
</div><div id="l175" class="code_block">In order to understand the semantics of modules, the user should keep in
</div><div id="l176" class="code_block">mind that in a module oriented system, the name of each symbol is identified
</div><div id="l177" class="code_block">as if it were prefixed with its module name, hence two symbols of the same
</div><div id="l178" class="code_block"><span class="s">$</span><span class="nb">functor</span><span class="o">/</span><span class="nb">arity</span><span class="s">$</span> but different module prefixes are distinct symbols.  
</div><div id="l179" class="code_block">Currently the following set of rules is used to determine the module 
</div><div id="l180" class="code_block">prefix of a symbol:
</div><div id="l181" class="code_block"><span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l182" class="code_block"><span class="k">\item</span>	Every predicate symbol appearing in a module (i.e. that appears as
</div><div id="l183" class="code_block">	the head of some clause) is assumed to be <span class="nb">{</span><span class="k">\em</span> local<span class="nb">}</span> to that
</div><div id="l184" class="code_block">	module unless it is declared otherwise (via an export or
</div><div id="l185" class="code_block">	import declaration).  Symbols that are local to a given module
</div><div id="l186" class="code_block">	are not visible to other modules.
</div><div id="l187" class="code_block"><span class="k">\item</span>	Every other symbol (essentially function symbols) in a module is
</div><div id="l188" class="code_block">	assumed to be <span class="nb">{</span><span class="k">\em</span> global<span class="nb">}</span> (its module prefix is <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l189" class="code_block">	usermod<span class="nb">}</span>) unless declared otherwise.
</div><div id="l190" class="code_block"><span class="k">\item</span>	If a symbol is imported from another module (via an explicit import 
</div><div id="l191" class="code_block">	declaration), the module prefix of the symbol is the module it is 
</div><div id="l192" class="code_block">	imported from; any other symbol takes the module where the symbol 
</div><div id="l193" class="code_block">	occurs as its module prefix.
</div><div id="l194" class="code_block"><span class="k">\item</span>	The XSB interpreter is entered with <span class="nb">{</span><span class="k">\tt</span> usermod<span class="nb">}</span> as its 
</div><div id="l195" class="code_block">	working module.
</div><div id="l196" class="code_block"><span class="k">\item</span>	Symbols that are either defined in non-modules loaded into the
</div><div id="l197" class="code_block">	system or that are dynamically created (by the use of standard
</div><div id="l198" class="code_block">	predicates such as <span class="nb">{</span><span class="k">\tt</span> read/1, functor/3, &#39;=..&#39;/2<span class="nb">}</span>, etc) are
</div><div id="l199" class="code_block">	contained in <span class="nb">{</span><span class="k">\tt</span> usermod<span class="nb">}</span><span class="c">%</span>
</div><div id="l200" class="code_block"><span class="k">\footnote</span><span class="nb">{</span>The standard predicates of XSB are listed in <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l201" class="code_block"><span class="k">\$</span>XSB<span class="k">\_DIR</span>/syslib/std<span class="k">\_xsb</span>.P<span class="nb">}</span>.<span class="nb">}</span>.  <span class="k">\index</span><span class="nb">{</span>standard predicates<span class="nb">}</span>
</div><div id="l202" class="code_block"><span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l203" class="code_block"><span class="c">%</span>
</div><div id="l204" class="code_block">The following facts about the module system of XSB may not be
</div><div id="l205" class="code_block">immediately obvious:
</div><div id="l206" class="code_block"><span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l207" class="code_block"><span class="k">\item</span>   If users want to use a symbol from another module, they must
</div><div id="l208" class="code_block">        explicitly import it otherwise the two symbols are different
</div><div id="l209" class="code_block">        even if they are of the same <span class="s">$</span><span class="nb">functor</span><span class="o">/</span><span class="nb">arity</span><span class="s">$</span> form.
</div><div id="l210" class="code_block"><span class="k">\item</span>	A module can only export predicate symbols that are defined in
</div><div id="l211" class="code_block">        that module.  As a consequence, a module <span class="nb">{</span><span class="k">\em</span> cannot<span class="nb">}</span> export
</div><div id="l212" class="code_block">        predicate symbols that are imported from other modules.
</div><div id="l213" class="code_block">        This happens because an <span class="nb">{</span><span class="k">\tt</span> import<span class="nb">}</span> declaration is just a
</div><div id="l214" class="code_block">        request for permission to use a symbol from a module where
</div><div id="l215" class="code_block">        its definition and an <span class="nb">{</span><span class="k">\tt</span> export<span class="nb">}</span> declaration appear.
</div><div id="l216" class="code_block"><span class="k">\item</span>   The implicit module for a particular symbol appearing in a
</div><div id="l217" class="code_block">        module must be uniquely determined.  As a consequence, a
</div><div id="l218" class="code_block">        symbol of a specific <span class="s">$</span><span class="nb">functor</span><span class="o">/</span><span class="nb">arity</span><span class="s">$</span> <span class="nb">{</span><span class="k">\em</span> cannot<span class="nb">}</span> be declared
</div><div id="l219" class="code_block">        as both exported and local, or both exported and imported from
</div><div id="l220" class="code_block">        another module, or declared to be imported from more than one
</div><div id="l221" class="code_block">        module, etc.  These types of environment conflicts are
</div><div id="l222" class="code_block">        detected at compile-time and abort the compilation.
</div><div id="l223" class="code_block"><span class="k">\item</span>   It is an error to import a symbol from a module that does not
</div><div id="l224" class="code_block">        export it.  This error is <span class="nb">{</span><span class="k">\em</span> not<span class="k">\/</span><span class="nb">}</span> detected at compile-time
</div><div id="l225" class="code_block">        but at run-time when a call to that symbol is made.  If the
</div><div id="l226" class="code_block">        symbol is defined in, but not exported from the module that
</div><div id="l227" class="code_block">	defines it, an environment conflict error will take place.
</div><div id="l228" class="code_block">	If the symbol is not defined in that module an undefined
</div><div id="l229" class="code_block">	predicate/function error will be be reported to the user.
</div><div id="l230" class="code_block">	<span class="k">\index</span><span class="nb">{</span>errors!undefined predicate<span class="nb">}</span>
</div><div id="l231" class="code_block"><span class="k">\item</span>   In the current implementation, at any time only one symbol of
</div><div id="l232" class="code_block">        a specific <span class="s">$</span><span class="nb">functor</span><span class="o">/</span><span class="nb">arity</span><span class="s">$</span> form can appear in a module.  As an
</div><div id="l233" class="code_block">        immediate consequence of this fact, only one <span class="s">$</span><span class="nb">functor</span><span class="o">/</span><span class="nb">arity</span><span class="s">$</span>
</div><div id="l234" class="code_block">        symbol can be loaded into the current working module (<span class="nb">{</span><span class="k">\tt</span>
</div><div id="l235" class="code_block">        usermod<span class="nb">}</span>).  An attempt to load a module that redefines that
</div><div id="l236" class="code_block">        symbol results in a warning to the user and the newly loaded
</div><div id="l237" class="code_block">        symbol <span class="nb">{</span><span class="k">\em</span> overrides<span class="nb">}</span> the definition of the previously loaded
</div><div id="l238" class="code_block">        one.
</div><div id="l239" class="code_block"><span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>
</div><div id="l240" class="code_block">
</div><div id="l241" class="code_block"><span class="k">\section</span><span class="nb">{</span>The Dynamic Loader and its Search Path<span class="nb">}</span> <span class="k">\label</span><span class="nb">{</span>LibPath<span class="nb">}</span>
</div><div id="l242" class="code_block"><span class="k">\index</span><span class="nb">{</span>load search path<span class="nb">}</span>
</div><div id="l243" class="code_block"><span class="c">%===============================================================</span>
</div><div id="l244" class="code_block">The dynamic (or automatic) loader comprises one of XSB&#39;s 
</div><div id="l245" class="code_block">differences from other Prolog systems.
</div><div id="l246" class="code_block">In XSB, the loading of user modules Prolog libraries (including
</div><div id="l247" class="code_block">the XSB compiler itself) is delayed until predicates in them
</div><div id="l248" class="code_block">are actually needed, saving program space for large Prolog
</div><div id="l249" class="code_block">applications.  The delay in the loading is done automatically, unlike
</div><div id="l250" class="code_block">other systems where it must be explicitly specified for non-system
</div><div id="l251" class="code_block">libraries.
</div><div id="l252" class="code_block">
</div><div id="l253" class="code_block">When a predicate imported from another module (see
</div><div id="l254" class="code_block">Section~<span class="k">\ref</span><span class="nb">{</span>Modules<span class="nb">}</span>) is called during execution, the dynamic loader
</div><div id="l255" class="code_block">is invoked automatically if the module is not yet loaded into the
</div><div id="l256" class="code_block">system, The default action of the dynamic loader is to search for the
</div><div id="l257" class="code_block">byte code file of the module first in the system library directories
</div><div id="l258" class="code_block">(in the order <span class="nb">{</span><span class="k">\tt</span> lib, syslib<span class="nb">}</span>, and then <span class="nb">{</span><span class="k">\tt</span> cmplib<span class="nb">}</span>), and finally
</div><div id="l259" class="code_block">in the current working directory.  If the module is found in one of
</div><div id="l260" class="code_block">these directories, then it will be loaded (<span class="nb">{</span><span class="k">\em</span> on a first-found
</div><div id="l261" class="code_block">basis<span class="nb">}</span>). Otherwise, an error message will be displayed on the current
</div><div id="l262" class="code_block">output stream reporting that the module was not found.
</div><div id="l263" class="code_block">
</div><div id="l264" class="code_block">In fact, XSB loads the compiler and most system modules this way.
</div><div id="l265" class="code_block">Because of dynamic loading, the time it takes to compile a file 
</div><div id="l266" class="code_block">is slightly longer than usual the first time the compiler is 
</div><div id="l267" class="code_block">invoked in a session.
</div><div id="l268" class="code_block">
</div><div id="l269" class="code_block">
</div><div id="l270" class="code_block"><span class="k">\subsection</span><span class="nb">{</span>Changing the Default Search Path and the Packaging System<span class="nb">}</span>
</div><div id="l271" class="code_block"><span class="c">%=====================================================================</span>
</div><div id="l272" class="code_block">Users are allowed to supply their own library directories and also to
</div><div id="l273" class="code_block">override the default search path of the dynamic loader. 
</div><div id="l274" class="code_block">User-supplied library directories are searched by the dynamic loader 
</div><div id="l275" class="code_block"><span class="nb">{</span><span class="k">\em</span> before<span class="nb">}</span> searching the default library directories. 
</div><div id="l276" class="code_block"><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> library<span class="k">\_directory</span>/1<span class="nb">}}</span>
</div><div id="l277" class="code_block">
</div><div id="l278" class="code_block">The default search path of the dynamic loader can easily be changed
</div><div id="l279" class="code_block">by having a file named <span class="nb">{</span><span class="k">\verb</span>|.xsb/xsbrc.P|<span class="nb">}</span> in the user&#39;s home directory.  
</div><div id="l280" class="code_block">The <span class="nb">{</span><span class="k">\verb</span>|.xsb/xsbrc.P|<span class="nb">}</span> file, which is automatically consulted by the
</div><div id="l281" class="code_block"> XSB interpreter, might look like the following:
</div><div id="l282" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l283" class="code_block">             :- assert(library<span class="nb">_</span>directory(&#39;./&#39;)).
</div><div id="l284" class="code_block">             :- assert(library<span class="nb">_</span>directory(&#39;~/&#39;)).
</div><div id="l285" class="code_block">             :- assert(library<span class="nb">_</span>directory(&#39;~my<span class="nb">_</span>friend&#39;)).
</div><div id="l286" class="code_block">             :- assert(library<span class="nb">_</span>directory(&#39;/usr/lib/sbprolog&#39;)).
</div><div id="l287" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l288" class="code_block">After loading the module of the above example, the current working
</div><div id="l289" class="code_block">directory is searched first (as opposed to the default action of
</div><div id="l290" class="code_block">searching it last).  Also, XSB&#39;s system library directories
</div><div id="l291" class="code_block">(<span class="nb">{</span><span class="k">\tt</span> lib, syslib<span class="nb">}</span>, and <span class="nb">{</span><span class="k">\tt</span> cmplib<span class="nb">}</span>), will now be searched <span class="nb">{</span><span class="k">\em</span>
</div><div id="l292" class="code_block">after<span class="nb">}</span> searching the user&#39;s, <span class="nb">{</span><span class="k">\tt</span> my<span class="k">\_friend</span><span class="nb">}</span>&#39;s and the <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l293" class="code_block">&quot;/usr/lib/sbprolog/&quot;<span class="nb">}</span> directory.
</div><div id="l294" class="code_block">
</div><div id="l295" class="code_block"> In fact, XSB also uses <span class="nb">{</span><span class="k">\tt</span> library<span class="k">\_directory</span>/1<span class="nb">}</span> for internal purposes.
</div><div id="l296" class="code_block"> For instance, before the user&#39;s <span class="nb">{</span><span class="k">\verb</span>|.xsb/xsbrc.P|<span class="nb">}</span> is consulted,
</div><div id="l297" class="code_block"> XSB puts the <span class="nb">{</span><span class="k">\tt</span> packages<span class="nb">}</span> directory and the directory 
</div><div id="l298" class="code_block"> <span class="c">%%</span>
</div><div id="l299" class="code_block"> <span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l300" class="code_block">      .xsb/config/<span class="s">$</span><span class="nb">CONFIGURATION</span>
</div><div id="l301" class="code_block"><span class="nb"> </span><span class="nv">\end</span><span class="nb">{verbatim}</span>
</div><div id="l302" class="code_block"><span class="nb"> </span><span class="c">%%$</span>
</div><div id="l303" class="code_block"><span class="nb"> on the library search path.</span>
</div><div id="l304" class="code_block"><span class="nb"> The directory </span><span class="nv">\verb</span><span class="nb">&#39;.xsb</span><span class="o">/</span><span class="nb">config</span><span class="o">/</span><span class="s">$</span>CONFIGURATION&#39; is used to store user
</div><div id="l305" class="code_block"> libraries that are machine or OS dependent. (<span class="k">\verb</span>&#39;<span class="s">$</span><span class="nb">CONFIGURATION&#39; for a</span>
</div><div id="l306" class="code_block"><span class="nb"> machine is something that looks like {</span><span class="nv">\tt</span><span class="nb"> sparc</span><span class="o">-</span><span class="nb">sun</span><span class="o">-</span><span class="nb">solaris</span><span class="m">2</span><span class="nb">.</span><span class="m">6</span><span class="nb">} or</span>
</div><div id="l307" class="code_block"><span class="nb"> {</span><span class="nv">\tt</span><span class="nb"> pc</span><span class="o">-</span><span class="nb">linux</span><span class="o">-</span><span class="nb">gnu}, and is selected by XSB automatically at run time</span><span class="o">)</span><span class="nb">.  </span>
</div><div id="l308" class="code_block"><span class="nb"> </span><span class="c">%%$</span>
</div><div id="l309" class="code_block">
</div><div id="l310" class="code_block"><span class="nb">Note that the file {</span><span class="nv">\verb</span><span class="nb">|.xsb</span><span class="o">/</span><span class="nb">xsbrc.P|} is not limited to setting the</span>
</div><div id="l311" class="code_block"><span class="nb">library search path.  In fact, arbitrary Prolog code can go there.</span>
</div><div id="l312" class="code_block">
</div><div id="l313" class="code_block"><span class="nb">We emphasize that in the presence of a {</span><span class="nv">\verb</span><span class="nb">|.xsb</span><span class="o">/</span><span class="nb">xsbrc.P|} file {</span><span class="nv">\em</span>
</div><div id="l314" class="code_block"><span class="nb">it is the user&#39;s responsibility to avoid module name clashes with</span>
</div><div id="l315" class="code_block"><span class="nb">modules in XSB&#39;s system library directories}.  Such name clashes can</span>
</div><div id="l316" class="code_block"><span class="nb">cause the system to behave strangely since these modules will probably</span>
</div><div id="l317" class="code_block"><span class="nb">have different semantics from that expected by the XSB system code.</span>
</div><div id="l318" class="code_block"><span class="nb">The list of module names in XSB&#39;s system library directories can be</span>
</div><div id="l319" class="code_block"><span class="nb">found by looking through the directories {</span><span class="nv">\tt</span>
</div><div id="l320" class="code_block"><span class="nv">\$</span><span class="nb">XSB</span><span class="nv">\_</span><span class="nb">DIR</span><span class="o">/</span><span class="nv">\{</span><span class="nb">syslib,cmplib,lib</span><span class="nv">\}</span><span class="nb">}.</span>
</div><div id="l321" class="code_block">
</div><div id="l322" class="code_block"><span class="nv">\index</span><span class="nb">{packages}</span>
</div><div id="l323" class="code_block"><span class="nb">Apart from the user libraries, XSB now has a simple packaging system.</span>
</div><div id="l324" class="code_block"><span class="nb">A {</span><span class="nv">\em</span><span class="nb"> package</span><span class="nv">\/</span><span class="nb">} is an application consisting of one or more files that</span>
</div><div id="l325" class="code_block"><span class="nb">are organized in a subdirectory of one of the XSB system or user libraries.</span>
</div><div id="l326" class="code_block"><span class="nb">The system directory </span><span class="nv">\verb</span><span class="nb">|</span><span class="s">$</span>XSB<span class="nb">_</span>DIR/packages| has several examples
</div><div id="l327" class="code_block"><span class="c">%%$</span>
</div><div id="l328" class="code_block">of such packages, many of which are documented in Volume 2 of this
</div><div id="l329" class="code_block">manual.  Packages are convenient as a means of organizing large XSB
</div><div id="l330" class="code_block">applications, and for simplifying user interaction with such
</div><div id="l331" class="code_block">applications.  User-level packaging is implemented through the
</div><div id="l332" class="code_block">predicate
</div><div id="l333" class="code_block"><span class="c">%%</span>
</div><div id="l334" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l335" class="code_block">     bootstrap<span class="nb">_</span>userpackage(+LibraryDir, +PackageDir, +PackageName).
</div><div id="l336" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l337" class="code_block"><span class="c">%%</span>
</div><div id="l338" class="code_block"><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> bootstrap<span class="k">\_userpackage</span>/3<span class="nb">}}</span>
</div><div id="l339" class="code_block">which must be imported from the <span class="nb">{</span><span class="k">\tt</span> packaging<span class="nb">}</span> module. 
</div><div id="l340" class="code_block">
</div><div id="l341" class="code_block">To illustrate, suppose you wanted to create a package, <span class="nb">{</span><span class="k">\tt</span> foobar<span class="nb">}</span>, inside
</div><div id="l342" class="code_block">your own library, <span class="nb">{</span><span class="k">\tt</span> my<span class="k">\_lib</span><span class="nb">}</span>. Here is a sequence of steps you can
</div><div id="l343" class="code_block">follow:  
</div><div id="l344" class="code_block"><span class="c">%%</span>
</div><div id="l345" class="code_block"><span class="k">\begin</span><span class="nb">{</span>enumerate<span class="nb">}</span>
</div><div id="l346" class="code_block"><span class="k">\item</span> Make sure that <span class="nb">{</span><span class="k">\tt</span> my<span class="k">\_lib</span><span class="nb">}</span> is on the library search path by putting
</div><div id="l347" class="code_block">  an appropriate assert statement in your <span class="nb">{</span><span class="k">\tt</span> xsbrc.P<span class="nb">}</span>.
</div><div id="l348" class="code_block"><span class="k">\item</span> Make subdirectory <span class="k">\verb</span>|~/my<span class="nb">_</span>lib/foobar| and organize all the
</div><div id="l349" class="code_block">  package files there. Designate one file, say, <span class="nb">{</span><span class="k">\tt</span> foo.P<span class="nb">}</span>, as the
</div><div id="l350" class="code_block">  entry point, <span class="nb">{</span><span class="k">\it</span> i.e.<span class="nb">}</span>, the application file that must be loaded first.
</div><div id="l351" class="code_block"><span class="k">\item</span> Create the interface program <span class="k">\verb</span>|~/my<span class="nb">_</span>lib/foobar.P| with the
</div><div id="l352" class="code_block">  following content:
</div><div id="l353" class="code_block">    <span class="c">%%</span>
</div><div id="l354" class="code_block">    <span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l355" class="code_block">           :- bootstrap<span class="nb">_</span>userpackage(&#39;~/my<span class="nb">_</span>lib&#39;, &#39;foobar&#39;, foobar), [foo].
</div><div id="l356" class="code_block">    <span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l357" class="code_block">    <span class="c">%%</span>
</div><div id="l358" class="code_block">  The interface program and the package directory do not need to have the
</div><div id="l359" class="code_block">  same name, but it is convenient to follow the above naming schema.
</div><div id="l360" class="code_block"><span class="k">\item</span> Now, if you need to invoke the <span class="nb">{</span><span class="k">\tt</span> foobar<span class="nb">}</span> application, you can
</div><div id="l361" class="code_block">  simply type <span class="k">\verb</span>|[foobar].| at the XSB prompt. This is because both and
</div><div id="l362" class="code_block">  <span class="k">\verb</span>|~/my<span class="nb">_</span>lib/foobar| have already been automatically added to the
</div><div id="l363" class="code_block">  library search path.
</div><div id="l364" class="code_block"><span class="k">\item</span> If your application files export many predicates, you can simplify
</div><div id="l365" class="code_block">  the use of your package by having <span class="k">\verb</span>|~/my<span class="nb">_</span>lib/foobar.P| import all
</div><div id="l366" class="code_block">  these predicates, renaming them, and then exporting them. This provides a
</div><div id="l367" class="code_block">  uniform interface to the <span class="nb">{</span><span class="k">\tt</span> foobar<span class="nb">}</span> module, since all the package
</div><div id="l368" class="code_block">  predicates are can now be imported from just one module, <span class="nb">{</span><span class="k">\tt</span> foobar<span class="nb">}</span>.
</div><div id="l369" class="code_block"><span class="k">\end</span><span class="nb">{</span>enumerate<span class="nb">}</span>
</div><div id="l370" class="code_block"><span class="c">%%</span>
</div><div id="l371" class="code_block">In addition to adding the appropriate directory to the library search
</div><div id="l372" class="code_block">path, the <span class="k">\verb</span>|bootstrap<span class="nb">_</span>userpackage/3| predicate also adds
</div><div id="l373" class="code_block">information to the predicate <span class="k">\verb</span>|package<span class="nb">_</span>configuration/3|, so that
</div><div id="l374" class="code_block">other applications could query the information about loaded packages.
</div><div id="l375" class="code_block">
</div><div id="l376" class="code_block">Packages can also be unloaded using the predicate
</div><div id="l377" class="code_block"><span class="k">\verb</span>|unload<span class="nb">_</span>package/1|. For instance, 
</div><div id="l378" class="code_block">
</div><div id="l379" class="code_block"><span class="c">%%</span>
</div><div id="l380" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l381" class="code_block">       :- unload<span class="nb">_</span>package(foobar).  
</div><div id="l382" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l383" class="code_block"><span class="c">%%</span>
</div><div id="l384" class="code_block">removes the directory <span class="k">\verb</span>|~/my<span class="nb">_</span>lib/foobar| from the library search path
</div><div id="l385" class="code_block">and deletes the associated information from <span class="k">\verb</span>|package<span class="nb">_</span>configuration/3|.
</div><div id="l386" class="code_block"><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> unload<span class="k">\_package</span>/1<span class="nb">}}</span>
</div><div id="l387" class="code_block"><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> package<span class="k">\_configuration</span>/2<span class="nb">}}</span>
</div><div id="l388" class="code_block">
</div><div id="l389" class="code_block">Finally, if you developed and tested  a package that you think is
</div><div id="l390" class="code_block">generally useful and you would like to distribute it with XSB, please
</div><div id="l391" class="code_block">contact <span class="nb">{</span><span class="k">\tt</span> xsb-development@sourceforge.net<span class="nb">}</span>.
</div><div id="l392" class="code_block">
</div><div id="l393" class="code_block">
</div><div id="l394" class="code_block"><span class="k">\subsection</span><span class="nb">{</span>Dynamically loading predicates in the interpreter<span class="nb">}</span>
</div><div id="l395" class="code_block"><span class="c">%=============================================================</span>
</div><div id="l396" class="code_block">Modules are usually loaded into an environment when they are consulted
</div><div id="l397" class="code_block">(see Section~<span class="k">\ref</span><span class="nb">{</span>Consulting<span class="nb">}</span>).  Specific predicates from a module can
</div><div id="l398" class="code_block">also be imported into the run-time environment through the standard
</div><div id="l399" class="code_block">predicate <span class="nb">{</span><span class="k">\tt</span> import PredList from Module<span class="nb">}</span><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> import/1<span class="nb">}}</span>.
</div><div id="l400" class="code_block">Here, <span class="nb">{</span><span class="k">\tt</span> PredList<span class="nb">}</span> can either be a Prolog list or a comma list.
</div><div id="l401" class="code_block">(The <span class="nb">{</span><span class="k">\tt</span> import/1<span class="nb">}</span> can also be used as a directive in a source module
</div><div id="l402" class="code_block">(see Section~<span class="k">\ref</span><span class="nb">{</span>Modules<span class="nb">}</span>). <span class="k">\index</span><span class="nb">{</span>standard predicates<span class="nb">}</span>
</div><div id="l403" class="code_block">
</div><div id="l404" class="code_block">We provide a sample session for compiling, dynamically loading, and 
</div><div id="l405" class="code_block">querying a user-defined module named <span class="nb">{</span><span class="k">\tt</span> quick<span class="k">\_sort</span><span class="nb">}</span>.
</div><div id="l406" class="code_block">For this example we assume that <span class="nb">{</span><span class="k">\tt</span> quick<span class="k">\_sort</span><span class="nb">}</span> is a file in the 
</div><div id="l407" class="code_block">current working directory, and contains the definitions of the
</div><div id="l408" class="code_block">predicates <span class="nb">{</span><span class="k">\tt</span> concat/3<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> qsort/2<span class="nb">}</span>, both of which are exported.
</div><div id="l409" class="code_block">
</div><div id="l410" class="code_block"><span class="nb">{</span><span class="k">\footnotesize</span>
</div><div id="l411" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l412" class="code_block">             | ?- compile(quick<span class="nb">_</span>sort).
</div><div id="l413" class="code_block">             [Compiling ./quick<span class="nb">_</span>sort]
</div><div id="l414" class="code_block">             [quick<span class="nb">_</span>sort compiled, cpu time used: 1.439 seconds]
</div><div id="l415" class="code_block">
</div><div id="l416" class="code_block">             yes
</div><div id="l417" class="code_block">             | ?- import concat/3, qsort/2 from quick<span class="nb">_</span>sort. 
</div><div id="l418" class="code_block">
</div><div id="l419" class="code_block">             yes
</div><div id="l420" class="code_block">             | ?- concat([1,3], [2], L), qsort(L, S).
</div><div id="l421" class="code_block">
</div><div id="l422" class="code_block">             L = [1,3,2]
</div><div id="l423" class="code_block">             S = [1,2,3]
</div><div id="l424" class="code_block">
</div><div id="l425" class="code_block">             yes.
</div><div id="l426" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l427" class="code_block"><span class="nb">}</span>
</div><div id="l428" class="code_block">
</div><div id="l429" class="code_block">The standard predicate <span class="nb">{</span><span class="k">\tt</span> import/1<span class="nb">}</span> does not load the module 
</div><div id="l430" class="code_block">containing the imported predicates, but simply informs the system 
</div><div id="l431" class="code_block">where it can find the definition of the predicate when (and if) the
</div><div id="l432" class="code_block">predicate is called.
</div><div id="l433" class="code_block">
</div><div id="l434" class="code_block">
</div><div id="l435" class="code_block"><span class="k">\section</span><span class="nb">{</span>Command Line Arguments<span class="nb">}</span> <span class="k">\label</span><span class="nb">{</span>sec:EmuOptions<span class="nb">}</span>
</div><div id="l436" class="code_block"><span class="c">%========================================================</span>
</div><div id="l437" class="code_block"><span class="k">\index</span><span class="nb">{</span>emulator!command line options<span class="nb">}</span>
</div><div id="l438" class="code_block"><span class="k">\index</span><span class="nb">{</span>options!command line arguments<span class="nb">}</span>
</div><div id="l439" class="code_block"><span class="k">\index</span><span class="nb">{</span>stacks!default sizes<span class="nb">}</span>
</div><div id="l440" class="code_block"><span class="k">\index</span><span class="nb">{</span>stacks!expanding<span class="nb">}</span>
</div><div id="l441" class="code_block"><span class="c">%========================================================</span>
</div><div id="l442" class="code_block">
</div><div id="l443" class="code_block">There are several command line options for the emulator. The general 
</div><div id="l444" class="code_block">synopsis is:
</div><div id="l445" class="code_block"><span class="nb">{</span><span class="k">\small</span> 
</div><div id="l446" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l447" class="code_block">xsb [flags] [-l] [-i]
</div><div id="l448" class="code_block">xsb [flags] -n
</div><div id="l449" class="code_block">xsb [flags] module
</div><div id="l450" class="code_block">xsb [flags] -B boot<span class="nb">_</span>module [-D cmd<span class="nb">_</span>loop<span class="nb">_</span>driver] [-t] [-e goal]
</div><div id="l451" class="code_block">xsb [flags] -B module<span class="nb">_</span>to<span class="nb">_</span>disassemble -d
</div><div id="l452" class="code_block">xsb -[h | v]
</div><div id="l453" class="code_block">xsb --help | --version | --nobanner | --quietload | --noprompt
</div><div id="l454" class="code_block">
</div><div id="l455" class="code_block">memory management flags:
</div><div id="l456" class="code_block">    -c tcpsize | -m glsize | -o complsize | -u pdlsize | -r | -g gc<span class="nb">_</span>type
</div><div id="l457" class="code_block">miscellaneous flags:
</div><div id="l458" class="code_block">    -s | -S | -T
</div><div id="l459" class="code_block">
</div><div id="l460" class="code_block">module:
</div><div id="l461" class="code_block">    Module to execute after XSB starts up.
</div><div id="l462" class="code_block">    Module should have no suffixes, no directory part, and
</div><div id="l463" class="code_block">    the file module.O must be on the library search path.
</div><div id="l464" class="code_block">boot<span class="nb">_</span>module:
</div><div id="l465" class="code_block">    This is a developer&#39;s option.
</div><div id="l466" class="code_block">    The -B flags tells XSB which bootstrapping module to use instead
</div><div id="l467" class="code_block">    of the standard loader.  The loader must be specified using its
</div><div id="l468" class="code_block">    full pathname, and boot<span class="nb">_</span>module.O must exist.
</div><div id="l469" class="code_block">module<span class="nb">_</span>to<span class="nb">_</span>disassemble:
</div><div id="l470" class="code_block">    This is a developer&#39;s option.
</div><div id="l471" class="code_block">    The -d flag tells XSB to act as a disassembler.
</div><div id="l472" class="code_block">    The -B flag specifies the module to disassemble.
</div><div id="l473" class="code_block">cmd<span class="nb">_</span>loop<span class="nb">_</span>driver:
</div><div id="l474" class="code_block">    The top-level command loop driver to be used instead of the
</div><div id="l475" class="code_block">    standard one.  Usually needed when XSB is run as a server.
</div><div id="l476" class="code_block">
</div><div id="l477" class="code_block">           -i : bring up the XSB interpreter
</div><div id="l478" class="code_block">      -e goal : evaluate goal when XSB starts up
</div><div id="l479" class="code_block">           -l : the interpreter prints unbound variables using letters
</div><div id="l480" class="code_block">           -n : used when calling XSB from C
</div><div id="l481" class="code_block">           -B : specify the boot module to use in lieu of the standard loader
</div><div id="l482" class="code_block">           -D : Sets top-level command loop driver to replace the default
</div><div id="l483" class="code_block">           -t : trace execution at the SLG-WAM instruction level
</div><div id="l484" class="code_block">                  (for this to work, build XSB with the --debug option)
</div><div id="l485" class="code_block">           -d : disassemble the loader and exit
</div><div id="l486" class="code_block">         -c N : allocate N KB for the trail/choice-point stack
</div><div id="l487" class="code_block">         -m N : allocate N KB for the local/global stack
</div><div id="l488" class="code_block">         -o N : allocate N KB for the SLG completion stack
</div><div id="l489" class="code_block">         -u N : allocate N KB for the SLG unification stack
</div><div id="l490" class="code_block">           -r : turn off automatic stack expansion
</div><div id="l491" class="code_block">   -g gc<span class="nb">_</span>type : choose the garbage collection (&quot;none&quot;, &quot;indirection&quot;, sliding&quot;, or &quot;copying&quot;) 
</div><div id="l492" class="code_block">           -s : maintain detailed statistical information
</div><div id="l493" class="code_block">           -S : set default tabling method to subsumption-based
</div><div id="l494" class="code_block">           -T : print a trace of each called predicate
</div><div id="l495" class="code_block">-v, --version : print the version and configuration information about XSB
</div><div id="l496" class="code_block">   -h, --help : print this help message
</div><div id="l497" class="code_block">   --nobanner : don&#39;t show the XSB banner on startup
</div><div id="l498" class="code_block">  --quietload : don&#39;t show the `module loaded&#39; messages
</div><div id="l499" class="code_block">   --noprompt : don&#39;t show prompt (for non-interactive use)
</div><div id="l500" class="code_block">
</div><div id="l501" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l502" class="code_block"><span class="nb">}</span>
</div><div id="l503" class="code_block">The order in which these options appear makes no difference.
</div><div id="l504" class="code_block">
</div><div id="l505" class="code_block"><span class="k">\begin</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l506" class="code_block"><span class="k">\item</span><span class="na">[{\tt -i}]</span> Brings up the XSB interpreter.  This is the normal use
</div><div id="l507" class="code_block">        and because of this, use of this option is optional and is
</div><div id="l508" class="code_block">        only kept for backwards compatibility.
</div><div id="l509" class="code_block"><span class="k">\item</span><span class="na">[{\tt -l}]</span> Forces the interpreter to print unbound variables as
</div><div id="l510" class="code_block">	letters, as opposed to the default setting which prints
</div><div id="l511" class="code_block">	variables as memory locations prefixed with an underscore.
</div><div id="l512" class="code_block">	For example, starting XSB&#39;s interpreter with this option will
</div><div id="l513" class="code_block">	print the following:
</div><div id="l514" class="code_block">        <span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l515" class="code_block">                  | ?- Y = X, Z = 3, W = foo(X,Z).
</div><div id="l516" class="code_block">
</div><div id="l517" class="code_block">                  Y = A
</div><div id="l518" class="code_block">                  X = A
</div><div id="l519" class="code_block">                  Z = 3
</div><div id="l520" class="code_block">                  W = foo(A,3)
</div><div id="l521" class="code_block">	<span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l522" class="code_block">	as opposed to something like the following:
</div><div id="l523" class="code_block">	<span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l524" class="code_block">                  | ?- Y = X, Z = 3, W = foo(X,Z).
</div><div id="l525" class="code_block">
</div><div id="l526" class="code_block">                  Y = <span class="nb">_</span>10073976
</div><div id="l527" class="code_block">                  X = <span class="nb">_</span>10073976
</div><div id="l528" class="code_block">                  Z = 3
</div><div id="l529" class="code_block">                  W = foo(<span class="nb">_</span>10073976,3);
</div><div id="l530" class="code_block">	<span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l531" class="code_block"><span class="k">\item</span><span class="na">[{\tt -n}]</span> used in conjunction with the <span class="nb">{</span><span class="k">\tt</span> -i<span class="nb">}</span> option, to
</div><div id="l532" class="code_block">    indicate that the usual read-eval-print top-loop is not to be
</div><div id="l533" class="code_block">    entered, but instead will interface to a calling C program.  See
</div><div id="l534" class="code_block">    the chapter <span class="nb">{</span><span class="k">\it</span> Calling XSB from C<span class="nb">}</span> in Volume 2  for details.
</div><div id="l535" class="code_block"><span class="k">\item</span><span class="na">[{\tt -d}]</span> Produces a disassembled dump of <span class="nb">{</span><span class="k">\tt</span> byte<span class="k">\_code\_file</span><span class="nb">}</span> to 
</div><div id="l536" class="code_block">    <span class="nb">{</span><span class="k">\tt</span> stdout<span class="nb">}</span> and exits.
</div><div id="l537" class="code_block"><span class="k">\item</span><span class="na">[{\tt -c} {\em size}]</span> Allocates <span class="nb">{</span><span class="k">\em</span> initial  size<span class="k">\/</span><span class="nb">}</span> KB of space
</div><div id="l538" class="code_block">    to the trail/choice-point stack area.  The trail stack grows
</div><div id="l539" class="code_block">    upward from the bottom of the region, and the choice point stack
</div><div id="l540" class="code_block">    grows downward from the top of the region.  Because this region is
</div><div id="l541" class="code_block">    expanded automatically from Version 1.6.0 onward, this option
</div><div id="l542" class="code_block">    should rarely need to be used.  Default initial size: 768 Kbytes.
</div><div id="l543" class="code_block"><span class="k">\item</span><span class="na">[{\tt -m} {\em size}]</span> Allocates <span class="nb">{</span><span class="k">\em</span> size<span class="k">\/</span><span class="nb">}</span> Kbytes
</div><div id="l544" class="code_block">    of space to the local/global stack area.  The global stack grows 
</div><div id="l545" class="code_block">    upward from the bottom of the region, and the local stack grows 
</div><div id="l546" class="code_block">    downward from the top of the region.  Default: 768 Kbytes.
</div><div id="l547" class="code_block"><span class="k">\item</span><span class="na">[{\tt -o} {\em size}]</span> Allocates <span class="nb">{</span><span class="k">\em</span> size<span class="k">\/</span><span class="nb">}</span> Kbytes of space
</div><div id="l548" class="code_block">    to the completion stack area.  Because this region is expanded
</div><div id="l549" class="code_block">    automatically from Version 1.6.0 onward, this option should rarely
</div><div id="l550" class="code_block">    need to be used. Default initial size 64 Kbytes.
</div><div id="l551" class="code_block"><span class="k">\item</span><span class="na">[{\tt -u} {\em size}]</span> Allocates <span class="nb">{</span><span class="k">\em</span> size<span class="nb">}</span> Kbytes of space
</div><div id="l552" class="code_block">    to the unification (and table copy) stack.  Default 64 Kbytes.
</div><div id="l553" class="code_block">    (This option should rarely need to be used).
</div><div id="l554" class="code_block"><span class="k">\item</span><span class="na">[{\tt -D}]</span> Tells XSB to use a top-level command loop driver specified
</div><div id="l555" class="code_block">  here instead of the standard XSB interpreter. This is most useful when
</div><div id="l556" class="code_block">  XSB is used as a server.
</div><div id="l557" class="code_block"><span class="k">\item</span><span class="na">[{\tt -r}]</span> Turns off automatic stack expansion.
</div><div id="l558" class="code_block"><span class="c">%</span>
</div><div id="l559" class="code_block"><span class="k">\index</span><span class="nb">{</span>garbage collection<span class="nb">}</span>
</div><div id="l560" class="code_block"><span class="k">\item</span><span class="na">[{\tt -g gc\_type}]</span> Chooses the garbage collection strategy that
</div><div id="l561" class="code_block">is employed; choice of the strategy is between <span class="nb">{</span><span class="k">\tt</span> &quot;none&quot;<span class="nb">}</span> (meaning
</div><div id="l562" class="code_block">perform no garbage collection), or garbage collection based on <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l563" class="code_block">sliding<span class="nb">}</span> on <span class="nb">{</span><span class="k">\tt</span> copying<span class="nb">}</span>, or on <span class="nb">{</span><span class="k">\tt</span> indirection<span class="nb">}</span> (See
</div><div id="l564" class="code_block"><span class="k">\cite</span><span class="nb">{</span>CATmem@ISMM-98<span class="nb">}</span> for descriptions of the first two garbage
</div><div id="l565" class="code_block">collectors, and <span class="k">\cite</span><span class="nb">{</span>CaSC01<span class="nb">}</span> for a description of the third).  The
</div><div id="l566" class="code_block">choice <span class="nb">{</span><span class="k">\tt</span> indirection<span class="nb">}</span> is not available on CHAT, and this choice
</div><div id="l567" class="code_block">will be ineffective on emulators configured for CHAT.
</div><div id="l568" class="code_block"><span class="c">%</span>
</div><div id="l569" class="code_block"><span class="k">\item</span><span class="na">[{\tt -s}]</span> Maintains information on the size of program stacks 
</div><div id="l570" class="code_block">    for the predicate <span class="nb">{</span><span class="k">\tt</span> statistics/0<span class="nb">}</span>.  This option may be expected
</div><div id="l571" class="code_block">    to slow execution by around 10<span class="k">\%</span>.  Default: off.
</div><div id="l572" class="code_block"><span class="k">\item</span><span class="na">[{\tt -S}]</span> Indicates that tabled predicates are to be evaluated
</div><div id="l573" class="code_block">    using subsumption-based tabling as a default for tabled predicates
</div><div id="l574" class="code_block">    whose tabling method is not specified by using <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l575" class="code_block">    use<span class="k">\_variant\_tabling</span>/1<span class="nb">}</span> or <span class="nb">{</span><span class="k">\tt</span> use<span class="k">\_subsumptive\_tabling</span>/1<span class="nb">}</span> (see
</div><div id="l576" class="code_block">    Section <span class="k">\ref</span><span class="nb">{</span>sec:TablePred:Decl<span class="nb">&amp;</span>Mod<span class="nb">}</span>).  If this option is not
</div><div id="l577" class="code_block">    specified, variant-based tabling will be used as the default tabling
</div><div id="l578" class="code_block">    method by XSB<span class="k">\@</span>.
</div><div id="l579" class="code_block"><span class="k">\item</span><span class="na">[{\tt -T}]</span> Generates a trace at entry to each called predicate
</div><div id="l580" class="code_block">    (both system and user-defined).  This option is available mainly
</div><div id="l581" class="code_block">    for people who want to modify and/or extend XSB, and it is
</div><div id="l582" class="code_block">    <span class="nb">{</span><span class="k">\em</span> not<span class="k">\/</span><span class="nb">}</span> the normal way to trace XSB programs.  For the
</div><div id="l583" class="code_block">    latter, the builtin predicates <span class="nb">{</span><span class="k">\tt</span> trace/0<span class="nb">}</span> or <span class="nb">{</span><span class="k">\tt</span> debug/0<span class="nb">}</span>
</div><div id="l584" class="code_block">    should be used (see Chapter~<span class="k">\ref</span><span class="nb">{</span>debugging<span class="nb">}</span>).
</div><div id="l585" class="code_block">
</div><div id="l586" class="code_block">    Note: This option is not available when the system is being used
</div><div id="l587" class="code_block">    at the non-tracing mode (see Section~<span class="k">\ref</span><span class="nb">{</span>debugging<span class="nb">}</span>).
</div><div id="l588" class="code_block"><span class="k">\item</span><span class="na">[{\tt -t}]</span> Traces through code at SLG-WAM instruction level.  This
</div><div id="l589" class="code_block">    option is for internal debugging and is not fully supported.
</div><div id="l590" class="code_block">    It is also not available when the system is being used at the non-debug
</div><div id="l591" class="code_block">    mode (see Section~<span class="k">\ref</span><span class="nb">{</span>debugging<span class="nb">}</span>).
</div><div id="l592" class="code_block"><span class="k">\item</span><span class="na">[{\tt -e goal}]</span> Pass <span class="nb">{</span><span class="k">\tt</span> goal<span class="nb">}</span>  to XSB at startup. This goal is evaluated
</div><div id="l593" class="code_block">    right before the first prompt is issued. For instance, 
</div><div id="l594" class="code_block">    <span class="k">\verb</span>&#39;xsb -e &quot;write(&#39;Hello!&#39;), nl.&quot;&#39;
</div><div id="l595" class="code_block">    will print a heart-warming message when XSB starts up.
</div><div id="l596" class="code_block">  <span class="k">\item</span><span class="na">[{\tt --nobanner}]</span> Start XSB without showing the startup banner.
</div><div id="l597" class="code_block">    Useful in batch scripts and for interprocess communication (when XSB is
</div><div id="l598" class="code_block">    launched as a subprocess).
</div><div id="l599" class="code_block">  <span class="k">\item</span><span class="na">[{\tt --quietload}]</span> Do not tell when a new module gets loaded. Again, is
</div><div id="l600" class="code_block">    useful in non-interactive activities and for interprocess communication.
</div><div id="l601" class="code_block">  <span class="k">\item</span><span class="na">[{\tt --noprompt}]</span> Do not show the XSB prompt. This is useful only in batch
</div><div id="l602" class="code_block">    mode and in interprocess communication when you do not want the prompt
</div><div id="l603" class="code_block">    to clutter the picture.
</div><div id="l604" class="code_block"><span class="k">\end</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l605" class="code_block">
</div><div id="l606" class="code_block">As an example, a program which uses more heap and local stack than the
</div><div id="l607" class="code_block">default configuration of XSB might be run by invoking XSB with the command.
</div><div id="l608" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l609" class="code_block">         xsb -m 2000
</div><div id="l610" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l611" class="code_block">
</div><div id="l612" class="code_block">
</div><div id="l613" class="code_block"><span class="k">\section</span><span class="nb">{</span>Memory Management<span class="nb">}</span><span class="k">\label</span><span class="nb">{</span>memory<span class="nb">_</span>management<span class="nb">}</span>
</div><div id="l614" class="code_block"><span class="k">\index</span><span class="nb">{</span>memory management<span class="nb">}</span>
</div><div id="l615" class="code_block"><span class="k">\index</span><span class="nb">{</span>garbage collection<span class="nb">}</span>
</div><div id="l616" class="code_block"><span class="c">%===================================================</span>
</div><div id="l617" class="code_block">All execution stacks are automatically expanded in <span class="k">\version</span><span class="nb">{}</span>,
</div><div id="l618" class="code_block">including the local stack/heap region, the trail/choice point region,
</div><div id="l619" class="code_block">and the completion stack region.  Each of these regions begin with an
</div><div id="l620" class="code_block">initial value set by the user (or the default stated in
</div><div id="l621" class="code_block">Section~<span class="k">\ref</span><span class="nb">{</span>sec:EmuOptions<span class="nb">}</span>), and double their size until it is not
</div><div id="l622" class="code_block">possible to do so with available system memory.  At that point XSB
</div><div id="l623" class="code_block">tries to find the maximal amount of space that will still fit in
</div><div id="l624" class="code_block">system memory.  Garbage collection is automatically performed for
</div><div id="l625" class="code_block">retracted clauses.  In addition, heap garbage collection is
</div><div id="l626" class="code_block">automatically included in XSB <span class="k">\cite</span><span class="nb">{</span>CaSC01,CATmem@ISMM-98<span class="nb">}</span>.  (To
</div><div id="l627" class="code_block">change the algorithm used for heap garbage collection or to turn it
</div><div id="l628" class="code_block">off altogether, see the predicate <span class="nb">{</span><span class="k">\tt</span> garbage<span class="k">\_collection</span>/1<span class="nb">}</span> or
</div><div id="l629" class="code_block">Section~<span class="k">\ref</span><span class="nb">{</span>sec:EmuOptions<span class="nb">}</span> for command-line options).
</div><div id="l630" class="code_block">
</div><div id="l631" class="code_block">The program area (the area into which the code is loaded) is also
</div><div id="l632" class="code_block">dynamically expanded as needed, and the area occupied by dynamic code
</div><div id="l633" class="code_block">(created using <span class="nb">{</span><span class="k">\tt</span> assert/1<span class="nb">}</span>, or the standard predicate <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l634" class="code_block">load<span class="k">\_dyn</span>/1<span class="nb">}</span>) is reclaimed when that code is retracted.  <span class="k">\version</span><span class="nb">{}</span>
</div><div id="l635" class="code_block">provides memory management for table space as well.  Space for tables
</div><div id="l636" class="code_block">is dynamically allocated as needed and reclaimed through use of the
</div><div id="l637" class="code_block">predicates <span class="nb">{</span><span class="k">\tt</span> abolish<span class="k">\_all\_tables</span>/0<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> abolish<span class="k">\_table\_pred</span>/1<span class="nb">}</span>
</div><div id="l638" class="code_block"><span class="c">%,{\tt abolish\_table\_call/1}.  </span>
</div><div id="l639" class="code_block">(see Section~<span class="k">\ref</span><span class="nb">{</span>sec:TablingPredicates<span class="nb">}</span>).
</div><div id="l640" class="code_block">
</div><div id="l641" class="code_block"><span class="k">\section</span><span class="nb">{</span>Compiling and Consulting<span class="nb">}</span> <span class="k">\label</span><span class="nb">{</span>Consulting<span class="nb">}</span>
</div><div id="l642" class="code_block"><span class="c">%====================================================</span>
</div><div id="l643" class="code_block">In XSB, both compiled and interpreted code are transformed into
</div><div id="l644" class="code_block">SLG-WAM instructions.  The main differences are that compiled code may
</div><div id="l645" class="code_block">be more optimized than interpreted code, and that compilation produces
</div><div id="l646" class="code_block">an object code file.
</div><div id="l647" class="code_block">
</div><div id="l648" class="code_block"><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> consult/[1,2]<span class="nb">}}</span>
</div><div id="l649" class="code_block">This section describes the actions of the standard predicate <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l650" class="code_block">consult/[1,2]<span class="nb">}</span> (and of <span class="nb">{</span><span class="k">\tt</span> reconsult/[1,2]<span class="nb">}</span> which is defined to have
</div><div id="l651" class="code_block">the same actions as <span class="nb">{</span><span class="k">\tt</span> consult/[1,2]<span class="nb">}</span>).  <span class="nb">{</span><span class="k">\tt</span> consult/[1,2]<span class="nb">}</span> is the
</div><div id="l652" class="code_block">most convenient method for entering rules into XSB&#39;s database.  Though
</div><div id="l653" class="code_block"><span class="nb">{</span><span class="k">\tt</span> consult<span class="nb">}</span> comes in many flavors, the most general form is:
</div><div id="l654" class="code_block"><span class="k">\begin</span><span class="nb">{</span>center<span class="nb">}{</span><span class="k">\tt</span>
</div><div id="l655" class="code_block">	consult(+FileList, +CompilerOptionList) <span class="nb">}</span>
</div><div id="l656" class="code_block"><span class="k">\end</span><span class="nb">{</span>center<span class="nb">}</span> 
</div><div id="l657" class="code_block">At the time of the call both of its arguments should be instantiated
</div><div id="l658" class="code_block">(ground).  <span class="nb">{</span><span class="k">\tt</span> FileList<span class="nb">}</span> is a list of filenames or module names (see
</div><div id="l659" class="code_block">Section~<span class="k">\ref</span><span class="nb">{</span>Modules<span class="nb">}</span>) and <span class="nb">{</span><span class="k">\tt</span> CompilerOptionList<span class="nb">}</span> is a list of
</div><div id="l660" class="code_block">options that are to be passed to the compiler when (and if) it should
</div><div id="l661" class="code_block">be invoked.  For a detailed description of the format and the options
</div><div id="l662" class="code_block">that can appear in this list see Section~<span class="k">\ref</span><span class="nb">{</span>the<span class="nb">_</span>compiler<span class="nb">}</span>.
</div><div id="l663" class="code_block">
</div><div id="l664" class="code_block">If the user wants to consult one module (file) only, she can provide an
</div><div id="l665" class="code_block">atom instead of a list for the first argument of <span class="nb">{</span><span class="k">\tt</span> consult/2<span class="nb">}</span>.
</div><div id="l666" class="code_block">Furthermore, if there isn&#39;t any need for special compilation options the
</div><div id="l667" class="code_block">following two forms:
</div><div id="l668" class="code_block"><span class="k">\begin</span><span class="nb">{</span>center<span class="nb">}{</span><span class="k">\tt</span>
</div><div id="l669" class="code_block">	    [FileName]. <span class="k">\\</span>
</div><div id="l670" class="code_block">	consult(FileName).
</div><div id="l671" class="code_block"><span class="nb">}</span><span class="k">\end</span><span class="nb">{</span>center<span class="nb">}</span>
</div><div id="l672" class="code_block">are just notational shorthands for:
</div><div id="l673" class="code_block"><span class="k">\begin</span><span class="nb">{</span>center<span class="nb">}{</span><span class="k">\tt</span>
</div><div id="l674" class="code_block">	consult(FileName, []).
</div><div id="l675" class="code_block"><span class="nb">}</span><span class="k">\end</span><span class="nb">{</span>center<span class="nb">}</span>
</div><div id="l676" class="code_block">
</div><div id="l677" class="code_block">Consulting a module (file) generally consists of the following five
</div><div id="l678" class="code_block">steps which are described in detail in the next paragraphs.
</div><div id="l679" class="code_block"><span class="k">\begin</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l680" class="code_block"><span class="k">\item</span><span class="na">[Name Resolution]</span>: determine the module to be consulted.
</div><div id="l681" class="code_block"><span class="k">\item</span><span class="na">[Compilation]</span>:  if necessary (and the source file is not too big),
</div><div id="l682" class="code_block">      compile the module using predicate <span class="nb">{</span><span class="k">\tt</span> compile/2<span class="nb">}</span> with the options
</div><div id="l683" class="code_block">      specified.
</div><div id="l684" class="code_block"><span class="k">\item</span><span class="na">[Loading]</span> load the object code of the module into memory.
</div><div id="l685" class="code_block"><span class="k">\item</span><span class="na">[Importing]</span> import all the exported predicates of that module to
</div><div id="l686" class="code_block">      the current working module (<span class="nb">{</span><span class="k">\tt</span> usermod<span class="nb">}</span>).
</div><div id="l687" class="code_block"><span class="k">\item</span><span class="na">[Query Execution]</span>: execute any queries that the module may contain.
</div><div id="l688" class="code_block"><span class="k">\end</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l689" class="code_block">
</div><div id="l690" class="code_block">There are two steps to name resolution: determination of the proper
</div><div id="l691" class="code_block">directory prefix and determination of the proper extension.  When <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l692" class="code_block">FileName<span class="nb">}</span> is absolute (i.e. in UNIX contains a slash <span class="nb">{</span><span class="k">\tt</span> &#39;/&#39;<span class="nb">}</span>)
</div><div id="l693" class="code_block">determination of the proper directory prefix is straightforward.
</div><div id="l694" class="code_block">However, the user may also enter a name without any directory
</div><div id="l695" class="code_block">prefix. In this case, the directory prefix is a directory in the
</div><div id="l696" class="code_block">dynamic loader path (see Section~<span class="k">\ref</span><span class="nb">{</span>LibPath<span class="nb">}</span>) where the source file
</div><div id="l697" class="code_block">exists.  Once the directory prefix is determined, the file name is
</div><div id="l698" class="code_block">checked for an extension.  If there is no extension the loader first
</div><div id="l699" class="code_block">checks for a file in the directory with the <span class="nb">{</span><span class="k">\tt</span> .P<span class="nb">}</span> extension, (or
</div><div id="l700" class="code_block"><span class="nb">{</span><span class="k">\tt</span> .c<span class="nb">}</span> for foreign modules) before searching for a file without the
</div><div id="l701" class="code_block">extension.  Note that since directories in the dynamic loader path are
</div><div id="l702" class="code_block">searched in a predetermined order (see Section~<span class="k">\ref</span><span class="nb">{</span>LibPath<span class="nb">}</span>), if the
</div><div id="l703" class="code_block">same file name appears in more than one of these directories, the
</div><div id="l704" class="code_block">compiler will consult the first one it encounters.
</div><div id="l705" class="code_block">
</div><div id="l706" class="code_block">Compilation is performed if the update date of the the source file
</div><div id="l707" class="code_block">(<span class="nb">{</span><span class="k">\tt</span> *.P<span class="nb">}</span>) is later than that of the the object file (<span class="nb">{</span><span class="k">\tt</span> *.O<span class="nb">}</span>),
</div><div id="l708" class="code_block"><span class="nb">{</span><span class="k">\em</span> and<span class="nb">}</span> if the source file is not larger than the default compile
</div><div id="l709" class="code_block">size.  This default compile is set to be 20,000 bytes (in <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l710" class="code_block">cmplib/config.P<span class="nb">}</span>), but can be reset by the user.  If the source file
</div><div id="l711" class="code_block">is larger than the default compile size, the file will be loaded using
</div><div id="l712" class="code_block"><span class="nb">{</span><span class="k">\tt</span> load<span class="k">\_dyn</span>/1<span class="nb">}</span>, and otherwise it will be compiled (<span class="nb">{</span><span class="k">\tt</span>
</div><div id="l713" class="code_block">load<span class="k">\_dyn</span>/1<span class="nb">}</span> can also be called separately, see the Section <span class="nb">{</span><span class="k">\it</span>
</div><div id="l714" class="code_block">Asserting Dynamic Code<span class="nb">}</span> for details.
</div><div id="l715" class="code_block">While <span class="nb">{</span><span class="k">\tt</span> load<span class="k">\_dyn</span><span class="nb">}</span> gives reasonably good execution times,
</div><div id="l716" class="code_block">compilation can always be done by using <span class="nb">{</span><span class="k">\tt</span> compile/[1,2]<span class="nb">}</span>
</div><div id="l717" class="code_block">explicitly.  Currently (<span class="k">\version</span>), a foreign language module is
</div><div id="l718" class="code_block">compiled when at least one of files <span class="nb">{</span><span class="k">\tt</span> *.c<span class="nb">}</span> or <span class="nb">{</span><span class="k">\tt</span> *.H<span class="nb">}</span> has been
</div><div id="l719" class="code_block">changed from the time the corresponding object files have been
</div><div id="l720" class="code_block">created.
</div><div id="l721" class="code_block">
</div><div id="l722" class="code_block"><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> multifile/2<span class="nb">}}</span>
</div><div id="l723" class="code_block">Whether the file is compiled or dynamically loaded, the byte-code for
</div><div id="l724" class="code_block">the file is loaded into XSB&#39;s database.  The default action upon
</div><div id="l725" class="code_block">loading is to delete any previous byte-code for predicates defined in
</div><div id="l726" class="code_block">the file.  If this is not the desired behavior, the user may add to
</div><div id="l727" class="code_block">the file a declaration 
</div><div id="l728" class="code_block"><span class="k">\begin</span><span class="nb">{</span>center<span class="nb">}</span>
</div><div id="l729" class="code_block"><span class="nb">{</span><span class="k">\tt</span> :- multifile &lt;Predicate<span class="k">\_List</span>&gt; .<span class="nb">}</span> <span class="k">\\</span>
</div><div id="l730" class="code_block"><span class="k">\end</span><span class="nb">{</span>center<span class="nb">}</span>
</div><div id="l731" class="code_block">where <span class="nb">{</span><span class="k">\tt</span> Predicate<span class="k">\_List</span><span class="nb">}</span> is a list of predicates in <span class="nb">{</span><span class="k">\em</span>
</div><div id="l732" class="code_block">functor/arity<span class="k">\/</span><span class="nb">}</span> form.  The effect of this declaration is to delete <span class="nb">{</span><span class="k">\em</span>
</div><div id="l733" class="code_block">only<span class="k">\/</span><span class="nb">}</span> those clauses of <span class="nb">{</span><span class="k">\tt</span> predicate/arity<span class="nb">}</span> that were defined in the
</div><div id="l734" class="code_block">file itself.
</div><div id="l735" class="code_block">
</div><div id="l736" class="code_block">After loading the module, all exported predicates of that module are
</div><div id="l737" class="code_block">imported into the current environment (the current working
</div><div id="l738" class="code_block">module <span class="nb">{</span><span class="k">\tt</span> usermod<span class="nb">}</span>).  For non-modules (see Section~<span class="k">\ref</span><span class="nb">{</span>Modules<span class="nb">}</span>),
</div><div id="l739" class="code_block">all predicates are imported into the current working module.
</div><div id="l740" class="code_block">
</div><div id="l741" class="code_block">Finally any queries --- that is, any terms with principal functor <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l742" class="code_block">&#39;:-&#39;/1<span class="nb">}</span> that are not directives like the ones described in
</div><div id="l743" class="code_block">Section~<span class="k">\ref</span><span class="nb">{</span>the<span class="nb">_</span>compiler<span class="nb">}</span> --- are executed in the order that they are
</div><div id="l744" class="code_block">encountered.
</div><div id="l745" class="code_block">
</div><div id="l746" class="code_block"><span class="k">\section</span><span class="nb">{</span>The Compiler<span class="nb">}</span> <span class="k">\label</span><span class="nb">{</span>the<span class="nb">_</span>compiler<span class="nb">}</span> <span class="k">\index</span><span class="nb">{</span>Compiler<span class="nb">}</span>
</div><div id="l747" class="code_block"><span class="c">%===========================================================</span>
</div><div id="l748" class="code_block">
</div><div id="l749" class="code_block">The XSB compiler translates XSB source files into
</div><div id="l750" class="code_block">byte-code object files.  It is written entirely in Prolog.
</div><div id="l751" class="code_block">Both the sources and the byte code<span class="k">\index</span><span class="nb">{</span>byte code!files!compiler<span class="nb">}</span>
</div><div id="l752" class="code_block">for the compiler can be found in the XSB system directory
</div><div id="l753" class="code_block"><span class="nb">{</span><span class="k">\tt</span> cmplib<span class="nb">}</span><span class="k">\index</span><span class="nb">{</span>cmplib@<span class="nb">{</span><span class="k">\tt</span> cmplib<span class="nb">}}</span>.
</div><div id="l754" class="code_block">
</div><div id="l755" class="code_block"><span class="k">\index</span><span class="nb">{</span>GPP<span class="nb">}</span>
</div><div id="l756" class="code_block">Prior to compiling, XSB filters the programs through <span class="k">\emph</span><span class="nb">{</span>GPP<span class="nb">}</span>, a 
</div><div id="l757" class="code_block">preprocessor written by Denis Auroux (auroux@math.polytechnique.fr).
</div><div id="l758" class="code_block">This preprocessor maintains high degree of compatibility with the C
</div><div id="l759" class="code_block">preprocessor, but is more suitable for processing Prolog programs.
</div><div id="l760" class="code_block">The preprocessor is invoked with the compiler option <span class="k">\verb</span>|xpp<span class="nb">_</span>on|
</div><div id="l761" class="code_block">as described below. The various features of GPP are described in
</div><div id="l762" class="code_block">Appendix~<span class="k">\ref</span><span class="nb">{</span>gpp-man<span class="nb">}</span>.
</div><div id="l763" class="code_block">
</div><div id="l764" class="code_block">XSB also allows the programmer to use preprocessors other than GPP.
</div><div id="l765" class="code_block">However, the modules that come with XSB distribution require GPP.
</div><div id="l766" class="code_block">This is explained below (see <span class="k">\verb</span>|xpp<span class="nb">_</span>on| compiler option).
</div><div id="l767" class="code_block">
</div><div id="l768" class="code_block">The following sections describe the various aspects of the compiler 
</div><div id="l769" class="code_block">in more detail.
</div><div id="l770" class="code_block">
</div><div id="l771" class="code_block">
</div><div id="l772" class="code_block"><span class="k">\subsection</span><span class="nb">{</span>Invoking the Compiler<span class="nb">}</span> <span class="k">\label</span><span class="nb">{</span>compiler<span class="nb">_</span>invoking<span class="nb">}</span>
</div><div id="l773" class="code_block"><span class="k">\index</span><span class="nb">{</span>invoking the Compiler<span class="nb">}</span><span class="k">\index</span><span class="nb">{</span>Compiler!invoking<span class="nb">}</span>
</div><div id="l774" class="code_block"><span class="c">%=====================================================</span>
</div><div id="l775" class="code_block">
</div><div id="l776" class="code_block">The compiler is invoked directly at the interpreter level (or in a 
</div><div id="l777" class="code_block">program) through the Prolog predicates <span class="nb">{</span><span class="k">\tt</span> compile/[1,2]<span class="nb">}</span>.  
</div><div id="l778" class="code_block">
</div><div id="l779" class="code_block"><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> compile/[1,2]<span class="nb">}}</span>
</div><div id="l780" class="code_block">The general forms of predicate <span class="nb">{</span><span class="k">\tt</span> compile/2<span class="nb">}</span> are:
</div><div id="l781" class="code_block"><span class="k">\begin</span><span class="nb">{</span>center<span class="nb">}{</span><span class="k">\tt</span>	
</div><div id="l782" class="code_block">	compile(+File, +OptionList) <span class="k">\\</span>
</div><div id="l783" class="code_block">	compile(+FileList, +OptionList)
</div><div id="l784" class="code_block"><span class="nb">}</span>
</div><div id="l785" class="code_block"><span class="k">\end</span><span class="nb">{</span>center<span class="nb">}</span>
</div><div id="l786" class="code_block">and at the time of the call both of its arguments should be ground.
</div><div id="l787" class="code_block">
</div><div id="l788" class="code_block">The second form allows the user to supply a proper list of file names as
</div><div id="l789" class="code_block">the parameter for <span class="nb">{</span><span class="k">\tt</span> compile/[1,2]<span class="nb">}</span>.  In this case the compiler will
</div><div id="l790" class="code_block">compile all the files in <span class="nb">{</span><span class="k">\tt</span> FileList<span class="nb">}</span> with the compiler
</div><div id="l791" class="code_block">options specified in <span class="nb">{</span><span class="k">\tt</span> OptionList<span class="nb">}</span> (but see
</div><div id="l792" class="code_block">Section~<span class="k">\ref</span><span class="nb">{</span>sec:CompilerOptions<span class="nb">}</span> below for the precise details.)
</div><div id="l793" class="code_block">
</div><div id="l794" class="code_block"><span class="k">\demo</span><span class="nb">{</span><span class="s">$</span><span class="nb">|</span><span class="s">$</span> ?- compile(Files).<span class="nb">}</span> 
</div><div id="l795" class="code_block">
</div><div id="l796" class="code_block"><span class="k">\noindent</span>
</div><div id="l797" class="code_block">is just a notational shorthand for the query:
</div><div id="l798" class="code_block">
</div><div id="l799" class="code_block"><span class="k">\demo</span><span class="nb">{</span><span class="s">$</span><span class="nb">|</span><span class="s">$</span> ?- compile(Files, []).<span class="nb">}</span>
</div><div id="l800" class="code_block">
</div><div id="l801" class="code_block">The standard predicates <span class="nb">{</span><span class="k">\tt</span> consult/[1,2]<span class="nb">}</span> call <span class="nb">{</span><span class="k">\tt</span> compile/1<span class="nb">}</span> (if
</div><div id="l802" class="code_block">necessary).  Argument <span class="nb">{</span><span class="k">\tt</span> File<span class="nb">}</span> can be any syntactically valid UNIX
</div><div id="l803" class="code_block">or Windows file name (in the form of a Prolog atom), but the user can also
</div><div id="l804" class="code_block">supply a module name.
</div><div id="l805" class="code_block">
</div><div id="l806" class="code_block">The list of compiler options <span class="nb">{</span><span class="k">\tt</span> OptionList<span class="nb">}</span>, if specified, 
</div><div id="l807" class="code_block">should be a proper Prolog list, i.e.<span class="k">\</span> a term of the form:
</div><div id="l808" class="code_block"><span class="k">\begin</span><span class="nb">{</span>center<span class="nb">}</span>
</div><div id="l809" class="code_block">	<span class="nb">{</span><span class="k">\tt</span> [ <span class="s">$</span><span class="nb">option_</span><span class="m">1</span><span class="s">$</span>, <span class="s">$</span><span class="nb">option_</span><span class="m">2</span><span class="s">$</span>, <span class="s">$</span><span class="nv">\ldots</span><span class="s">$</span>, <span class="s">$</span><span class="nb">option_n</span><span class="s">$</span> ].<span class="nb">}</span>
</div><div id="l810" class="code_block"><span class="k">\end</span><span class="nb">{</span>center<span class="nb">}</span>
</div><div id="l811" class="code_block">where <span class="s">$</span><span class="nb">option_i</span><span class="s">$</span> is one of the options described in
</div><div id="l812" class="code_block">Section~<span class="k">\ref</span><span class="nb">{</span>sec:CompilerOptions<span class="nb">}</span>.
</div><div id="l813" class="code_block">
</div><div id="l814" class="code_block">The source file name corresponding to a given module is obtained by 
</div><div id="l815" class="code_block">concatenating a directory prefix and the extension <span class="nb">{</span><span class="k">\tt</span> .P<span class="nb">}</span> (or <span class="nb">{</span><span class="k">\tt</span> .c<span class="nb">}</span>) 
</div><div id="l816" class="code_block">to the module name.  The directory prefix must be in the
</div><div id="l817" class="code_block">dynamic loader path (see Section~<span class="k">\ref</span><span class="nb">{</span>LibPath<span class="nb">}</span>).
</div><div id="l818" class="code_block">Note that these directories are searched in a predetermined
</div><div id="l819" class="code_block">order (see Section~<span class="k">\ref</span><span class="nb">{</span>LibPath<span class="nb">}</span>), so if a module with the same name
</div><div id="l820" class="code_block">appears in more than one of the directories searched, the compiler 
</div><div id="l821" class="code_block">will compile the first one it encounters.  In such a case, the user can 
</div><div id="l822" class="code_block">override the search order by providing an absolute path name.
</div><div id="l823" class="code_block">
</div><div id="l824" class="code_block">If <span class="nb">{</span><span class="k">\tt</span> File<span class="nb">}</span> contains no extension, an attempt is made to compile the 
</div><div id="l825" class="code_block">file <span class="nb">{</span><span class="k">\tt</span> File.P<span class="nb">}</span> (or <span class="nb">{</span><span class="k">\tt</span> File.c<span class="nb">}</span>) before trying compiling the file 
</div><div id="l826" class="code_block">with name <span class="nb">{</span><span class="k">\tt</span> File<span class="nb">}</span>.  
</div><div id="l827" class="code_block">
</div><div id="l828" class="code_block">We recommend use of the extension <span class="nb">{</span><span class="k">\tt</span> .P<span class="nb">}</span> for Prolog source file to
</div><div id="l829" class="code_block">avoid ambiguity.  Optionally, users can also provide a header file for
</div><div id="l830" class="code_block">a module (denoted by the module name suffixed by <span class="nb">{</span><span class="k">\tt</span> .H<span class="nb">}</span>).  In such a
</div><div id="l831" class="code_block">case, the XSB compiler will first read the header file (if it
</div><div id="l832" class="code_block">exists), and then the source file.  Currently the compiler makes no
</div><div id="l833" class="code_block">special treatment of header files.  They are simply included in the
</div><div id="l834" class="code_block">beginning of the corresponding source files, and code can, in
</div><div id="l835" class="code_block">principle, be placed in either.  In future versions of XSB the
</div><div id="l836" class="code_block">header files may be used to check interfaces across modules, hence it
</div><div id="l837" class="code_block">is a good programming practice to restrict header files to
</div><div id="l838" class="code_block">declarations alone.
</div><div id="l839" class="code_block"> 
</div><div id="l840" class="code_block">The result of the compilation (an SLG-WAM object code file) is stored
</div><div id="l841" class="code_block">in a (<span class="s">$</span><span class="nv">\langle</span><span class="s">$</span>filename<span class="s">$</span><span class="nv">\rangle</span><span class="s">$</span>.O), but <span class="nb">{</span><span class="k">\tt</span> compile/[1,2]<span class="nb">}</span> does <span class="nb">{</span><span class="k">\em</span>
</div><div id="l842" class="code_block">not<span class="k">\/</span><span class="nb">}</span> load the object file it creates.  (The standard predicates <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l843" class="code_block">consult/[1,2]<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> reconsult/[1,2]<span class="nb">}</span> both recompile the source
</div><div id="l844" class="code_block">file, if needed, and load the object file into the system.)  The
</div><div id="l845" class="code_block">object file created is always written into the directory where the
</div><div id="l846" class="code_block">source file resides (the user should therefore have write permission
</div><div id="l847" class="code_block">in that directory).
</div><div id="l848" class="code_block"> 
</div><div id="l849" class="code_block">If desired, when compiling a module (file), clauses and directives can be
</div><div id="l850" class="code_block">transformed as they are read.  This is indeed the case for definite clause
</div><div id="l851" class="code_block">grammar rules (see Chapter~<span class="k">\ref</span><span class="nb">{</span>DCGs<span class="nb">}</span>), but it can also be done for clauses
</div><div id="l852" class="code_block">of any form by providing a definition for predicate <span class="nb">{</span><span class="k">\tt</span> term<span class="k">\_expansion</span>/2<span class="nb">}</span>
</div><div id="l853" class="code_block">(see Section~<span class="k">\ref</span><span class="nb">{</span>DCG<span class="nb">_</span>builtins<span class="nb">}</span>).
</div><div id="l854" class="code_block">
</div><div id="l855" class="code_block">Predicates <span class="nb">{</span><span class="k">\tt</span> compile/[1,2]<span class="nb">}</span> can also be used to compile foreign
</div><div id="l856" class="code_block">language modules.  In this case, the names of the source files should
</div><div id="l857" class="code_block">have the extension <span class="nb">{</span><span class="k">\tt</span> .c<span class="nb">}</span> and a <span class="nb">{</span><span class="k">\tt</span> .P<span class="nb">}</span> file must <span class="nb">{</span><span class="k">\em</span> not<span class="k">\/</span><span class="nb">}</span>
</div><div id="l858" class="code_block">exist.  A header file (with extension <span class="nb">{</span><span class="k">\tt</span> .H<span class="nb">}</span>) <span class="nb">{</span><span class="k">\em</span> must<span class="nb">}</span> be present
</div><div id="l859" class="code_block">for a foreign language module (see the chapter <span class="nb">{</span><span class="k">\it</span> Foreign Language
</div><div id="l860" class="code_block">Interface<span class="nb">}</span> in Volume 2.
</div><div id="l861" class="code_block">
</div><div id="l862" class="code_block">
</div><div id="l863" class="code_block"><span class="k">\subsection</span><span class="nb">{</span>Compiler Options<span class="nb">}</span><span class="k">\label</span><span class="nb">{</span>sec:CompilerOptions<span class="nb">}</span>
</div><div id="l864" class="code_block"><span class="k">\index</span><span class="nb">{</span>Compiler!options<span class="nb">}</span><span class="k">\index</span><span class="nb">{</span>options!Compiler<span class="nb">}</span>
</div><div id="l865" class="code_block"><span class="c">%=================================================</span>
</div><div id="l866" class="code_block">
</div><div id="l867" class="code_block">Compiler options can be set in three ways: from a global list of
</div><div id="l868" class="code_block">options (see <span class="nb">{</span><span class="k">\tt</span> set<span class="k">\_global\_compiler\_options</span>/1<span class="nb">}</span>), from the
</div><div id="l869" class="code_block">compilation command (see <span class="nb">{</span><span class="k">\tt</span> compile/2<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> consult/2<span class="nb">}</span>), and
</div><div id="l870" class="code_block">from a directive in the file to be compiled (see compiler directive
</div><div id="l871" class="code_block"><span class="nb">{</span><span class="k">\tt</span> compiler<span class="k">\_options</span>/1<span class="nb">}</span>).
</div><div id="l872" class="code_block">
</div><div id="l873" class="code_block"><span class="k">\begin</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l874" class="code_block"><span class="k">\ouritem</span><span class="nb">{</span>set<span class="k">\_global\_compiler\_options</span>(+OptionsList)<span class="nb">}</span><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span>
</div><div id="l875" class="code_block">set<span class="k">\_global\_compiler\_options</span>/1<span class="nb">}}</span> 
</div><div id="l876" class="code_block">    <span class="nb">{</span><span class="k">\tt</span> OptionsList<span class="nb">}</span> is a list of compiler options (described below).
</div><div id="l877" class="code_block">    Each can optionally be prefixed by <span class="k">\verb</span>|+| or <span class="k">\verb</span>|-|,
</div><div id="l878" class="code_block">    indicating that the option is to be turned on, or off,
</div><div id="l879" class="code_block">    respectively.  (No prefix turns the option on.)  This evaluable
</div><div id="l880" class="code_block">    predicate sets the global compiler options in the way indicated.
</div><div id="l881" class="code_block">    These options will be used in any subsequent compilation, unless
</div><div id="l882" class="code_block">    reset by another call to this predicate, or overridden by options
</div><div id="l883" class="code_block">    provided in the compile invocation, or overridden by options in
</div><div id="l884" class="code_block">    the file to be compiled.
</div><div id="l885" class="code_block"><span class="k">\end</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l886" class="code_block">
</div><div id="l887" class="code_block">The following options are currently recognized by the compiler:
</div><div id="l888" class="code_block"><span class="k">\begin</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l889" class="code_block"><span class="k">\item</span><span class="na">[{\tt optimize}]</span><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> optimize<span class="nb">}}</span>
</div><div id="l890" class="code_block">	When specified, the compiler tries to optimize the object code.
</div><div id="l891" class="code_block">	In <span class="k">\version</span>, this option optimizes predicate calls, among other
</div><div id="l892" class="code_block">	features, so execution may be considerably faster for recursive
</div><div id="l893" class="code_block">	loops.  However,
</div><div id="l894" class="code_block">	due to the nature of the optimizations, the user may not be able to
</div><div id="l895" class="code_block">	trace all calls to predicates in the program.  Also the Prolog code
</div><div id="l896" class="code_block">	should be <span class="nb">{</span><span class="k">\em</span> static<span class="nb">}</span>.  In other words, the user is <span class="nb">{</span><span class="k">\em</span> not<span class="nb">}</span> allowed
</div><div id="l897" class="code_block">	to alter the entry point of these compiled predicates by asserting new
</div><div id="l898" class="code_block">	clauses.  As expected, the compilation phase will also be slightly
</div><div id="l899" class="code_block">	longer.  For these reasons, the use of the <span class="nb">{</span><span class="k">\tt</span> optimize<span class="nb">}</span> option may
</div><div id="l900" class="code_block">	not be suitable for the development phase, but is
</div><div id="l901" class="code_block">	recommended once the code has been debugged.
</div><div id="l902" class="code_block">
</div><div id="l903" class="code_block">
</div><div id="l904" class="code_block"><span class="k">\item</span><span class="na">[{\tt xpp\_on}]</span><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> xpp<span class="k">\_on</span><span class="nb">}}</span><span class="k">\index</span><span class="nb">{</span>GPP<span class="nb">}</span>
</div><div id="l905" class="code_block">  Filter the program through a preprocessor  before sending it to the XSB 
</div><div id="l906" class="code_block">  compiler. By default (and for the XSB code itself), XSB uses GPP, a
</div><div id="l907" class="code_block">  preprocessor developed by Denis Auroux (auroux@math.polytechnique.fr)
</div><div id="l908" class="code_block">  that has high degree of compatibility with the C preprocessor, but is
</div><div id="l909" class="code_block">  more suitable for Prolog syntax. In this case, the source code can
</div><div id="l910" class="code_block">  include the usual C 
</div><div id="l911" class="code_block">  preprocessor directives, such as <span class="k">\verb</span>|#define|, <span class="k">\verb</span>|#ifdef|, and
</div><div id="l912" class="code_block">  <span class="k">\verb</span>|#include|. This option can be specified both as a parameter to
</div><div id="l913" class="code_block">  compile/2 and as part of the <span class="nb">{</span><span class="k">\tt</span> compiler<span class="k">\_options</span>/1<span class="nb">}</span> directive inside
</div><div id="l914" class="code_block">  the source file. See Appendix~<span class="k">\ref</span><span class="nb">{</span>gpp-man<span class="nb">}</span> for more details on GPP.
</div><div id="l915" class="code_block">
</div><div id="l916" class="code_block">  When an <span class="k">\verb</span>|#include &quot;file&quot;| statement is encountered,
</div><div id="l917" class="code_block">  XSB directs GPP preprocessor to search for the files to include in the
</div><div id="l918" class="code_block">  directories <span class="k">\verb</span>|<span class="s">$</span><span class="nb">XSB_DIR</span><span class="o">/</span><span class="nb">emu| </span>
</div><div id="l919" class="code_block"><span class="nb">  </span><span class="c">%%$</span>
</div><div id="l920" class="code_block"><span class="nb">  and </span><span class="nv">\verb</span><span class="nb">|</span><span class="s">$</span>XSB<span class="nb">_</span>DIR/prolog<span class="nb">_</span>includes|.
</div><div id="l921" class="code_block">  <span class="c">%%$</span>
</div><div id="l922" class="code_block">  <span class="k">\index</span><span class="nb">{</span><span class="k">\tt</span> xpp<span class="k">\_include\_dir</span><span class="nb">}</span>
</div><div id="l923" class="code_block">  <span class="c">%%</span>
</div><div id="l924" class="code_block">  However, additional directories can be added to this search path by
</div><div id="l925" class="code_block">  asserting into the predicate <span class="k">\verb</span>|xpp<span class="nb">_</span>include<span class="nb">_</span>dir/1|, <span class="nb">{</span><span class="k">\bf</span> which should
</div><div id="l926" class="code_block">    be imported from module<span class="nb">}</span> <span class="nb">{</span><span class="k">\tt</span> parse<span class="nb">}</span>.
</div><div id="l927" class="code_block">  
</div><div id="l928" class="code_block">  Note that when compiling XSB programs, GPP searches the current directory
</div><div id="l929" class="code_block">  and the directory of the parent file that contains the include-directive
</div><div id="l930" class="code_block">  <span class="k">\emph</span><span class="nb">{</span>last<span class="nb">}</span>. If you want additional directories to be searched, then the
</div><div id="l931" class="code_block">  following statements must be executed:
</div><div id="l932" class="code_block"><span class="c">%%</span>
</div><div id="l933" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l934" class="code_block">    :- import xpp<span class="nb">_</span>include<span class="nb">_</span>dir/1 from parse.
</div><div id="l935" class="code_block">    :- assert(xpp<span class="nb">_</span>include<span class="nb">_</span>dir(&#39;some-other-dir&#39;)).
</div><div id="l936" class="code_block"><span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l937" class="code_block"><span class="c">%%</span>
</div><div id="l938" class="code_block">  If you want Gpp to search directories in a different order,
</div><div id="l939" class="code_block">  <span class="nb">{</span><span class="k">\tt</span> xpp<span class="k">\_options</span>/1<span class="nb">}</span> can be used (see below).
</div><div id="l940" class="code_block">
</div><div id="l941" class="code_block">   Note: if you assert something into this predicate then you must also <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l942" class="code_block">    retractall(xpp<span class="k">\_include\_dir</span>(<span class="k">\_</span>))<span class="nb">}</span> after that or else subsequent Prolog
</div><div id="l943" class="code_block">  compilations might not work correctly.
</div><div id="l944" class="code_block">
</div><div id="l945" class="code_block">  XSB predefines the constant <span class="nb">{</span><span class="k">\tt</span> XSB<span class="k">\_PROLOG</span><span class="nb">}</span>, which can be used for
</div><div id="l946" class="code_block">  conditional compilation. For instance, you can write portable program
</div><div id="l947" class="code_block">  to run under XSB and and other prologs that support C-style
</div><div id="l948" class="code_block">  preprocessing and use conditional compilation to account for the
</div><div id="l949" class="code_block">  differences: 
</div><div id="l950" class="code_block">  <span class="c">%%</span>
</div><div id="l951" class="code_block">  <span class="k">\begin</span><span class="nb">{</span>samepage<span class="nb">}</span>
</div><div id="l952" class="code_block">  <span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l953" class="code_block">#ifdef XSB<span class="nb">_</span>PROLOG
</div><div id="l954" class="code_block">    XSB-specific stuff
</div><div id="l955" class="code_block">#else
</div><div id="l956" class="code_block">    other Prolog&#39;s stuff
</div><div id="l957" class="code_block">#endif
</div><div id="l958" class="code_block">    common stuff
</div><div id="l959" class="code_block">  <span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l960" class="code_block">  <span class="k">\end</span><span class="nb">{</span>samepage<span class="nb">}</span>
</div><div id="l961" class="code_block">  <span class="c">%%</span>
</div><div id="l962" class="code_block">
</div><div id="l963" class="code_block">  <span class="k">\index</span><span class="nb">{</span>xpp<span class="k">\_program</span><span class="nb">}</span>
</div><div id="l964" class="code_block">  <span class="c">%%</span>
</div><div id="l965" class="code_block">  However, as mentioned earlier, XSB lets the user filter programs (except
</div><div id="l966" class="code_block">  the programs that belong to XSB distribution) through any preprocessor
</div><div id="l967" class="code_block">  the user wants. To this end, one only needs to assert the appropriate
</div><div id="l968" class="code_block">  command into the predicate <span class="k">\verb</span>|xpp<span class="nb">_</span>program|, which should be imported
</div><div id="l969" class="code_block">  from module <span class="nb">{</span><span class="k">\tt</span> parse<span class="nb">}</span>. The command should not include the file
</div><div id="l970" class="code_block">  name---XSB appends the name of the file to be compiled to the command
</div><div id="l971" class="code_block">  supplied by the user. For instance, executing
</div><div id="l972" class="code_block">  <span class="c">%%</span>
</div><div id="l973" class="code_block">  <span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l974" class="code_block">   :- assert(xpp<span class="nb">_</span>program(&#39;/usr/bin/m4 -E -G&#39;)).
</div><div id="l975" class="code_block">  <span class="k">\end</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l976" class="code_block">  <span class="c">%%</span>
</div><div id="l977" class="code_block">  before calling the compiler will have the effect that the next XSB
</div><div id="l978" class="code_block">  program passed to the compiler will be first preprocessed by the M4 macro
</div><div id="l979" class="code_block">  package. Note that the XSB compiler automatically clears out the
</div><div id="l980" class="code_block">  <span class="nb">{</span><span class="k">\tt</span> xpp<span class="k">\_program</span><span class="nb">}</span> predicate, so there is no need to tidy up each time.
</div><div id="l981" class="code_block">  But this also means that if you need to compile several programs with a
</div><div id="l982" class="code_block">  non-standard preprocessor then you must specify that non-standard
</div><div id="l983" class="code_block">  preprocessor each time the program is compiled.
</div><div id="l984" class="code_block">  
</div><div id="l985" class="code_block"><span class="k">\item</span><span class="na">[{\tt xpp\_options}]</span> <span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> xpp<span class="k">\_options</span><span class="nb">}}</span> This dynamic predicate
</div><div id="l986" class="code_block">  must be imported from module <span class="nb">{</span><span class="k">\tt</span> parse<span class="nb">}</span>.  If some atom is asserted into
</div><div id="l987" class="code_block">  <span class="nb">{</span><span class="k">\tt</span> xpp<span class="k">\_options</span><span class="nb">}</span> then this atom is assumed to be the list of command
</div><div id="l988" class="code_block">  line options to be used by the preprocessor (only the first asserted atom
</div><div id="l989" class="code_block">  is ever considered). If this predicate is empty, then the default list of
</div><div id="l990" class="code_block">  options is used (which is <span class="nb">{</span><span class="k">\tt</span> &#39;-P -m -nostdinc -nocurinc&#39;<span class="nb">}</span>, meaning: use
</div><div id="l991" class="code_block">  Prolog mode and do not search the standard C directories and the
</div><div id="l992" class="code_block">  directory of the parent file that contains the include-instruction).
</div><div id="l993" class="code_block">  
</div><div id="l994" class="code_block">  As mentioned earlier, when XSB invokes Gpp, it uses the option <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l995" class="code_block">    -nocurinc<span class="nb">}</span> so that Gpp will not search the directory of the parent file. 
</div><div id="l996" class="code_block">  If a particular application requires that the parent file directory
</div><div id="l997" class="code_block">  must be searched, then this can be accomplished by executing 
</div><div id="l998" class="code_block">  <span class="nb">{</span><span class="k">\tt</span> assert(xpp<span class="k">\_options</span>(&#39;-P -m -nostdinc&#39;))<span class="nb">}</span>.
</div><div id="l999" class="code_block">  
</div><div id="l1000" class="code_block">  Note: if you assert something into this predicate then you must also <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1001" class="code_block">    retractall(xpp<span class="k">\_options</span>(<span class="k">\_</span>))<span class="nb">}</span> after that or else subsequent Prolog
</div><div id="l1002" class="code_block">  compilations might not work correctly.
</div><div id="l1003" class="code_block">  
</div><div id="l1004" class="code_block"><span class="k">\item</span><span class="na">[{\tt xpp\_dump}]</span> <span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> xpp<span class="k">\_dump</span><span class="nb">}}</span>
</div><div id="l1005" class="code_block">  <span class="c">%%</span>
</div><div id="l1006" class="code_block">  This causes XSB to dump the output from the GPP preprocessor into a file.
</div><div id="l1007" class="code_block">  If the file being compiled is named <span class="nb">{</span><span class="k">\tt</span> file.P<span class="nb">}</span> then the dump file is
</div><div id="l1008" class="code_block">  named <span class="nb">{</span><span class="k">\tt</span> file.P<span class="k">\_gpp</span><span class="nb">}</span>. This option can be included in the list of
</div><div id="l1009" class="code_block">  options in the <span class="nb">{</span><span class="k">\tt</span> compiler<span class="k">\_options</span>/1<span class="nb">}</span> directive, but usually it is
</div><div id="l1010" class="code_block">  used for debugging, as part of the <span class="nb">{</span><span class="k">\tt</span> compile/2<span class="nb">}</span> predicate. If <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1011" class="code_block">    xpp<span class="k">\_dump</span><span class="nb">}</span> is specified directly in the file using <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1012" class="code_block">    compiler<span class="k">\_options</span>/1<span class="nb">}</span> directive, then it should <span class="k">\emph</span><span class="nb">{</span>not<span class="nb">}</span> follow the
</div><div id="l1013" class="code_block">  <span class="nb">{</span><span class="k">\tt</span> gpp<span class="k">\_on</span><span class="nb">}</span> option in the list (or else it will be ignored).
</div><div id="l1014" class="code_block">
</div><div id="l1015" class="code_block"><span class="k">\item</span><span class="na">[{\tt quit\_on\_error}]</span> <span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> quit<span class="k">\_on\_error</span><span class="nb">}}</span>
</div><div id="l1016" class="code_block">  This causes XSB to exit if compilation of a program end with an error.
</div><div id="l1017" class="code_block">  This option is useful when running XSB from a makefile, when it is
</div><div id="l1018" class="code_block">  necessary to stop the build process after an error has been detected. For
</div><div id="l1019" class="code_block">  instance, XSB uses this option during its own build process.
</div><div id="l1020" class="code_block">
</div><div id="l1021" class="code_block">
</div><div id="l1022" class="code_block"><span class="c">%-------------------------------</span>
</div><div id="l1023" class="code_block"><span class="k">\index</span><span class="nb">{</span>tabling!compiler options<span class="nb">}</span>
</div><div id="l1024" class="code_block"><span class="c">%-------------------------------</span>
</div><div id="l1025" class="code_block"><span class="k">\item</span><span class="na">[{\tt auto\_table}]</span><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> auto<span class="k">\_table</span><span class="nb">}}</span> When specified as a
</div><div id="l1026" class="code_block">  compiler option, the effect is as described in
</div><div id="l1027" class="code_block">  Section~<span class="k">\ref</span><span class="nb">{</span>tabling<span class="nb">_</span>directives<span class="nb">}</span>.  Briefly, a static analysis is made to
</div><div id="l1028" class="code_block">  determine which predicates may loop under Prolog&#39;s SLD evaluation.  These
</div><div id="l1029" class="code_block">  predicates are compiled as tabled predicates, and SLG evaluation is used
</div><div id="l1030" class="code_block">  instead.
</div><div id="l1031" class="code_block"><span class="c">%qkostis</span>
</div><div id="l1032" class="code_block"><span class="k">\item</span><span class="na">[{\tt suppl\_table}]</span><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> suppl<span class="k">\_table</span><span class="nb">}}</span> The intention of this
</div><div id="l1033" class="code_block">  option is to direct the system to table for efficiency rather than
</div><div id="l1034" class="code_block">  termination.  When specified, the compiler uses tabling to ensure that no
</div><div id="l1035" class="code_block">  predicate will depend on more than three tables or EDB facts (as
</div><div id="l1036" class="code_block">  specified by the declaration <span class="nb">{</span><span class="k">\tt</span> edb<span class="nb">}</span> of
</div><div id="l1037" class="code_block">  Section~<span class="k">\ref</span><span class="nb">{</span>tabling<span class="nb">_</span>directives<span class="nb">}</span>).  The action of <span class="nb">{</span><span class="k">\tt</span> suppl<span class="k">\_table</span><span class="nb">}</span> is
</div><div id="l1038" class="code_block">  independent of that of <span class="nb">{</span><span class="k">\tt</span> auto<span class="k">\_table</span><span class="nb">}</span>, in that a predicate tabled by
</div><div id="l1039" class="code_block">  one will not necessarily be tabled by the other.  During compilation,
</div><div id="l1040" class="code_block">  <span class="nb">{</span><span class="k">\tt</span> suppl<span class="k">\_table</span><span class="nb">}</span> occurs after <span class="nb">{</span><span class="k">\tt</span> auto<span class="k">\_table</span><span class="nb">}</span>, and uses table
</div><div id="l1041" class="code_block">  declarations generated by it, if any.
</div><div id="l1042" class="code_block"><span class="c">%--------------------------------------</span>
</div><div id="l1043" class="code_block"><span class="k">\index</span><span class="nb">{</span>specialization!compiler options<span class="nb">}</span>
</div><div id="l1044" class="code_block"><span class="c">%--------------------------------------</span>
</div><div id="l1045" class="code_block"><span class="k">\item</span><span class="na">[{\tt spec\_repr}]</span><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> spec<span class="k">\_repr</span><span class="nb">}}</span>
</div><div id="l1046" class="code_block">	When specified, the compiler performs specialization of partially
</div><div id="l1047" class="code_block">	instantiated calls by replacing their selected clauses with the
</div><div id="l1048" class="code_block">	representative of these clauses, i.e. it performs <span class="nb">{</span><span class="k">\em</span> folding<span class="k">\/</span><span class="nb">}</span>
</div><div id="l1049" class="code_block">	whenever possible.  We note in general, the code replacement
</div><div id="l1050" class="code_block">	operation is not always sound; i.e. there
</div><div id="l1051" class="code_block">	are cases when the original and the residual program are not
</div><div id="l1052" class="code_block">	computationally equivalent.  The compiler checks for sufficient (but
</div><div id="l1053" class="code_block">	not necessary) conditions that guarantee computational equivalence.
</div><div id="l1054" class="code_block">	If these conditions are not met, specialization is not performed
</div><div id="l1055" class="code_block">	for the violating calls.
</div><div id="l1056" class="code_block"><span class="k">\item</span><span class="na">[{\tt spec\_off}]</span><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> spec<span class="k">\_off</span><span class="nb">}}</span>
</div><div id="l1057" class="code_block">	When specified, the compiler does not perform specialization of
</div><div id="l1058" class="code_block">	partially instantiated calls.
</div><div id="l1059" class="code_block"><span class="k">\item</span><span class="na">[{\tt unfold\_off}]</span><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> unfold<span class="k">\_off</span><span class="nb">}}</span>
</div><div id="l1060" class="code_block">	When specified, singleton sets optimizations are not performed
</div><div id="l1061" class="code_block">	during specialization.  This option is necessary in <span class="k">\version\</span>
</div><div id="l1062" class="code_block">	for the specialization of <span class="nb">{</span><span class="k">\tt</span> table<span class="nb">}</span> declarations that select
</div><div id="l1063" class="code_block">	only a single chain rule of the predicate.
</div><div id="l1064" class="code_block"><span class="c">%qtls ??</span>
</div><div id="l1065" class="code_block"><span class="k">\item</span><span class="na">[{\tt spec\_dump}]</span><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> spec<span class="k">\_dump</span><span class="nb">}}</span>
</div><div id="l1066" class="code_block">	Generates a <span class="nb">{</span><span class="k">\tt</span> module.spec<span class="nb">}</span> file, containing the result of
</div><div id="l1067" class="code_block">	specializing partially instantiated calls to predicates defined
</div><div id="l1068" class="code_block">	in the <span class="nb">{</span><span class="k">\tt</span> module<span class="nb">}</span> under compilation.  The result is in Prolog
</div><div id="l1069" class="code_block">	source code form.
</div><div id="l1070" class="code_block">
</div><div id="l1071" class="code_block"><span class="c">%---------------------------------------------</span>
</div><div id="l1072" class="code_block"><span class="k">\index</span><span class="nb">{</span>unification factoring!compiler options<span class="nb">}</span>
</div><div id="l1073" class="code_block"><span class="c">%---------------------------------------------</span>
</div><div id="l1074" class="code_block"><span class="k">\item</span><span class="na">[{\tt ti\_dump}]</span><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> ti<span class="k">\_dump</span><span class="nb">}}</span>
</div><div id="l1075" class="code_block">	Generates a <span class="nb">{</span><span class="k">\tt</span> module.ti<span class="nb">}</span> file containing the result of applying
</div><div id="l1076" class="code_block">	unification factoring to predicates defined in the <span class="nb">{</span><span class="k">\tt</span> module<span class="nb">}</span>
</div><div id="l1077" class="code_block">	under compilation.  The result is in Prolog source code form.
</div><div id="l1078" class="code_block">	See page~<span class="k">\pageref</span><span class="nb">{</span>transformational<span class="nb">_</span>indexing<span class="nb">}</span> for more information
</div><div id="l1079" class="code_block">	on unification factoring.
</div><div id="l1080" class="code_block"><span class="k">\item</span><span class="na">[{\tt ti\_long\_names}]</span><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> ti<span class="k">\_long\_names</span><span class="nb">}}</span>
</div><div id="l1081" class="code_block">	Used in conjunction with <span class="nb">{</span><span class="k">\tt</span> ti<span class="k">\_dump</span><span class="nb">}</span>, generates names for
</div><div id="l1082" class="code_block">	predicates created by unification factoring that reflect the
</div><div id="l1083" class="code_block">	clause head factoring done by the transformation.
</div><div id="l1084" class="code_block"><span class="k">\comment</span><span class="nb">{</span>
</div><div id="l1085" class="code_block"><span class="k">\item</span><span class="na">[{\tt init\_var\_off}]</span><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> init<span class="k">\_var\_off</span><span class="nb">}}</span>
</div><div id="l1086" class="code_block">	When specified, the compiler will give a warning (instead of an
</div><div id="l1087" class="code_block">	error) upon finding that a potentially uninitialized variable is
</div><div id="l1088" class="code_block">	being used.  <span class="nb">{</span><span class="k">\em</span> Potentially uninitialized variables<span class="k">\/</span><span class="nb">}</span> are
</div><div id="l1089" class="code_block">	variables that appear in only one branch of an <span class="nb">{</span><span class="k">\sf</span> or<span class="nb">}</span> or an
</div><div id="l1090" class="code_block">	<span class="nb">{</span><span class="k">\sf</span> if-then-else<span class="nb">}</span> goal in the body, and, furthermore, are used
</div><div id="l1091" class="code_block">	after that goal.
</div><div id="l1092" class="code_block">	In certain clauses, the variable may always be initialized after
</div><div id="l1093" class="code_block">	the <span class="nb">{</span><span class="k">\sf</span> or<span class="nb">}</span> or the <span class="nb">{</span><span class="k">\sf</span> if-then-else<span class="nb">}</span> goal, because the execution 
</div><div id="l1094" class="code_block">	cannot continue through the path of the branch that does not initialize
</div><div id="l1095" class="code_block">	the variable.  In these cases, the <span class="nb">{</span><span class="k">\tt</span> init<span class="k">\_var\_off</span><span class="nb">}</span> option can be
</div><div id="l1096" class="code_block">	useful, though the user is cautioned against careless use of this
</div><div id="l1097" class="code_block">	option.
</div><div id="l1098" class="code_block">
</div><div id="l1099" class="code_block">	<span class="nb">{</span><span class="k">\sc</span> Warning:<span class="nb">}</span> The object-file generated by the compiler when this
</div><div id="l1100" class="code_block">		option is used may not execute correctly (or even cause
</div><div id="l1101" class="code_block">		XSB to core dump!) if the variable is indeed
</div><div id="l1102" class="code_block">		uninitialized when used.
</div><div id="l1103" class="code_block"><span class="nb">}</span>
</div><div id="l1104" class="code_block"><span class="c">%---------------------------------------------</span>
</div><div id="l1105" class="code_block"><span class="k">\index</span><span class="nb">{</span>mode analysis!compiler options<span class="nb">}</span>
</div><div id="l1106" class="code_block"><span class="c">%---------------------------------------------</span>
</div><div id="l1107" class="code_block"><span class="k">\item</span><span class="na">[{\tt modeinfer}]</span><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> modeinfer<span class="nb">}}</span>
</div><div id="l1108" class="code_block">	This option is used to trigger mode analysis. For each module
</div><div id="l1109" class="code_block">	compiled,  the mode analyzer creates a  <span class="nb">{</span><span class="k">\tt</span> <span class="nb">{</span><span class="k">\em</span> module<span class="nb">}</span>.D<span class="nb">}</span> file
</div><div id="l1110" class="code_block">	that contains the mode information.
</div><div id="l1111" class="code_block">
</div><div id="l1112" class="code_block">	<span class="nb">{</span><span class="k">\sc</span> Warning:<span class="nb">}</span>
</div><div id="l1113" class="code_block">	Occasionally, the analysis itself may take a long time. 
</div><div id="l1114" class="code_block">	As far as we have seen,
</div><div id="l1115" class="code_block">	the analysis times are longer than the rest of the compilation time
</div><div id="l1116" class="code_block">	only when the module contains recursive predicates of arity <span class="s">$</span><span class="nv">\geq</span><span class="nb"> </span><span class="m">10</span><span class="s">$</span>.
</div><div id="l1117" class="code_block">	If the analysis takes an unusually long time
</div><div id="l1118" class="code_block">	(say, more than 4 times as long as the rest of the compilation)
</div><div id="l1119" class="code_block">	you may want to abort and restart compilation without <span class="nb">{</span><span class="k">\tt</span> modeinfer<span class="nb">}</span>.
</div><div id="l1120" class="code_block">	
</div><div id="l1121" class="code_block"><span class="k">\item</span><span class="na">[{\tt mi\_warn}]</span><span class="k">\index</span><span class="nb">{{</span><span class="k">\tt</span> mi<span class="k">\_warn</span><span class="nb">}}</span>
</div><div id="l1122" class="code_block">	During mode analysis, the <span class="nb">{</span><span class="k">\tt</span> .D<span class="nb">}</span> files corresponding to the
</div><div id="l1123" class="code_block">	imported modules are read in. The option <span class="nb">{</span><span class="k">\tt</span> mi<span class="k">\_warn</span><span class="nb">}</span> is used
</div><div id="l1124" class="code_block">	to generate warning messages if these <span class="nb">{</span><span class="k">\tt</span> .D<span class="nb">}</span> files are 
</div><div id="l1125" class="code_block">	outdated --- <span class="nb">{</span><span class="k">\em</span> i.e.<span class="nb">}</span>, older
</div><div id="l1126" class="code_block">	than the last modification time of the source files.
</div><div id="l1127" class="code_block">
</div><div id="l1128" class="code_block"><span class="k">\item</span><span class="na">[{\tt mi\_foreign}]</span> This option is used <span class="nb">{</span><span class="k">\em</span> only<span class="k">\/</span><span class="nb">}</span> when mode analysis
</div><div id="l1129" class="code_block">	is performed on XSB system modules. This option is
</div><div id="l1130" class="code_block">	needed when analyzing <span class="nb">{</span><span class="k">\tt</span> standard<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> machine<span class="nb">}</span> in
</div><div id="l1131" class="code_block">	<span class="nb">{</span><span class="k">\tt</span> syslib<span class="nb">}</span>.
</div><div id="l1132" class="code_block">
</div><div id="l1133" class="code_block">
</div><div id="l1134" class="code_block"><span class="k">\item</span><span class="na">[{\tt sysmod}]</span> <span class="k">\index</span><span class="nb">{</span>standard predicates<span class="nb">}</span>
</div><div id="l1135" class="code_block">	Mainly used by developers when compiling system modules. If
</div><div id="l1136" class="code_block">	specified, standard predicates (see <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1137" class="code_block">	/<span class="k">\$</span>XSB<span class="k">\_DIR</span>/syslib/std<span class="k">\_xsb</span>.P<span class="nb">}</span>) are automatically available
</div><div id="l1138" class="code_block">	for use only if they are primitive predicates (see the file
</div><div id="l1139" class="code_block">	<span class="nb">{</span><span class="k">\tt</span> <span class="k">\$</span>XSB<span class="k">\_DIR</span>/syslib/machine.P<span class="nb">}</span> for a current listing of
</div><div id="l1140" class="code_block">	primitive predicates.  When compiling in this mode,
</div><div id="l1141" class="code_block">	non-primitive standard predicates must be explicitly imported
</div><div id="l1142" class="code_block">	from the appropriate system module.
</div><div id="l1143" class="code_block"><span class="k">\item</span><span class="na">[{\tt verbo}]</span> Compiles the files (modules) specified in ``verbose&#39;&#39; mode, 
</div><div id="l1144" class="code_block">	printing out information about the progress of the compilation of each 
</div><div id="l1145" class="code_block">	predicate.
</div><div id="l1146" class="code_block"><span class="k">\item</span><span class="na">[{\tt profile}]</span> This option is usually used when modifying the
</div><div id="l1147" class="code_block">	XSB compiler.  When specified, the compiler prints out
</div><div id="l1148" class="code_block">	information about the time spent in each phase of the
</div><div id="l1149" class="code_block">	compilation process.
</div><div id="l1150" class="code_block">
</div><div id="l1151" class="code_block"><span class="k">\item</span><span class="na">[{\tt asm\_dump, compile\_off}]</span> Generates a textual representation of 
</div><div id="l1152" class="code_block">	the SLG-WAM assembly code and writes it into the file <span class="nb">{</span><span class="k">\tt</span> module.A<span class="nb">}</span>
</div><div id="l1153" class="code_block">	where <span class="nb">{</span><span class="k">\tt</span> module<span class="nb">}</span> is the name of the module (file) being compiled.  
</div><div id="l1154" class="code_block">	
</div><div id="l1155" class="code_block">	<span class="nb">{</span><span class="k">\sc</span> Warning:<span class="nb">}</span> This option was created for compiler debugging and is
</div><div id="l1156" class="code_block">		not intended for general use.  There might be cases where
</div><div id="l1157" class="code_block">		compiling a module with these options may cause generation
</div><div id="l1158" class="code_block">		of an incorrect <span class="nb">{</span><span class="k">\tt</span> .A<span class="nb">}</span> and <span class="nb">{</span><span class="k">\tt</span> .O<span class="nb">}</span> file.  In such cases,
</div><div id="l1159" class="code_block">		the user can see the SLG-WAM instructions that are
</div><div id="l1160" class="code_block">		generated for a module by compiling the module as usual and
</div><div id="l1161" class="code_block">		then using the <span class="nb">{</span><span class="k">\tt</span> -d module.O<span class="nb">}</span> command-line option of the
</div><div id="l1162" class="code_block">		XSB emulator (see Section~<span class="k">\ref</span><span class="nb">{</span>sec:EmuOptions<span class="nb">}</span>).
</div><div id="l1163" class="code_block"><span class="k">\item</span><span class="na">[{\tt index\_off}]</span> When specified, the compiler does not generate indices
</div><div id="l1164" class="code_block">	for the predicates compiled.  
</div><div id="l1165" class="code_block"><span class="k">\end</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l1166" class="code_block">
</div><div id="l1167" class="code_block">
</div><div id="l1168" class="code_block"><span class="k">\subsection</span><span class="nb">{</span>Specialization<span class="nb">}</span><span class="k">\label</span><span class="nb">{</span>specialization<span class="nb">}</span>
</div><div id="l1169" class="code_block"><span class="k">\index</span><span class="nb">{</span>Compiler!specialization<span class="nb">}</span><span class="k">\index</span><span class="nb">{</span>specialization!Compiler<span class="nb">}</span>
</div><div id="l1170" class="code_block"><span class="c">%=============================================================</span>
</div><div id="l1171" class="code_block">
</div><div id="l1172" class="code_block">From Version 1.4.0 on, the XSB compiler automatically performs
</div><div id="l1173" class="code_block">specialization of partially instantiated calls.  Specialization can be
</div><div id="l1174" class="code_block">thought as a source-level program transformation of a program to a
</div><div id="l1175" class="code_block">residual program in which partially instantiated calls to predicates
</div><div id="l1176" class="code_block">in the original program are replaced with calls to specialized versions
</div><div id="l1177" class="code_block">of these predicates.  The expectation from this process is that the
</div><div id="l1178" class="code_block">calls in the residual program can be executed more efficiently that
</div><div id="l1179" class="code_block">their non-specialized counterparts.  This expectation is justified
</div><div id="l1180" class="code_block">mainly because of the following two basic properties of the
</div><div id="l1181" class="code_block">specialization algorithm:
</div><div id="l1182" class="code_block"><span class="k">\begin</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l1183" class="code_block"><span class="k">\item</span><span class="na">[Compile-time Clause Selection]</span> The specialized calls of the
</div><div id="l1184" class="code_block">	residual program  directly select (at compile time) a subset
</div><div id="l1185" class="code_block">	containing only the clauses that the corresponding calls of the
</div><div id="l1186" class="code_block">	original program would otherwise have to examine during their
</div><div id="l1187" class="code_block">	execution (at run time).  By doing so, laying down unnecessary
</div><div id="l1188" class="code_block">	choice points is at least partly avoided, and so is the need to
</div><div id="l1189" class="code_block">	select clauses through some sort of indexing.
</div><div id="l1190" class="code_block"><span class="k">\item</span><span class="na">[Factoring of Common Subterms]</span> Non-variable subterms of partially
</div><div id="l1191" class="code_block">	instantiated calls that are common with subterms in the heads
</div><div id="l1192" class="code_block">	of the selected clauses are factored out from these terms
</div><div id="l1193" class="code_block">	during the specialization process.  As a result, some head
</div><div id="l1194" class="code_block">	unification (<span class="nb">{</span><span class="k">\tt</span> get<span class="k">\_*</span><span class="nb">}</span> or <span class="nb">{</span><span class="k">\tt</span> unify<span class="k">\_*</span><span class="nb">}</span>) and some argument
</div><div id="l1195" class="code_block">	register (<span class="nb">{</span><span class="k">\tt</span> put<span class="k">\_*</span><span class="nb">}</span>) WAM instructions of the original
</div><div id="l1196" class="code_block">	program become unnecessary.  These instructions are eliminated
</div><div id="l1197" class="code_block">	from both the specialized calls as well as from the specialized
</div><div id="l1198" class="code_block">	versions of the predicates.
</div><div id="l1199" class="code_block"><span class="k">\end</span><span class="nb">{</span>description<span class="nb">}</span>
</div><div id="l1200" class="code_block">Though these properties are sufficient to get the idea behind
</div><div id="l1201" class="code_block">specialization, the actual specialization performed by the XSB
</div><div id="l1202" class="code_block">compiler can be better understood by the following example.  The
</div><div id="l1203" class="code_block">example shows the specialization of a predicate that checks if a list
</div><div id="l1204" class="code_block">of HiLog terms is ordered:
</div><div id="l1205" class="code_block"><span class="k">\begin</span><span class="nb">{</span>center<span class="nb">}</span>
</div><div id="l1206" class="code_block"><span class="k">\tt</span>
</div><div id="l1207" class="code_block"><span class="k">\begin</span><span class="nb">{</span>tabular<span class="nb">}{</span>ccc<span class="nb">}</span>
</div><div id="l1208" class="code_block"><span class="k">\begin</span><span class="nb">{</span>tabular<span class="nb">}{</span>l<span class="nb">}</span>
</div><div id="l1209" class="code_block">ordered([]). <span class="k">\\</span>
</div><div id="l1210" class="code_block">ordered([X]). <span class="k">\\</span>
</div><div id="l1211" class="code_block">ordered([X,Y|Z]) :- <span class="k">\\</span>
</div><div id="l1212" class="code_block"><span class="k">\</span> <span class="k">\</span> <span class="k">\</span> <span class="k">\</span> X @=&lt; Y, ordered([Y|Z]). 
</div><div id="l1213" class="code_block"><span class="k">\end</span><span class="nb">{</span>tabular<span class="nb">}</span>
</div><div id="l1214" class="code_block"><span class="nb">&amp;</span> <span class="s">$</span><span class="nv">\longrightarrow</span><span class="s">$</span> <span class="nb">&amp;</span>
</div><div id="l1215" class="code_block"><span class="k">\begin</span><span class="nb">{</span>tabular<span class="nb">}{</span>l<span class="nb">}</span>
</div><div id="l1216" class="code_block">ordered([]). <span class="k">\\</span>
</div><div id="l1217" class="code_block">ordered([X]). <span class="k">\\</span>
</div><div id="l1218" class="code_block">ordered([X,Y|Z]) :- <span class="k">\\</span>
</div><div id="l1219" class="code_block"><span class="k">\</span> <span class="k">\</span> <span class="k">\</span> <span class="k">\</span> X @=&lt; Y, <span class="k">\_\$</span>ordered(Y, Z). <span class="k">\\</span>
</div><div id="l1220" class="code_block"><span class="k">\\</span>
</div><div id="l1221" class="code_block">:- index <span class="k">\_\$</span>ordered/2-2. <span class="k">\\</span>
</div><div id="l1222" class="code_block"><span class="k">\_\$</span>ordered(X, []). <span class="k">\\</span>
</div><div id="l1223" class="code_block"><span class="k">\_\$</span>ordered(X, [Y|Z]) :- <span class="k">\\</span>
</div><div id="l1224" class="code_block"><span class="k">\</span> <span class="k">\</span> <span class="k">\</span> <span class="k">\</span> X @=&lt; Y, <span class="k">\_\$</span>ordered(Y, Z).
</div><div id="l1225" class="code_block"><span class="k">\end</span><span class="nb">{</span>tabular<span class="nb">}</span>
</div><div id="l1226" class="code_block"><span class="k">\end</span><span class="nb">{</span>tabular<span class="nb">}</span>
</div><div id="l1227" class="code_block"><span class="k">\end</span><span class="nb">{</span>center<span class="nb">}</span>
</div><div id="l1228" class="code_block">The transformation (driven by the partially instantiated call
</div><div id="l1229" class="code_block"><span class="nb">{</span><span class="k">\tt</span> ordered([Y|Z])<span class="nb">}</span>) effectively allows predicate <span class="nb">{</span><span class="k">\tt</span> ordered/2<span class="nb">}</span>
</div><div id="l1230" class="code_block">to be completely deterministic (when used with a proper list as its
</div><div id="l1231" class="code_block">argument), and to not use any unnecessary heap-space for its
</div><div id="l1232" class="code_block">execution.  We note that appropriate <span class="nb">{</span><span class="k">\tt</span> :- index<span class="nb">}</span> directives are
</div><div id="l1233" class="code_block">automatically generated by the XSB compiler for all specialized
</div><div id="l1234" class="code_block">versions of predicates.
</div><div id="l1235" class="code_block">
</div><div id="l1236" class="code_block">The default specialization of partially instantiated calls is without
</div><div id="l1237" class="code_block">any folding of the clauses that the calls select.  Using the <span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1238" class="code_block">spec<span class="k">\_repr</span><span class="nb">}</span> compiler option (see Section~<span class="k">\ref</span><span class="nb">{</span>sec:CompilerOptions<span class="nb">}</span>)
</div><div id="l1239" class="code_block">specialization with replacement of the selected clauses with the
</div><div id="l1240" class="code_block">representative of these clauses is performed.  Using this compiler
</div><div id="l1241" class="code_block">option, predicate <span class="nb">{</span><span class="k">\tt</span> ordered/2<span class="nb">}</span> above would be specialized as follows:
</div><div id="l1242" class="code_block"><span class="c">%%</span>
</div><div id="l1243" class="code_block"><span class="k">\begin</span><span class="nb">{</span>center<span class="nb">}</span>
</div><div id="l1244" class="code_block"><span class="k">\begin</span><span class="nb">{</span>minipage<span class="nb">}{</span>4.1in<span class="nb">}</span>
</div><div id="l1245" class="code_block"><span class="k">\begin</span><span class="nb">{</span>verbatim<span class="nb">}</span>
</div><div id="l1246" class="code_block">ordered([]).
</div><div id="l1247" class="code_block">ordered([X|Y]) :- <span class="nb">_</span><span class="s">$</span><span class="nb">ordered</span><span class="o">(</span><span class="nb">X, Y</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1248" class="code_block">
</div><div id="l1249" class="code_block"><span class="nb">:</span><span class="o">-</span><span class="nb"> index _</span><span class="s">$</span>ordered/2-2.
</div><div id="l1250" class="code_block"><span class="nb">_</span><span class="s">$</span><span class="nb">ordered</span><span class="o">(</span><span class="nb">X, </span><span class="o">[])</span><span class="nb">.</span>
</div><div id="l1251" class="code_block"><span class="nb">_</span><span class="s">$</span>ordered(X, [Y|Z]) :- X @=&lt; Y, <span class="nb">_</span><span class="s">$</span><span class="nb">ordered</span><span class="o">(</span><span class="nb">Y, Z</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1252" class="code_block"><span class="nv">\end</span><span class="nb">{verbatim}</span>
</div><div id="l1253" class="code_block"><span class="nv">\end</span><span class="nb">{minipage}</span>
</div><div id="l1254" class="code_block"><span class="nv">\end</span><span class="nb">{center}</span>
</div><div id="l1255" class="code_block"><span class="c">%%$</span>
</div><div id="l1256" class="code_block"><span class="c">%%</span>
</div><div id="l1257" class="code_block"><span class="nb">We note that in the presense of cuts or side</span><span class="o">-</span><span class="nb">effects, the code</span>
</div><div id="l1258" class="code_block"><span class="nb">replacement operation is not always sound, i.e.  there are cases when</span>
</div><div id="l1259" class="code_block"><span class="nb">the original and the residual program are not computationally equivalent</span>
</div><div id="l1260" class="code_block"><span class="o">(</span><span class="nb">with respect to the answer substitution semantics</span><span class="o">)</span><span class="nb">.  The compiler</span>
</div><div id="l1261" class="code_block"><span class="nb">checks for sufficient </span><span class="o">(</span><span class="nb">but not necessary</span><span class="o">)</span><span class="nb"> conditions that guarantee</span>
</div><div id="l1262" class="code_block"><span class="nb">computational equivalence, and if these conditions are not met,</span>
</div><div id="l1263" class="code_block"><span class="nb">specialization is not performed for the violating calls.</span>
</div><div id="l1264" class="code_block">
</div><div id="l1265" class="code_block"><span class="nb">The XSB compiler prints out messages whenever it specialises</span>
</div><div id="l1266" class="code_block"><span class="nb">calls to some predicate.  For example, while compiling a file</span>
</div><div id="l1267" class="code_block"><span class="nb">containing predicate {</span><span class="nv">\tt</span><span class="nb"> ordered</span><span class="o">/</span><span class="m">1</span><span class="nb">} above, the compiler would print</span>
</div><div id="l1268" class="code_block"><span class="nb">out the following message:</span>
</div><div id="l1269" class="code_block"><span class="nv">\begin</span><span class="nb">{center}</span>
</div><div id="l1270" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb">	</span><span class="nv">\%</span><span class="nb"> Specialising partially instantiated calls to ordered</span><span class="o">/</span><span class="m">1</span><span class="nb">}</span>
</div><div id="l1271" class="code_block"><span class="nv">\end</span><span class="nb">{center}</span>
</div><div id="l1272" class="code_block"><span class="nb">The user may examine the result of the specialization transformation</span>
</div><div id="l1273" class="code_block"><span class="nb">by using the {</span><span class="nv">\tt</span><span class="nb"> spec</span><span class="nv">\_</span><span class="nb">dump} compiler option</span>
</div><div id="l1274" class="code_block"><span class="o">(</span><span class="nb">see Section~</span><span class="nv">\ref</span><span class="nb">{sec:CompilerOptions}</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1275" class="code_block">
</div><div id="l1276" class="code_block"><span class="nb">Finally, we have to mention that for technical reasons beyond the scope of</span>
</div><div id="l1277" class="code_block"><span class="nb">this document, specialization cannot be transparent to the user; predicates</span>
</div><div id="l1278" class="code_block"><span class="nb">created by the transformation do appear during tracing.</span>
</div><div id="l1279" class="code_block">
</div><div id="l1280" class="code_block">
</div><div id="l1281" class="code_block"><span class="nv">\subsection</span><span class="nb">{Compiler Directives}</span><span class="nv">\label</span><span class="nb">{compiler_directives}</span>
</div><div id="l1282" class="code_block"><span class="nv">\index</span><span class="nb">{Compiler</span><span class="o">!</span><span class="nb">directives}</span><span class="nv">\index</span><span class="nb">{directives</span><span class="o">!</span><span class="nb">Compiler}</span>
</div><div id="l1283" class="code_block"><span class="c">%=====================================================</span>
</div><div id="l1284" class="code_block">
</div><div id="l1285" class="code_block"><span class="nb">The following compiler directives are recognized in </span><span class="nv">\version\</span><span class="nb"> of XSB</span>
</div><div id="l1286" class="code_block"><span class="nv">\footnote</span><span class="nb">{Any parallelisation directives </span><span class="o">(</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> parallel}</span><span class="o">)</span><span class="nb"> are simply</span>
</div><div id="l1287" class="code_block"><span class="nb">ignored by the compiler, but do not result in syntax errors to enhance</span>
</div><div id="l1288" class="code_block"><span class="nb">compatibility with various other earlier versions of PSB</span><span class="o">-</span><span class="nb">Prolog.}.</span>
</div><div id="l1289" class="code_block">
</div><div id="l1290" class="code_block"><span class="nv">\subsubsection</span><span class="nb">{Mode Declarations}</span><span class="nv">\label</span><span class="nb">{mode_declarations}</span>
</div><div id="l1291" class="code_block"><span class="nv">\index</span><span class="nb">{modes</span><span class="o">!</span><span class="nb">directives}</span><span class="nv">\index</span><span class="nb">{directives</span><span class="o">!</span><span class="nb">modes}</span>
</div><div id="l1292" class="code_block"><span class="c">%-----------------------------------------------------</span>
</div><div id="l1293" class="code_block">
</div><div id="l1294" class="code_block"><span class="nb">The XSB compiler accepts {</span><span class="nv">\tt</span><span class="nb"> mode} declarations of the form:</span>
</div><div id="l1295" class="code_block">
</div><div id="l1296" class="code_block"><span class="nv">\demo</span><span class="nb">{:</span><span class="o">-</span><span class="nb"> mode </span><span class="s">$</span>ModeAnnot<span class="nb">_</span>1, <span class="k">\ldots</span>, ModeAnnot<span class="nb">_</span>n<span class="s">$</span><span class="nb">.}</span>
</div><div id="l1297" class="code_block">
</div><div id="l1298" class="code_block"><span class="nv">\noindent</span>
</div><div id="l1299" class="code_block"><span class="nb">where each </span><span class="s">$</span>ModeAnnot<span class="s">$</span><span class="nb"> is a {</span><span class="nv">\em</span><span class="nb"> mode annotation</span><span class="nv">\/</span><span class="nb">} </span><span class="o">(</span><span class="nb">a {</span><span class="nv">\em</span><span class="nb"> term</span>
</div><div id="l1300" class="code_block"><span class="nb">indicator</span><span class="nv">\/</span><span class="nb">} whose arguments are elements of the set {</span><span class="nv">\tt</span>
</div><div id="l1301" class="code_block"><span class="s">$</span><span class="k">\{</span><span class="s">$</span><span class="o">+</span><span class="nb">,</span><span class="o">-</span><span class="nb">,</span><span class="nv">\#</span><span class="nb">,?</span><span class="s">$</span><span class="k">\}</span><span class="s">$</span><span class="nb">}</span><span class="o">)</span><span class="nb">.  From Version </span><span class="m">1</span><span class="nb">.</span><span class="m">4</span><span class="nb">.</span><span class="m">1</span><span class="nb"> on, {</span><span class="nv">\tt</span><span class="nb"> mode} directives are</span>
</div><div id="l1302" class="code_block"><span class="nb">used by the compiler for tabling directives, a use which differs from</span>
</div><div id="l1303" class="code_block"><span class="nb">the standard use of modes in Prolog systems</span><span class="nv">\footnote</span><span class="nb">{The most common</span>
</div><div id="l1304" class="code_block"><span class="nb">uses of {</span><span class="nv">\tt</span><span class="nb"> mode} declarations in Prolog systems are to reduce the</span>
</div><div id="l1305" class="code_block"><span class="nb">size of compiled code, or to speed up a predicate&#39;s execution.}.  See</span>
</div><div id="l1306" class="code_block"><span class="nb">Section~</span><span class="nv">\ref</span><span class="nb">{tabling_directives} for detailed examples.</span>
</div><div id="l1307" class="code_block">
</div><div id="l1308" class="code_block"><span class="nb">Mode annotations have the following meaning:</span>
</div><div id="l1309" class="code_block"><span class="nv">\begin</span><span class="nb">{description}</span>
</div><div id="l1310" class="code_block"><span class="nv">\item</span><span class="o">[</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">}</span><span class="o">]</span>
</div><div id="l1311" class="code_block"><span class="nb">	This argument is an input to the predicate.  In every invocation</span>
</div><div id="l1312" class="code_block"><span class="nb">	of the predicate, the argument position must contain a non</span><span class="o">-</span><span class="nb">variable</span>
</div><div id="l1313" class="code_block"><span class="nb">	term.  This term may not necessarily be ground, but the </span>
</div><div id="l1314" class="code_block"><span class="nb">	predicate is guaranteed not to alter this argument</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1315" class="code_block">
</div><div id="l1316" class="code_block"><span class="nb">	</span><span class="nv">\demo</span><span class="nb">{:</span><span class="o">-</span><span class="nb"> mode see</span><span class="o">(+)</span><span class="nb">, assert</span><span class="o">(+)</span><span class="nb">.}</span>
</div><div id="l1317" class="code_block"><span class="nv">\item</span><span class="o">[</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">-</span><span class="nb">}</span><span class="o">]</span>
</div><div id="l1318" class="code_block"><span class="nb">	This argument is an output of the predicate.  In every</span>
</div><div id="l1319" class="code_block"><span class="nb">	invocation of the predicate the argument</span>
</div><div id="l1320" class="code_block"><span class="nb">	position {</span><span class="nv">\em</span><span class="nb"> will always be a variable</span><span class="nv">\/</span><span class="nb">} </span><span class="o">(</span><span class="nb">as opposed to </span>
</div><div id="l1321" class="code_block"><span class="nb">	the {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\#</span><span class="nb">} annotation below</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1322" class="code_block"><span class="nb">	This variable is unified with the value returned by the predicate.</span>
</div><div id="l1323" class="code_block"><span class="nb">	We note that Prolog does not enforce the requirement that output</span>
</div><div id="l1324" class="code_block"><span class="nb">	arguments should be variables; however, output unification is not</span>
</div><div id="l1325" class="code_block"><span class="nb">	very common in practice.</span>
</div><div id="l1326" class="code_block">
</div><div id="l1327" class="code_block"><span class="nb">	</span><span class="nv">\demo</span><span class="nb">{:</span><span class="o">-</span><span class="nb"> mode cputime</span><span class="o">(-)</span><span class="nb">.}</span>
</div><div id="l1328" class="code_block"><span class="nv">\item</span><span class="o">[</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\#</span><span class="nb">}</span><span class="o">]</span>
</div><div id="l1329" class="code_block"><span class="nb">	This argument is either:</span>
</div><div id="l1330" class="code_block"><span class="nb">	</span><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l1331" class="code_block"><span class="nb">	</span><span class="nv">\item</span><span class="nb">	An output argument of the predicate for which a non</span><span class="o">-</span><span class="nb">variable</span>
</div><div id="l1332" class="code_block"><span class="nb">		value may be supplied for this argument position.  If such a</span>
</div><div id="l1333" class="code_block"><span class="nb">		value is supplied, the result in this position is unified with</span>
</div><div id="l1334" class="code_block"><span class="nb">		the supplied supplied value.  The predicate fails if this</span>
</div><div id="l1335" class="code_block"><span class="nb">		unification fails.  If a variable term is supplied, the</span>
</div><div id="l1336" class="code_block"><span class="nb">		predicate succeeds, and the output variable is unified with</span>
</div><div id="l1337" class="code_block"><span class="nb">		the return value.</span>
</div><div id="l1338" class="code_block">
</div><div id="l1339" class="code_block"><span class="nb">		</span><span class="nv">\demo</span><span class="nb">{:</span><span class="o">-</span><span class="nb"> mode &#39;</span><span class="o">=</span><span class="nb">&#39;</span><span class="o">(</span><span class="nv">\#</span><span class="nb">,</span><span class="nv">\#</span><span class="o">)</span><span class="nb">.}</span>
</div><div id="l1340" class="code_block"><span class="nb">	</span><span class="nv">\item</span><span class="nb">	An input</span><span class="o">/</span><span class="nb">output argument position of a predicate that has</span>
</div><div id="l1341" class="code_block"><span class="nb">		only side</span><span class="o">-</span><span class="nb">effects </span><span class="o">(</span><span class="nb">usually by further instantiating that</span>
</div><div id="l1342" class="code_block"><span class="nb">		argument</span><span class="o">)</span><span class="nb">.  The {</span><span class="nv">\tt</span><span class="nb"> </span><span class="nv">\#</span><span class="nb">} symbol is used to denote the </span><span class="s">$</span><span class="k">\pm</span><span class="s">$</span>
</div><div id="l1343" class="code_block"><span class="nb">		symbol that cannot be entered from the keyboard.</span>
</div><div id="l1344" class="code_block"><span class="nb">	</span><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l1345" class="code_block"><span class="nv">\item</span><span class="o">[</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> ?}</span><span class="o">]</span>
</div><div id="l1346" class="code_block"><span class="nb">	This argument does not fall into any of the above categories. </span>
</div><div id="l1347" class="code_block"><span class="nb">        Typical cases would be the following:</span>
</div><div id="l1348" class="code_block"><span class="nb">	</span><span class="nv">\begin</span><span class="nb">{itemize}</span>
</div><div id="l1349" class="code_block"><span class="nb">	</span><span class="nv">\item</span><span class="nb">	An argument that can be used both as input and as output</span>
</div><div id="l1350" class="code_block"><span class="nb">		</span><span class="o">(</span><span class="nb">but usually not with both uses at the same time</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1351" class="code_block">
</div><div id="l1352" class="code_block"><span class="nb">		</span><span class="nv">\demo</span><span class="nb">{:</span><span class="o">-</span><span class="nb"> mode functor</span><span class="o">(</span><span class="nb">?,?,?</span><span class="o">)</span><span class="nb">.}</span>
</div><div id="l1353" class="code_block"><span class="nb">	</span><span class="nv">\item</span><span class="nb">	An input argument where the term supplied can be a variable</span>
</div><div id="l1354" class="code_block"><span class="nb">		</span><span class="o">(</span><span class="nb">so that the argument cannot be annotated as {</span><span class="nv">\tt</span><span class="nb"> </span><span class="o">+</span><span class="nb">}</span><span class="o">)</span><span class="nb">, or is</span>
</div><div id="l1355" class="code_block"><span class="nb">		instantiated to a term which itself contains uninstantiated</span>
</div><div id="l1356" class="code_block"><span class="nb">		variables, but the predicate is guaranteed {</span><span class="nv">\em</span><span class="nb"> not</span><span class="nv">\/</span><span class="nb">} to</span>
</div><div id="l1357" class="code_block"><span class="nb">		bind any of these variables.</span>
</div><div id="l1358" class="code_block">
</div><div id="l1359" class="code_block"><span class="nb">		</span><span class="nv">\demo</span><span class="nb">{:</span><span class="o">-</span><span class="nb"> mode var</span><span class="o">(</span><span class="nb">?</span><span class="o">)</span><span class="nb">, write</span><span class="o">(</span><span class="nb">?</span><span class="o">)</span><span class="nb">.}</span>
</div><div id="l1360" class="code_block"><span class="nb">	</span><span class="nv">\end</span><span class="nb">{itemize}</span>
</div><div id="l1361" class="code_block"><span class="nv">\end</span><span class="nb">{description}</span>
</div><div id="l1362" class="code_block"><span class="nb">We try to follow these mode annotation conventions throughout this manual.</span>
</div><div id="l1363" class="code_block">
</div><div id="l1364" class="code_block"><span class="nb">Finally, we warn the user that {</span><span class="nv">\tt</span><span class="nb"> mode} declarations can be error</span><span class="o">-</span><span class="nb">prone,</span>
</div><div id="l1365" class="code_block"><span class="nb">and since errors in mode declarations do not show up while running the</span>
</div><div id="l1366" class="code_block"><span class="nb">predicates interactively, unexpected behavior may be witnessed in compiled</span>
</div><div id="l1367" class="code_block"><span class="nb">code, optimized to take modes into account </span><span class="o">(</span><span class="nb">currently not performed by</span>
</div><div id="l1368" class="code_block"><span class="nb">XSB</span><span class="o">)</span><span class="nv">\@</span><span class="nb">.  However, despite this danger, {</span><span class="nv">\tt</span><span class="nb"> mode} annotations can be</span>
</div><div id="l1369" class="code_block"><span class="nb">a good source of documentation, since they express the programmer&#39;s</span>
</div><div id="l1370" class="code_block"><span class="nb">intention of data flow in the program.</span>
</div><div id="l1371" class="code_block">
</div><div id="l1372" class="code_block">
</div><div id="l1373" class="code_block"><span class="nv">\subsubsection</span><span class="nb">{Tabling Directives}</span><span class="nv">\label</span><span class="nb">{tabling_directives}</span>
</div><div id="l1374" class="code_block"><span class="nv">\index</span><span class="nb">{tabling</span><span class="o">!</span><span class="nb">directives}</span><span class="nv">\index</span><span class="nb">{directives</span><span class="o">!</span><span class="nb">tabling}</span>
</div><div id="l1375" class="code_block"><span class="c">%-----------------------------------------------------</span>
</div><div id="l1376" class="code_block"><span class="nv">\index</span><span class="nb">{{</span><span class="nv">\tt</span><span class="nb"> auto</span><span class="nv">\_</span><span class="nb">table}}</span>
</div><div id="l1377" class="code_block"><span class="nb">Memoization is often necessary to ensure that programs terminate, and</span>
</div><div id="l1378" class="code_block"><span class="nb">can be useful as an optimization strategy as well.  The underlying</span>
</div><div id="l1379" class="code_block"><span class="nb">engine of XSB is based on SLG, a memoization strategy, which,</span>
</div><div id="l1380" class="code_block"><span class="nb">in our version, maintains a table of calls and their answers for each</span>
</div><div id="l1381" class="code_block"><span class="nb">predicate declared as {</span><span class="nv">\em</span><span class="nb"> tabled}.  Predicates that are not declared</span>
</div><div id="l1382" class="code_block"><span class="nb">as tabled execute as in Prolog, eliminating the expense of tabling</span>
</div><div id="l1383" class="code_block"><span class="nb">when it is unnecessary.</span>
</div><div id="l1384" class="code_block">
</div><div id="l1385" class="code_block"><span class="nb">The simplest way to use tabling is to include the directive</span>
</div><div id="l1386" class="code_block">
</div><div id="l1387" class="code_block"><span class="nv">\demo</span><span class="nb">{:</span><span class="o">-</span><span class="nb"> auto</span><span class="nv">\_</span><span class="nb">table.}</span>
</div><div id="l1388" class="code_block">
</div><div id="l1389" class="code_block"><span class="nv">\noindent</span>
</div><div id="l1390" class="code_block"><span class="nb">anywhere in the source file.  {</span><span class="nv">\tt</span><span class="nb"> auto</span><span class="nv">\_</span><span class="nb">table} declares predicates</span>
</div><div id="l1391" class="code_block"><span class="nb">tabled so that the program will terminate.</span>
</div><div id="l1392" class="code_block">
</div><div id="l1393" class="code_block"><span class="nb">To understand precisely how {</span><span class="nv">\tt</span><span class="nb"> auto</span><span class="nv">\_</span><span class="nb">table} does this, it is</span>
</div><div id="l1394" class="code_block"><span class="nb">necessary to mention a few properties of SLG.  For programs which have</span>
</div><div id="l1395" class="code_block"><span class="nb">no function symbols, or where function symbols always have a limited</span>
</div><div id="l1396" class="code_block"><span class="nb">depth, SLG resolution ensures that any query will terminate after it</span>
</div><div id="l1397" class="code_block"><span class="nb">has found all correct answers.  In the rest of this section, we</span>
</div><div id="l1398" class="code_block"><span class="nb">restrict consideration to such programs.</span>
</div><div id="l1399" class="code_block">
</div><div id="l1400" class="code_block"><span class="nb">Obviously, not all predicates will need to be tabled for a program to</span>
</div><div id="l1401" class="code_block"><span class="nb">terminate.  The {</span><span class="nv">\tt</span><span class="nb"> auto</span><span class="nv">\_</span><span class="nb">table} compiler directive tables only those</span>
</div><div id="l1402" class="code_block"><span class="nb">predicates of a module which appear to static analysis to contain an</span>
</div><div id="l1403" class="code_block"><span class="nb">infinite loop, or which are called directly through {</span><span class="nv">\tt</span><span class="nb"> tnot</span><span class="o">/</span><span class="m">1</span><span class="nb">}.  It</span>
</div><div id="l1404" class="code_block"><span class="nb">is perhaps more illuminating to demonstrate these conditions through</span>
</div><div id="l1405" class="code_block"><span class="nb">an example rather than explaining them.  For instance, in the program.</span>
</div><div id="l1406" class="code_block">
</div><div id="l1407" class="code_block"><span class="c">%tls commented out minipage because latex was formatting badly,</span>
</div><div id="l1408" class="code_block"><span class="nv">\begin</span><span class="nb">{center}</span>
</div><div id="l1409" class="code_block"><span class="c">%\begin{minipage}{3in}</span>
</div><div id="l1410" class="code_block"><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l1411" class="code_block"><span class="nb">:</span><span class="o">-</span><span class="nb"> auto_table. </span>
</div><div id="l1412" class="code_block">
</div><div id="l1413" class="code_block"><span class="nb">p</span><span class="o">(</span><span class="nb">a</span><span class="o">)</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> s</span><span class="o">(</span><span class="nb">f</span><span class="o">(</span><span class="nb">a</span><span class="o">))</span><span class="nb">. </span>
</div><div id="l1414" class="code_block">
</div><div id="l1415" class="code_block"><span class="nb">s</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> p</span><span class="o">(</span><span class="nb">f</span><span class="o">(</span><span class="nb">a</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l1416" class="code_block">
</div><div id="l1417" class="code_block"><span class="nb">r</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> q</span><span class="o">(</span><span class="nb">X,W</span><span class="o">)</span><span class="nb">,r</span><span class="o">(</span><span class="nb">Y</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1418" class="code_block">
</div><div id="l1419" class="code_block"><span class="nb">m</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> tnot</span><span class="o">(</span><span class="nb">f</span><span class="o">(</span><span class="nb">X</span><span class="o">))</span><span class="nb">.</span>
</div><div id="l1420" class="code_block">
</div><div id="l1421" class="code_block"><span class="nb">:</span><span class="o">-</span><span class="nb"> mode ap</span><span class="m">1</span><span class="o">(-</span><span class="nb">,</span><span class="o">-</span><span class="nb">,</span><span class="o">+)</span><span class="nb">.</span>
</div><div id="l1422" class="code_block"><span class="nb">ap</span><span class="m">1</span><span class="o">([</span><span class="nb">H|T</span><span class="o">]</span><span class="nb">,L,</span><span class="o">[</span><span class="nb">H|L</span><span class="m">1</span><span class="o">])</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> ap</span><span class="m">1</span><span class="o">(</span><span class="nb">T,L,L</span><span class="m">1</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1423" class="code_block">
</div><div id="l1424" class="code_block"><span class="nb">:</span><span class="o">-</span><span class="nb"> mode ap</span><span class="o">(+</span><span class="nb">,</span><span class="o">+</span><span class="nb">,</span><span class="o">-)</span><span class="nb">.</span>
</div><div id="l1425" class="code_block"><span class="nb">ap</span><span class="o">([]</span><span class="nb">,F,F</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1426" class="code_block"><span class="nb">ap</span><span class="o">([</span><span class="nb">H|T</span><span class="o">]</span><span class="nb">,L,</span><span class="o">[</span><span class="nb">H|L</span><span class="m">1</span><span class="o">])</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> ap</span><span class="o">(</span><span class="nb">T,L,L</span><span class="m">1</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1427" class="code_block">
</div><div id="l1428" class="code_block"><span class="nb">mem</span><span class="o">(</span><span class="nb">H,</span><span class="o">[</span><span class="nb">H|T</span><span class="o">])</span><span class="nb">.</span>
</div><div id="l1429" class="code_block"><span class="nb">mem</span><span class="o">(</span><span class="nb">H,</span><span class="o">[</span><span class="nb">_|T</span><span class="o">])</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> mem</span><span class="o">(</span><span class="nb">H,T</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1430" class="code_block"><span class="nv">\end</span><span class="nb">{verbatim}</span>
</div><div id="l1431" class="code_block"><span class="c">%\end{minipage}</span>
</div><div id="l1432" class="code_block"><span class="nv">\end</span><span class="nb">{center}</span>
</div><div id="l1433" class="code_block">
</div><div id="l1434" class="code_block"><span class="nv">\noindent</span>
</div><div id="l1435" class="code_block"><span class="nb">The compiler prints out the messages</span>
</div><div id="l1436" class="code_block"><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l1437" class="code_block"><span class="c">% Compiling predicate s/1 as a tabled predicate</span>
</div><div id="l1438" class="code_block"><span class="c">% Compiling predicate r/1 as a tabled predicate</span>
</div><div id="l1439" class="code_block"><span class="c">% Compiling predicate m/1 as a tabled predicate</span>
</div><div id="l1440" class="code_block"><span class="c">% Compiling predicate mem/2 as a tabled predicate</span>
</div><div id="l1441" class="code_block"><span class="nv">\end</span><span class="nb">{verbatim}</span>
</div><div id="l1442" class="code_block">
</div><div id="l1443" class="code_block"><span class="nb">Terminating conditions were detected for {</span><span class="nv">\tt</span><span class="nb"> ap</span><span class="m">1</span><span class="o">/</span><span class="m">3</span><span class="nb">} and {</span><span class="nv">\tt</span><span class="nb"> ap</span><span class="o">/</span><span class="m">3</span><span class="nb">}, but</span>
</div><div id="l1444" class="code_block"><span class="nb">not for any of the other predicates.</span>
</div><div id="l1445" class="code_block">
</div><div id="l1446" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> auto</span><span class="nv">\_</span><span class="nb">table} gives an approximation of tabled programs which we</span>
</div><div id="l1447" class="code_block"><span class="nb">hope will be useful for most programs.  The minimal set of tabled</span>
</div><div id="l1448" class="code_block"><span class="nb">predicates needed to insure termination for a given program is</span>
</div><div id="l1449" class="code_block"><span class="nb">undecidable.  </span>
</div><div id="l1450" class="code_block"><span class="nv">\comment</span><span class="nb">{</span>
</div><div id="l1451" class="code_block"><span class="nb">Practically, refining the set of tabled predicates</span>
</div><div id="l1452" class="code_block"><span class="nb">deduced by {</span><span class="nv">\tt</span><span class="nb"> auto</span><span class="nv">\_</span><span class="nb">table} is still an open research problem.</span>
</div><div id="l1453" class="code_block"><span class="nb">}</span>
</div><div id="l1454" class="code_block"><span class="nb">It should be noted that the presence of meta</span><span class="o">-</span><span class="nb">predicates such as {</span><span class="nv">\tt</span>
</div><div id="l1455" class="code_block"><span class="nb">call</span><span class="o">/</span><span class="m">1</span><span class="nb">} makes any static analysis useless, so that the {</span><span class="nv">\tt</span>
</div><div id="l1456" class="code_block"><span class="nb">auto</span><span class="nv">\_</span><span class="nb">table} directive should not be used in such cases.</span>
</div><div id="l1457" class="code_block">
</div><div id="l1458" class="code_block"><span class="nb">Predicates can be explicitly declared as tabled as well, through the</span>
</div><div id="l1459" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> table</span><span class="o">/</span><span class="m">1</span><span class="nb">}.  When {</span><span class="nv">\tt</span><span class="nb"> table</span><span class="o">/</span><span class="m">1</span><span class="nb">} is used, the directive takes the</span>
</div><div id="l1460" class="code_block"><span class="nb">form</span>
</div><div id="l1461" class="code_block">
</div><div id="l1462" class="code_block"><span class="nv">\demo</span><span class="nb">{:</span><span class="o">-</span><span class="nb"> table</span><span class="o">(</span><span class="nb">F</span><span class="o">/</span><span class="nb">A</span><span class="o">)</span><span class="nb">.}</span>
</div><div id="l1463" class="code_block">
</div><div id="l1464" class="code_block"><span class="nv">\noindent</span>
</div><div id="l1465" class="code_block"><span class="nb">where {</span><span class="nv">\tt</span><span class="nb"> F} is the functor of the predicate to be tabled, and {</span><span class="nv">\tt</span><span class="nb"> A} its</span>
</div><div id="l1466" class="code_block"><span class="nb">arity.  </span>
</div><div id="l1467" class="code_block">
</div><div id="l1468" class="code_block"><span class="nv">\index</span><span class="nb">{{</span><span class="nv">\tt</span><span class="nb"> suppl</span><span class="nv">\_</span><span class="nb">table}}</span>
</div><div id="l1469" class="code_block"><span class="nb">Another use of tabling is to filter out redundant solutions for</span>
</div><div id="l1470" class="code_block"><span class="nb">efficiency rather than termination.  In this case, suppose that the</span>
</div><div id="l1471" class="code_block"><span class="nb">directive {</span><span class="nv">\tt</span><span class="nb"> edb</span><span class="o">/</span><span class="m">1</span><span class="nb">} were used to indicate that certain predicates were</span>
</div><div id="l1472" class="code_block"><span class="nb">likely to have a large number of clauses.  Then the action of the declaration</span>
</div><div id="l1473" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> suppl</span><span class="nv">\_</span><span class="nb">table} in the program:</span>
</div><div id="l1474" class="code_block"><span class="nv">\begin</span><span class="nb">{verbatim}</span>
</div><div id="l1475" class="code_block"><span class="nb">:</span><span class="o">-</span><span class="nb"> edb</span><span class="o">(</span><span class="nb">r</span><span class="m">1</span><span class="o">/</span><span class="m">2</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1476" class="code_block"><span class="nb">:</span><span class="o">-</span><span class="nb"> edb</span><span class="o">(</span><span class="nb">r</span><span class="m">2</span><span class="o">/</span><span class="m">2</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1477" class="code_block"><span class="nb">:</span><span class="o">-</span><span class="nb"> edb</span><span class="o">(</span><span class="nb">r</span><span class="m">3</span><span class="o">/</span><span class="m">2</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1478" class="code_block">
</div><div id="l1479" class="code_block"><span class="nb">:</span><span class="o">-</span><span class="nb"> suppl_table.</span>
</div><div id="l1480" class="code_block">
</div><div id="l1481" class="code_block"><span class="nb">join</span><span class="o">(</span><span class="nb">X,Z</span><span class="o">)</span><span class="nb">:</span><span class="o">-</span><span class="nb"> r</span><span class="m">1</span><span class="o">(</span><span class="nb">X,X</span><span class="m">1</span><span class="o">)</span><span class="nb">,r</span><span class="m">2</span><span class="o">(</span><span class="nb">X</span><span class="m">1</span><span class="nb">,X</span><span class="m">2</span><span class="o">)</span><span class="nb">,r</span><span class="m">3</span><span class="o">(</span><span class="nb">X</span><span class="m">2</span><span class="nb">,Z</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1482" class="code_block"><span class="nv">\end</span><span class="nb">{verbatim}</span>
</div><div id="l1483" class="code_block"><span class="nb">would be to table {</span><span class="nv">\tt</span><span class="nb"> join</span><span class="o">/</span><span class="m">2</span><span class="nb">}.  The {</span><span class="nv">\tt</span><span class="nb"> suppl</span><span class="nv">\_</span><span class="nb">table} directive is</span>
</div><div id="l1484" class="code_block"><span class="nb">the XSB analogue to the deductive database optimization, {</span><span class="nv">\em</span>
</div><div id="l1485" class="code_block"><span class="nb">supplementary magic templates} </span><span class="nv">\cite</span><span class="nb">{BeRa</span><span class="m">91</span><span class="nb">}.  {</span><span class="nv">\tt</span><span class="nb"> suppl</span><span class="nv">\_</span><span class="nb">table</span><span class="o">/</span><span class="m">0</span><span class="nb">} is</span>
</div><div id="l1486" class="code_block"><span class="nb">shorthand for {</span><span class="nv">\tt</span><span class="nb"> suppl</span><span class="nv">\_</span><span class="nb">table</span><span class="o">(</span><span class="m">2</span><span class="o">)</span><span class="nb">} which tables all predicates</span>
</div><div id="l1487" class="code_block"><span class="nb">containing clauses with two or more {</span><span class="nv">\tt</span><span class="nb"> edb} facts or tabled</span>
</div><div id="l1488" class="code_block"><span class="nb">predicates.  By specifying {</span><span class="nv">\tt</span><span class="nb"> suppl</span><span class="nv">\_</span><span class="nb">table</span><span class="o">(</span><span class="m">3</span><span class="o">)</span><span class="nb">} for instance, only</span>
</div><div id="l1489" class="code_block"><span class="nb">predicates containing clauses with three or more {</span><span class="nv">\tt</span><span class="nb"> edb} facts or</span>
</div><div id="l1490" class="code_block"><span class="nb">tabled predicates would be tabled.  This flexibility can prove useful</span>
</div><div id="l1491" class="code_block"><span class="nb">for certain data</span><span class="o">-</span><span class="nb">intensive applications.</span>
</div><div id="l1492" class="code_block">
</div><div id="l1493" class="code_block">
</div><div id="l1494" class="code_block"><span class="nv">\subsubsection</span><span class="nb">{Indexing Directives}</span><span class="nv">\label</span><span class="nb">{indexing_directives}</span>
</div><div id="l1495" class="code_block"><span class="nv">\index</span><span class="nb">{indexing</span><span class="o">!</span><span class="nb">directives}</span><span class="nv">\index</span><span class="nb">{directives</span><span class="o">!</span><span class="nb">indexing}</span>
</div><div id="l1496" class="code_block"><span class="c">%-------------------------------------------------------------</span>
</div><div id="l1497" class="code_block">
</div><div id="l1498" class="code_block"><span class="nb">The XSB compiler usually generates an index on the principal </span>
</div><div id="l1499" class="code_block"><span class="nb">functor of the first argument of a predicate.  Indexing on the appropriate </span>
</div><div id="l1500" class="code_block"><span class="nb">argument of a predicate may significantly speed up its execution time.  </span>
</div><div id="l1501" class="code_block"><span class="nb">In many cases the first argument of a predicate may not be the most</span>
</div><div id="l1502" class="code_block"><span class="nb">appropriate argument for indexing and changing the order of arguments</span>
</div><div id="l1503" class="code_block"><span class="nb">may seem unnatural.  In these cases, the user may generate an index</span>
</div><div id="l1504" class="code_block"><span class="nb">on any other argument by means of an indexing directive.  This is a</span>
</div><div id="l1505" class="code_block"><span class="nb">directive of the form:</span>
</div><div id="l1506" class="code_block">
</div><div id="l1507" class="code_block"><span class="nv">\demo</span><span class="nb">{:</span><span class="o">-</span><span class="nb"> index Functor</span><span class="o">/</span><span class="nb">Arity</span><span class="o">-</span><span class="nb">IndexArg.}</span>
</div><div id="l1508" class="code_block">
</div><div id="l1509" class="code_block"><span class="nv">\noindent</span>
</div><div id="l1510" class="code_block"><span class="nb">indicating that an index should be created for predicate </span>
</div><div id="l1511" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> Functor}</span><span class="o">/</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> Arity} on its </span><span class="s">$</span><span class="nb">{</span><span class="k">\tt</span> IndexArg<span class="nb">}^{</span><span class="k">\rm</span> th<span class="nb">}</span><span class="s">$</span><span class="nb"> argument.</span>
</div><div id="l1512" class="code_block"><span class="nb">One may also use the form:</span>
</div><div id="l1513" class="code_block">
</div><div id="l1514" class="code_block"><span class="nv">\demo</span><span class="nb">{:</span><span class="o">-</span><span class="nb"> index</span><span class="o">(</span><span class="nb">Functor</span><span class="o">/</span><span class="nb">Arity, IndexArg, HashTableSize</span><span class="o">)</span><span class="nb">.}</span>
</div><div id="l1515" class="code_block">
</div><div id="l1516" class="code_block"><span class="nv">\index</span><span class="nb">{{</span><span class="nv">\tt</span><span class="nb"> index</span><span class="o">/</span><span class="m">2</span><span class="nb">}}</span>
</div><div id="l1517" class="code_block"><span class="nv">\noindent</span>
</div><div id="l1518" class="code_block"><span class="nb">which allows further specification of the size of the hash table to use for</span>
</div><div id="l1519" class="code_block"><span class="nb">indexing this predicate if it is a {</span><span class="nv">\em</span><span class="nb"> dynamic} </span><span class="o">(</span><span class="nb">i.e., asserted</span><span class="o">)</span><span class="nb"> predicate.</span>
</div><div id="l1520" class="code_block"><span class="nb">For predicates that are dynamically loaded, this directive can be used to</span>
</div><div id="l1521" class="code_block"><span class="nb">specify indexing on more than one argument, or indexing on a combination</span>
</div><div id="l1522" class="code_block"><span class="nb">of arguments </span><span class="o">(</span><span class="nb">see its description on page~</span><span class="nv">\pageref</span><span class="nb">{index_dynamic}</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1523" class="code_block"><span class="nb">For a compiled predicate the size of the hash table is computed automatically,</span>
</div><div id="l1524" class="code_block"><span class="nb">so {</span><span class="nv">\tt</span><span class="nb"> HashTableSize} is ignored.</span>
</div><div id="l1525" class="code_block">
</div><div id="l1526" class="code_block"><span class="nb">All of the values {</span><span class="nv">\tt</span><span class="nb"> Functor}, {</span><span class="nv">\tt</span><span class="nb"> Arity}, {</span><span class="nv">\tt</span><span class="nb"> IndexArg} </span><span class="o">(</span><span class="nb">and possibly</span>
</div><div id="l1527" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> HashTableSize}</span><span class="o">)</span><span class="nb"> should be ground in the directive.  More specifically,</span>
</div><div id="l1528" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> Functor} should be an atom, {</span><span class="nv">\tt</span><span class="nb"> Arity} an integer in the range </span><span class="m">0</span><span class="nb">..</span><span class="m">255</span><span class="nb">,</span>
</div><div id="l1529" class="code_block"><span class="nb">and {</span><span class="nv">\tt</span><span class="nb"> IndexArg} an integer between </span><span class="m">0</span><span class="nb"> and {</span><span class="nv">\tt</span><span class="nb"> Arity}.  If {</span><span class="nv">\tt</span><span class="nb"> IndexArg}</span>
</div><div id="l1530" class="code_block"><span class="nb">is equal to~</span><span class="m">0</span><span class="nb">, then no index is created for that predicate. An {</span><span class="nv">\tt</span><span class="nb"> index}</span>
</div><div id="l1531" class="code_block"><span class="nb">directive may be placed anywhere in the file containing the predicate it</span>
</div><div id="l1532" class="code_block"><span class="nb">refers to.</span>
</div><div id="l1533" class="code_block">
</div><div id="l1534" class="code_block"><span class="nb">As an example, if we wished to create an index on the third argument </span>
</div><div id="l1535" class="code_block"><span class="nb">of predicate {</span><span class="nv">\tt</span><span class="nb"> foo</span><span class="o">/</span><span class="m">5</span><span class="nb">}, the compiler directive would be:</span>
</div><div id="l1536" class="code_block">
</div><div id="l1537" class="code_block"><span class="nv">\demo</span><span class="nb">{:</span><span class="o">-</span><span class="nb"> index foo</span><span class="o">/</span><span class="m">5</span><span class="o">-</span><span class="m">3</span><span class="nb">.}</span>
</div><div id="l1538" class="code_block">
</div><div id="l1539" class="code_block">
</div><div id="l1540" class="code_block"><span class="nv">\subsubsection</span><span class="nb">{Unification Factoring}</span><span class="nv">\label</span><span class="nb">{transformational_indexing}</span>
</div><div id="l1541" class="code_block"><span class="nv">\index</span><span class="nb">{indexing</span><span class="o">!</span><span class="nb">transformational}</span>
</div><div id="l1542" class="code_block"><span class="nb">When the clause heads of a predicate have portions of arguments common</span>
</div><div id="l1543" class="code_block"><span class="nb">to several clauses, indexing on the principal functor of one argument</span>
</div><div id="l1544" class="code_block"><span class="nb">may not be sufficient.  Indexing may be improved in such cases by the</span>
</div><div id="l1545" class="code_block"><span class="nb">use of unification factoring.  Unification Factoring is a program</span>
</div><div id="l1546" class="code_block"><span class="nb">transformation that ``factors out&#39;&#39; common parts of clause heads,</span>
</div><div id="l1547" class="code_block"><span class="nb">allowing differing parts to be used for indexing, as illustrated by</span>
</div><div id="l1548" class="code_block"><span class="nb">the following example:</span>
</div><div id="l1549" class="code_block"><span class="nv">\begin</span><span class="nb">{center}</span>
</div><div id="l1550" class="code_block"><span class="nv">\tt</span>
</div><div id="l1551" class="code_block"><span class="nv">\begin</span><span class="nb">{tabular}{ccc}</span>
</div><div id="l1552" class="code_block"><span class="nv">\begin</span><span class="nb">{tabular}{l}</span>
</div><div id="l1553" class="code_block"><span class="nb">p</span><span class="o">(</span><span class="nb">f</span><span class="o">(</span><span class="nb">a</span><span class="o">)</span><span class="nb">,X</span><span class="o">)</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> q</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb">. </span><span class="nv">\\</span>
</div><div id="l1554" class="code_block"><span class="nb">p</span><span class="o">(</span><span class="nb">f</span><span class="o">(</span><span class="nb">b</span><span class="o">)</span><span class="nb">,X</span><span class="o">)</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> r</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1555" class="code_block"><span class="nv">\end</span><span class="nb">{tabular}</span>
</div><div id="l1556" class="code_block"><span class="nb">&amp; </span><span class="s">$</span><span class="k">\longrightarrow</span><span class="s">$</span><span class="nb"> &amp;</span>
</div><div id="l1557" class="code_block"><span class="nv">\begin</span><span class="nb">{tabular}{l}</span>
</div><div id="l1558" class="code_block"><span class="nb">p</span><span class="o">(</span><span class="nb">f</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb">,Y</span><span class="o">)</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> </span><span class="nv">\_\$</span><span class="nb">p</span><span class="o">(</span><span class="nb">X,Y</span><span class="o">)</span><span class="nb">. </span><span class="nv">\\</span>
</div><div id="l1559" class="code_block"><span class="nv">\_\$</span><span class="nb">p</span><span class="o">(</span><span class="nb">a,X</span><span class="o">)</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> q</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb">. </span><span class="nv">\\</span>
</div><div id="l1560" class="code_block"><span class="nv">\_\$</span><span class="nb">p</span><span class="o">(</span><span class="nb">b,X</span><span class="o">)</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> r</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1561" class="code_block"><span class="nv">\end</span><span class="nb">{tabular}</span>
</div><div id="l1562" class="code_block"><span class="nv">\end</span><span class="nb">{tabular}</span>
</div><div id="l1563" class="code_block"><span class="nv">\end</span><span class="nb">{center}</span>
</div><div id="l1564" class="code_block"><span class="nb">The transformation thus effectively allows </span><span class="s">$</span>p/2<span class="s">$</span><span class="nb"> to be indexed</span>
</div><div id="l1565" class="code_block"><span class="nb">on atoms </span><span class="s">$</span>a/0<span class="s">$</span><span class="nb"> and </span><span class="s">$</span>b/0<span class="s">$</span><span class="nb">.  Unification Factoring is transparent</span>
</div><div id="l1566" class="code_block"><span class="nb">to the user; predicates created by the transformation are internal</span>
</div><div id="l1567" class="code_block"><span class="nb">to the system and do not appear during tracing.</span>
</div><div id="l1568" class="code_block">
</div><div id="l1569" class="code_block"><span class="nb">The following compiler directives control the use of unification</span>
</div><div id="l1570" class="code_block"><span class="nb">factoring:</span><span class="nv">\footnote</span><span class="nb">{Unification factoring was once called</span>
</div><div id="l1571" class="code_block"><span class="nb">transformational indexing, hence the abbreviation {</span><span class="nv">\tt</span><span class="nb"> ti} in the</span>
</div><div id="l1572" class="code_block"><span class="nb">compiler directives}.</span>
</div><div id="l1573" class="code_block"><span class="nv">\begin</span><span class="nb">{description}</span>
</div><div id="l1574" class="code_block"><span class="nv">\item</span><span class="o">[</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> ti</span><span class="o">(</span><span class="nb">F</span><span class="o">/</span><span class="nb">A</span><span class="o">)</span><span class="nb">.}</span><span class="o">]</span><span class="nb"> Specifies that predicate </span><span class="s">$</span>F/A<span class="s">$</span><span class="nb"> should be</span>
</div><div id="l1575" class="code_block"><span class="nb">	compiled with unification factoring enabled.</span>
</div><div id="l1576" class="code_block"><span class="nv">\item</span><span class="o">[</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> ti</span><span class="nv">\_</span><span class="nb">off</span><span class="o">(</span><span class="nb">F</span><span class="o">/</span><span class="nb">A</span><span class="o">)</span><span class="nb">.}</span><span class="o">]</span><span class="nb"> Specifies that predicate </span><span class="s">$</span>F/A<span class="s">$</span><span class="nb"> should be</span>
</div><div id="l1577" class="code_block"><span class="nb">	compiled with unification factoring disabled.</span>
</div><div id="l1578" class="code_block"><span class="nv">\item</span><span class="o">[</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> ti</span><span class="nv">\_</span><span class="nb">all.}</span><span class="o">]</span><span class="nb"> Specifies that all predicates defined in the</span>
</div><div id="l1579" class="code_block"><span class="nb">	file should be compiled with unification factoring enabled.</span>
</div><div id="l1580" class="code_block"><span class="nv">\item</span><span class="o">[</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> ti</span><span class="nv">\_</span><span class="nb">off</span><span class="nv">\_</span><span class="nb">all.}</span><span class="o">]</span><span class="nb"> Specifies that all predicates defined in</span>
</div><div id="l1581" class="code_block"><span class="nb">	the file should be compiled with unification factoring disabled.</span>
</div><div id="l1582" class="code_block"><span class="nv">\end</span><span class="nb">{description}</span>
</div><div id="l1583" class="code_block"><span class="nb">By default, higher</span><span class="o">-</span><span class="nb">order predicates </span><span class="o">(</span><span class="nb">more precisely, predicates named</span>
</div><div id="l1584" class="code_block"><span class="nb">{</span><span class="nv">\it</span><span class="nb"> apply</span><span class="nv">\/</span><span class="nb">} with arity greater than </span><span class="m">1</span><span class="o">)</span><span class="nb"> are compiled with unification</span>
</div><div id="l1585" class="code_block"><span class="nb">factoring enabled.  It can be disabled using the {</span><span class="nv">\tt</span><span class="nb"> ti</span><span class="nv">\_</span><span class="nb">off}</span>
</div><div id="l1586" class="code_block"><span class="nb">directive.  For all other predicates, unification factoring must be</span>
</div><div id="l1587" class="code_block"><span class="nb">enabled explicitly via the {</span><span class="nv">\tt</span><span class="nb"> ti} or {</span><span class="nv">\tt</span><span class="nb"> ti</span><span class="nv">\_</span><span class="nb">all} directive.  If</span>
</div><div id="l1588" class="code_block"><span class="nb">both {</span><span class="nv">\tt</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> ti</span><span class="o">(</span><span class="nb">F</span><span class="o">/</span><span class="nb">A</span><span class="o">)</span><span class="nb">.} </span><span class="o">(</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> ti</span><span class="nv">\_</span><span class="nb">all.}</span><span class="o">)</span><span class="nb"> and {</span><span class="nv">\tt</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> ti</span><span class="nv">\_</span><span class="nb">off</span><span class="o">(</span><span class="nb">F</span><span class="o">/</span><span class="nb">A</span><span class="o">)</span><span class="nb">.}</span>
</div><div id="l1589" class="code_block"><span class="o">(</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> ti</span><span class="nv">\_</span><span class="nb">off</span><span class="nv">\_</span><span class="nb">all.}</span><span class="o">)</span><span class="nb"> are specified, {</span><span class="nv">\tt</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> ti</span><span class="nv">\_</span><span class="nb">off</span><span class="o">(</span><span class="nb">F</span><span class="o">/</span><span class="nb">A</span><span class="o">)</span><span class="nb">.} </span><span class="o">(</span><span class="nb">{</span><span class="nv">\tt</span>
</div><div id="l1590" class="code_block"><span class="nb">:</span><span class="o">-</span><span class="nb"> ti</span><span class="nv">\_</span><span class="nb">off</span><span class="nv">\_</span><span class="nb">all.}</span><span class="o">)</span><span class="nb"> takes precedence.  Note that unification factoring</span>
</div><div id="l1591" class="code_block"><span class="nb">may have no effect when a predicate is well indexed to begin</span>
</div><div id="l1592" class="code_block"><span class="nb">with.  For example, unification factoring has no effect on the</span>
</div><div id="l1593" class="code_block"><span class="nb">following program:</span>
</div><div id="l1594" class="code_block"><span class="nv">\begin</span><span class="nb">{center}</span>
</div><div id="l1595" class="code_block"><span class="nv">\tt</span>
</div><div id="l1596" class="code_block"><span class="nv">\begin</span><span class="nb">{tabular}{l}</span>
</div><div id="l1597" class="code_block"><span class="nb">p</span><span class="o">(</span><span class="nb">a,c,X</span><span class="o">)</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> q</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb">. </span><span class="nv">\\</span>
</div><div id="l1598" class="code_block"><span class="nb">p</span><span class="o">(</span><span class="nb">b,c,X</span><span class="o">)</span><span class="nb"> :</span><span class="o">-</span><span class="nb"> r</span><span class="o">(</span><span class="nb">X</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1599" class="code_block"><span class="nv">\end</span><span class="nb">{tabular}</span>
</div><div id="l1600" class="code_block"><span class="nv">\end</span><span class="nb">{center}</span>
</div><div id="l1601" class="code_block"><span class="nb">even though the two clauses have </span><span class="s">$</span>c/0<span class="s">$</span><span class="nb"> in common.  The user may</span>
</div><div id="l1602" class="code_block"><span class="nb">examine the results of the transformation by using the {</span><span class="nv">\tt</span><span class="nb"> ti</span><span class="nv">\_</span><span class="nb">dump}</span>
</div><div id="l1603" class="code_block"><span class="nb">compiler option </span><span class="o">(</span><span class="nb">see Section~</span><span class="nv">\ref</span><span class="nb">{sec:CompilerOptions}</span><span class="o">)</span><span class="nb">.</span>
</div><div id="l1604" class="code_block">
</div><div id="l1605" class="code_block"><span class="nv">\subsubsection</span><span class="nb">{Other Directives} </span><span class="nv">\label</span><span class="nb">{other</span><span class="o">-</span><span class="nb">directives}</span>
</div><div id="l1606" class="code_block"><span class="c">%==============================================</span>
</div><div id="l1607" class="code_block">
</div><div id="l1608" class="code_block"><span class="nb">XSB has other directives not found in other Prolog systems.</span>
</div><div id="l1609" class="code_block">
</div><div id="l1610" class="code_block"><span class="nv">\begin</span><span class="nb">{description}</span>
</div><div id="l1611" class="code_block"><span class="nv">\desc</span><span class="nb">{:</span><span class="o">-</span><span class="nb"> hilog </span><span class="s">$</span>atom<span class="nb">_</span>1, <span class="k">\ldots</span>, atom<span class="nb">_</span>n<span class="s">$</span><span class="nb">.}</span>
</div><div id="l1612" class="code_block"><span class="nb">	Declares symbols </span><span class="s">$</span>atom<span class="nb">_</span>1<span class="s">$</span><span class="nb"> through </span><span class="s">$</span>atom<span class="nb">_</span>n<span class="s">$</span><span class="nb"> as HiLog symbols.</span>
</div><div id="l1613" class="code_block"><span class="nb">	The {</span><span class="nv">\tt</span><span class="nb"> hilog} declaration should appear {</span><span class="nv">\em</span><span class="nb"> before} any use of</span>
</div><div id="l1614" class="code_block"><span class="nb">	the symbols.  See Chapter~</span><span class="nv">\ref</span><span class="nb">{Syntax} for a purpose of this</span>
</div><div id="l1615" class="code_block"><span class="nb"> 	declaration.</span>
</div><div id="l1616" class="code_block"><span class="nv">\desc</span><span class="nb">{:</span><span class="o">-</span><span class="nb"> ldoption</span><span class="o">(</span><span class="s">$</span>Options<span class="s">$</span><span class="o">)</span><span class="nb">.}</span>
</div><div id="l1617" class="code_block"><span class="nb">        This directive is only recognized in the header file </span><span class="o">(</span><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> .H} file</span><span class="o">)</span><span class="nb"> </span>
</div><div id="l1618" class="code_block"><span class="nb">	of a foreign module. See the chapter {</span><span class="nv">\it</span><span class="nb"> Foreign Language</span>
</div><div id="l1619" class="code_block"><span class="nb">Interface} in Volume </span><span class="m">2</span><span class="nb"> for its explanation.</span>
</div><div id="l1620" class="code_block"><span class="nv">\desc</span><span class="nb">{:</span><span class="o">-</span><span class="nb"> compiler</span><span class="nv">\_</span><span class="nb">options</span><span class="o">(</span><span class="s">$</span>OptionsList<span class="s">$</span><span class="o">)</span><span class="nb">.}</span>
</div><div id="l1621" class="code_block"><span class="nb">	Indicates that the compiler options in the list </span><span class="s">$</span>OptionsList<span class="s">$</span>
</div><div id="l1622" class="code_block"><span class="nb">	should be used to compile this file.  This must appear at the</span>
</div><div id="l1623" class="code_block"><span class="nb">	beginning of the file.  These options will override any others,</span>
</div><div id="l1624" class="code_block"><span class="nb">	including those given in the compilation command.  The options</span>
</div><div id="l1625" class="code_block"><span class="nb">	may be optionally prefixed with </span><span class="nv">\verb</span><span class="nb">|</span><span class="o">+</span><span class="nb">| or </span><span class="nv">\verb</span><span class="nb">|</span><span class="o">-</span><span class="nb">| to</span>
</div><div id="l1626" class="code_block"><span class="nb">	indicate that they should be set on or off.  </span><span class="o">(</span><span class="nb">No prefix</span>
</div><div id="l1627" class="code_block"><span class="nb">	indicates the option should be set on.</span><span class="o">)</span>
</div><div id="l1628" class="code_block">
</div><div id="l1629" class="code_block"><span class="nv">\end</span><span class="nb">{description}</span>
</div><div id="l1630" class="code_block">
</div><div id="l1631" class="code_block"><span class="nv">\subsection</span><span class="nb">{Inline Predicates}</span><span class="nv">\label</span><span class="nb">{inline_predicates}</span>
</div><div id="l1632" class="code_block"><span class="nv">\index</span><span class="nb">{Compiler</span><span class="o">!</span><span class="nb">inlines}</span><span class="nv">\index</span><span class="nb">{inlines</span><span class="o">!</span><span class="nb">Compiler}</span>
</div><div id="l1633" class="code_block"><span class="c">%======================================================</span>
</div><div id="l1634" class="code_block">
</div><div id="l1635" class="code_block"><span class="nb">{</span><span class="nv">\em</span><span class="nb"> Inline predicates} represent ``primitive&#39;&#39; operations in the</span>
</div><div id="l1636" class="code_block"><span class="nb">WAM.  Calls to inline predicates are compiled into a sequence of WAM</span>
</div><div id="l1637" class="code_block"><span class="nb">instructions in</span><span class="o">-</span><span class="nb">line, i.e. without actually making a call to the</span>
</div><div id="l1638" class="code_block"><span class="nb">predicate.  Thus, for example, relational predicates </span><span class="o">(</span><span class="nb">like {</span><span class="nv">\tt</span><span class="nb"> &gt;</span><span class="o">/</span><span class="m">2</span><span class="nb">},</span>
</div><div id="l1639" class="code_block"><span class="nb">{</span><span class="nv">\tt</span><span class="nb"> &gt;</span><span class="o">=/</span><span class="m">2</span><span class="nb">}, etc.</span><span class="o">)</span><span class="nb"> compile to, essentially, a subtraction followed by</span>
</div><div id="l1640" class="code_block"><span class="nb">a conditional branch.  Inline predicates are expanded specially by</span>
</div><div id="l1641" class="code_block"><span class="nb">the compiler and thus {</span><span class="nv">\em</span><span class="nb"> cannot be redefined by the user without</span>
</div><div id="l1642" class="code_block"><span class="nb">changing the compiler}.  The user does not need to import these</span>
</div><div id="l1643" class="code_block"><span class="nb">predicates from anywhere.  There are available no matter what options</span>
</div><div id="l1644" class="code_block"><span class="nb">are specified during compiling.</span>
</div><div id="l1645" class="code_block">
</div><div id="l1646" class="code_block"><span class="nb">Table~</span><span class="nv">\ref</span><span class="nb">{inlinepredicatetable} lists the inline predicates of</span>
</div><div id="l1647" class="code_block"><span class="nb">XSB </span><span class="nv">\version</span><span class="nb">.  Those predicates that start with </span><span class="nv">\verb</span><span class="nb">|_</span><span class="s">$</span>|
</div><div id="l1648" class="code_block">are internal predicates that are also expanded in-line during
</div><div id="l1649" class="code_block">compilation.
</div><div id="l1650" class="code_block">
</div><div id="l1651" class="code_block"><span class="k">\begin</span><span class="nb">{</span>table<span class="nb">}</span>[htbp]<span class="k">\centering</span><span class="nb">{</span><span class="k">\tt</span>
</div><div id="l1652" class="code_block"><span class="k">\begin</span><span class="nb">{</span>tabular<span class="nb">}{</span>lllll<span class="nb">}</span>
</div><div id="l1653" class="code_block"><span class="k">\verb</span>|&#39;=&#39;/2|    <span class="nb">&amp;</span><span class="k">\verb</span>|&#39;&lt;&#39;/2|	<span class="nb">&amp;</span><span class="k">\verb</span>|&#39;=&lt;&#39;/2|  <span class="nb">&amp;</span><span class="k">\verb</span>|&#39;&gt;=&#39;/2| <span class="nb">&amp;</span><span class="k">\verb</span>|&#39;&gt;&#39;/2| <span class="k">\\</span>
</div><div id="l1654" class="code_block"><span class="k">\verb</span>|&#39;=:=&#39;/2|  <span class="nb">&amp;</span><span class="k">\verb</span>|&#39;=<span class="k">\=</span>&#39;/2|	<span class="nb">&amp;</span>is/2           <span class="nb">&amp;</span><span class="k">\verb</span>|&#39;@&lt;&#39;/2| <span class="nb">&amp;</span><span class="k">\verb</span>|&#39;@=&lt;&#39;/2|<span class="k">\\</span>
</div><div id="l1655" class="code_block"><span class="k">\verb</span>|&#39;@&gt;&#39;/2|	<span class="nb">&amp;</span><span class="k">\verb</span>|&#39;@&gt;=&#39;/2|	<span class="nb">&amp;</span><span class="k">\verb</span>|&#39;==&#39;/2|	<span class="nb">&amp;</span><span class="k">\verb</span>|&#39;<span class="k">\=</span>=&#39;/2|<span class="nb">&amp;</span>fail/0  <span class="k">\\</span>
</div><div id="l1656" class="code_block">true/0		<span class="nb">&amp;</span>var/1		<span class="nb">&amp;</span>nonvar/1	<span class="nb">&amp;</span>halt/0	       <span class="nb">&amp;</span>&#39;!&#39;/0   <span class="k">\\</span>
</div><div id="l1657" class="code_block">&#39;<span class="k">\_\$</span>cutto&#39;/1	<span class="nb">&amp;</span>&#39;<span class="k">\_\$</span>savecp&#39;/1	<span class="nb">&amp;</span>&#39;<span class="k">\_\$</span>builtin&#39;/1
</div><div id="l1658" class="code_block"><span class="k">\end</span><span class="nb">{</span>tabular<span class="nb">}}</span>
</div><div id="l1659" class="code_block"><span class="k">\caption</span><span class="nb">{</span>The Inline Predicates of XSB<span class="nb">}</span><span class="k">\label</span><span class="nb">{</span>inlinepredicatetable<span class="nb">}</span>
</div><div id="l1660" class="code_block"><span class="k">\end</span><span class="nb">{</span>table<span class="nb">}</span>
</div><div id="l1661" class="code_block">
</div><div id="l1662" class="code_block">We warn the user to be very cautious when defining predicates whose functor
</div><div id="l1663" class="code_block">starts with <span class="nb">{</span><span class="k">\tt</span> <span class="k">\_\$</span><span class="nb">}</span>  since the names of these predicates may interfere with
</div><div id="l1664" class="code_block">some of XSB&#39;s internal predicates.  The situation may be particularly
</div><div id="l1665" class="code_block">severe for predicates like <span class="nb">{</span><span class="k">\tt</span> &#39;<span class="k">\_\$</span>builtin&#39;/1<span class="nb">}</span> that are treated specially
</div><div id="l1666" class="code_block">by the XSB compiler.
</div><div id="l1667" class="code_block">
</div><div id="l1668" class="code_block">
</div><div id="l1669" class="code_block">
</div><div id="l1670" class="code_block">
</div><div id="l1671" class="code_block">
</div><div id="l1672" class="code_block"><span class="c">%%% Local Variables: </span>
</div><div id="l1673" class="code_block"><span class="c">%%% mode: latex</span>
</div><div id="l1674" class="code_block"><span class="c">%%% TeX-master: &quot;manual1&quot;</span>
</div><div id="l1675" class="code_block"><span class="c">%%% End: </span>
</div></pre></div></td></tr></table></div>

      
    </div>
  

                    </div>
                    
                    
                </div>
            



        </div>
    </section>
      

    <footer class="sandiego">
    <div class="as-row">
        <div class="footer-wrapper">
            <nav aria-label="Site Links" role="navigation">
                <section>
                    <div class="as-h2">SourceForge</div>
                    <ul>
                    
                        <li><a href="/create/" title="Create a Project">Create a Project</a></li>
                    
                        <li><a href="/directory/" title="Open Source Software Directory">Open Source Software</a></li>
                        <li><a href="/software/" title="Business Software Directory">Business Software</a></li>
                        
                            
                            <li><a href="/top" title="Top Open Source Projects">Top Downloaded Projects</a></li>
                        

                    </ul>
                </section>
            </nav>
            <nav aria-label="Company Links" role="navigation">
                <section>
                    <div class="as-h2">Company</div>
                    <ul>
                        <li><a href="/about">About</a></li>
                        <li><a href="/about/leadership" title="Open Source Software Directory">Team</a></li>
                        <li class="h-card">
                            <address>
                                <span class="p-name p-org">SourceForge Headquarters</span><br>
                                <span class="p-street-address">225 Broadway Suite 1600</span><br>
                                <span class="p-locality">San Diego, CA <span class="p-postal-code">92101</span></span><br>
                                <span class="p-tel">+1 (858) 422-6466</span><br>
                            </address>
                        </li>
                        <li id="social">
                            
<span></span>
<a href="https://twitter.com/sourceforge" class="twitter" rel="nofollow" target="_blank" title="SourceForge on X">


<svg  class="vertical-icon-fix" data-name="twitter" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1684 408q-67 98-162 167 1 14 1 42 0 130-38 259.5t-115.5 248.5-184.5 210.5-258 146-323 54.5q-271 0-496-145 35 4 78 4 225 0 401-138-105-2-188-64.5t-114-159.5q33 5 61 5 43 0 85-11-112-23-185.5-111.5t-73.5-205.5v-4q68 38 146 41-66-44-105-115t-39-154q0-88 44-163 121 149 294.5 238.5t371.5 99.5q-8-38-8-74 0-134 94.5-228.5t228.5-94.5q140 0 236 102 109-21 205-78-37 115-142 178 93-10 186-50z"/></svg></a>
<a href="https://fosstodon.org/@sourceforge" rel="me nofollow" target="_blank" title="SourceForge on Mastodon">


<svg  class="vertical-icon-fix" data-name="mastodon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M433 179.11c0-97.2-63.71-125.7-63.71-125.7-62.52-28.7-228.56-28.4-290.48 0 0 0-63.72 28.5-63.72 125.7 0 115.7-6.6 259.4 105.63 289.1 40.51 10.7 75.32 13 103.33 11.4 50.81-2.8 79.32-18.1 79.32-18.1l-1.7-36.9s-36.31 11.4-77.12 10.1c-40.41-1.4-83-4.4-89.63-54a102.54 102.54 0 0 1-.9-13.9c85.63 20.9 158.65 9.1 178.75 6.7 56.12-6.7 105-41.3 111.23-72.9 9.8-49.8 9-121.5 9-121.5zm-75.12 125.2h-46.63v-114.2c0-49.7-64-51.6-64 6.9v62.5h-46.33V197c0-58.5-64-56.6-64-6.9v114.2H90.19c0-122.1-5.2-147.9 18.41-175 25.9-28.9 79.82-30.8 103.83 6.1l11.6 19.5 11.6-19.5c24.11-37.1 78.12-34.8 103.83-6.1 23.71 27.3 18.4 53 18.4 175z"/></svg></a>
<a href="https://www.facebook.com/sourceforgenet/" class="facebook" rel="nofollow" target="_blank" title="SourceForge on Facebook">


<svg  data-name="facebook" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1343 12v264h-157q-86 0-116 36t-30 108v189h293l-39 296h-254v759h-306v-759h-255v-296h255v-218q0-186 104-288.5t277-102.5q147 0 228 12z"/></svg></a>
<a href="https://www.linkedin.com/company/sourceforge.net" class="linkedin" rel="nofollow" target="_blank" title="SourceForge on LinkedIn">


<svg  data-name="linkedin" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M477 625v991h-330v-991h330zm21-306q1 73-50.5 122t-135.5 49h-2q-82 0-132-49t-50-122q0-74 51.5-122.5t134.5-48.5 133 48.5 51 122.5zm1166 729v568h-329v-530q0-105-40.5-164.5t-126.5-59.5q-63 0-105.5 34.5t-63.5 85.5q-11 30-11 81v553h-329q2-399 2-647t-1-296l-1-48h329v144h-2q20-32 41-56t56.5-52 87-43.5 114.5-15.5q171 0 275 113.5t104 332.5z"/></svg></a>

<a href="/user/newsletters" rel=nofollow class="newsletter" title="Subscribe to our newsletter">


<svg  class="vertical-icon-fix" data-name="mmSF_11mail" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 42 42" enable-background="new 0 0 42 42" xml:space="preserve"><path fill="#FFFFFF" d="M0,6v30h42V6H0z M24.2,21.2c-0.8,0.8-2.3,2-3.2,2c-0.9,0-2.4-1.2-3.2-2L5.8,9.7h30.3L24.2,21.2z M13.7,21l-9.9,9.4V11.6L13.7,21z M15.7,23L15.7,23c0.5,0.5,2.9,2.9,5.3,2.9c2.4,0,4.8-2.4,5.2-2.8l0.1-0.1l9.8,9.4H5.8L15.7,23z M28.3,21l9.9-9.5v18.9L28.3,21z"/></svg></a>

<span></span>
                        </li>
                    </ul>
                </section>
            </nav>
             <nav aria-label="Resources Links" role="navigation">
                <section>
                    <div class="as-h2">Resources</div>
                    <ul>
                        
                            <li><a href="/support" title="Support Section">Support</a></li>
                            <li><a href="/p/forge/documentation/Docs%20Home/" title="Site Documentation">Site Documentation</a></li>
                        
                        <li><a href="https://fosstodon.org/@sourceforgestatus" title="Site Status" rel="me nofollow">Site Status</a></li>
                        <li><a href="/reviews" title="Reviews" rel="me nofollow">SourceForge Reviews</a></li>

                    </ul>
                </section>
            </nav>
            <section class="footer-logo">
                <a href="/" title="Home" class="sf-logo">
                    
    
    <img src="https://a.fsdn.com/con/images/sandiego/sf-logo-full.svg"  alt="SourceForge logo" class="sf-logo-full"/>
                </a>
            </section>
        </div>
    </div>
    <section class="l-nav-bottom">
        <nav class="row">
            
                
            
        
    <div class="columns small-12 large-6 copyright-notice">
        &copy; 2025 Slashdot Media. All Rights Reserved.
    </div>
    <div class="columns large-6 links links-right">
        

    
    

    <a href="https://slashdotmedia.com/terms-of-use" target="_blank" title="Terms" rel="nofollow">Terms</a>
    <a href="https://slashdotmedia.com/privacy-statement/" target="_blank" title="Privacy" rel="nofollow">Privacy</a>

    
    
    

    
        <a href="https://slashdotmedia.com/opt-out-choices/" target="_blank" title="Opt Out" rel="nofollow">Opt Out</a>
    

    
        <a href="https://slashdotmedia.com/contact/" target="_blank" title="Advertise" rel="nofollow">Advertise</a>
    
    </div>
        </nav>
    </section>

    </footer>
    





    
    
    <div id="newsletter-floating" class="sandiego newsletter-floating-new">
        <a class="close-button btn-closer" data-close aria-label="Close modal">
            <span aria-hidden="true">&times;</span>
        </a>
        <div class="as-h2">Want the latest updates on software, tech news, and AI?</div>
        <div class="row">
            <div class="column small-2 medium-2 large-2" style="padding-left: 0px; padding-right: 0px;"><img src="/images/sandiego/sf_email_icon.svg"  alt="" /></div>
            <div class="as-h3 column small-10 medium-10 large-10">Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.</div>
        </div>
        <form action="/user/newsletters/" method="post">
            <div class="row">
              <input class="newsletter-input" type="email" placeholder="Enter your email address" autocomplete="off" name="newsletter_email"
                     value="">
              <input type="hidden" name="source" value="floating">
              <button type="submit" class="button blue newsletter-button">Submit</button>
            </div>
        </form>
    </div>
    






</div>


<div id="messages">
    
</div>


    <!-- ew:body_js -->


    <script type="text/javascript" src="https://a.fsdn.com/allura/nf/1752697225/_ew_/_slim/js?href=allura%2Fjs%2Fjquery.notify.js%3Ballura%2Fjs%2Fjquery.tooltipster.js%3Ballura%2Fjs%2Fallura-base.js%3Ballura%2Fjs%2Fchecklist.js%3Ballura%2Fjs%2Fadmin_modal.js%3Bjs%2Fjquery.lightbox_me.js%3Ballura%2Fjs%2Fmemorable.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fshared.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fsticky.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fsandiego%2Fchrome.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fsandiego%2Futilities.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.core.min.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.util.mediaQuery.min.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.util.keyboard.min.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.util.box.min.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.util.nest.min.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.dropdownMenu.min.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.offcanvas.min.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.toggler.min.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fsandiego%2Fproject.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Fjquery.typeahead.min.js%3Ballura%2Fjs%2Fmaximize-content.js"></script>

    
<!-- /ew:body_js -->



    <!-- ew:body_js_tail -->


    <script type="text/javascript" src="https://a.fsdn.com/allura/nf/1752697225/_ew_/_slim/js?href=theme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.util.triggers.min.js%3Btheme%2Fsftheme%2Fjs%2Fsftheme%2Fvendor%2Ffoundation6%2Fplugins%2Ffoundation.reveal.min.js"></script>

    
<!-- /ew:body_js_tail -->




<script type="text/javascript">(function() {
  $('#access_urls .btn').click(function(evt){
    evt.preventDefault();
    var parent = $(this).parents('.btn-bar');
    var checkout_cmd = $(this).attr('data-url');
    $(parent).find('input').val(checkout_cmd);
    $(parent).find('span').text($(this).attr('title')+' access');
    $(this).parent().children('.btn').removeClass('active');
    $(this).addClass('active');
    if (checkout_cmd.indexOf(' http://') !== -1 || checkout_cmd.indexOf(' https://') !== -1 ) {
      $('#http-2fa-msg').show();
    } else {
      $('#http-2fa-msg').hide();
    }
  });
  $('#access_urls .btn').first().click();

  
  var repo_status = document.getElementById('repo_status');
  // The repo_status div will only be present if repo.status != 'ready'
  if (repo_status) {
    $('.spinner').show()
    var delay = 500;
    function check_status() {
        $.get('/p/xsb/src/status', function(data) {
            if (data.status === 'ready') {
                $('.spinner').hide()
                $('#repo_status h2').html('Repo status: ready. <a href="." rel="nofollow">Click here to refresh this page.</a>');
            }
            else {
                $('#repo_status h2 span').html(data.status);
                if (delay < 60000){
                    delay = delay * 2;
                }
                window.setTimeout(check_status, delay);
            }
        });
    }
    var status_checker = window.setTimeout(check_status, delay);
    
  }
}());
</script>

<script type="text/javascript">(function() {
  $(window).on('hashchange', function(e) {
    var hash = window.location.hash.substring(1);
    if ('originalEvent' in e && 'oldURL' in e.originalEvent) {
      $('#' + e.originalEvent.oldURL.split('#')[1]).css('background-color', 'transparent');
    }
    if (hash !== '' && hash.substring(0, 1) === 'l' && !isNaN(hash.substring(1))) {
      $('#' + hash).css('background-color', '#ffff99');
    }
  }).trigger('hashchange');

  var clicks = 0;
  $('.code_block').each(function(index, element) {
    $(element).on('click', function() {
      // Trick to ignore double and triple clicks
      clicks++;
      if (clicks === 1) {
        setTimeout(function() {
          if (clicks === 1) {
            var hash = window.location.hash.substring(1);
            if (hash !== '' && hash.substring(0, 1) === 'l' && !isNaN(hash.substring(1))) {
              $('#' + hash).css('background-color', 'transparent');
            }
            $(element).css('background-color', '#ffff99');
            window.history.pushState({}, document.title, window.location.pathname + window.location.search + '#' + $(element).attr('id'));
          }
          clicks = 0;
        }, 500);
      }
    });
  });
}());
</script>


    


    
    
    <noscript><p><img src="https://analytics.slashdotmedia.com/index.php?idsite=39" style="border:0;position:absolute;top:0;" alt="" /></p></noscript>
    
    <script>
        $(document).foundation();
    </script>
    








    

<script>
    (function () {
        function load_bombora() {
            /*global _ml:true, window */
            _ml = window._ml || {};
            
            _ml.eid = '771';
            _ml.fp = '8a9d54e8-fd85-47ad-b637-84da1a7a1cf5';  
            var s = document.getElementsByTagName('script')[0], cd = new Date(), mltag = document.createElement('script');
            mltag.type = 'text/javascript';
            mltag.async = true;
            mltag.defer = true;
            mltag.src = '//ml314.com/tag.aspx?' + cd.getDate() + cd.getMonth() + cd.getFullYear();
            s.parentNode.insertBefore(mltag, s);
        }
        bizx.cmp.ifConsent({ purposes: 'all', vendors: 'bombora'}, load_bombora);
    })();
</script>




<script>
    $(document).ready(function () {
        $(".tooltip, .m-tooltip").each(function(){
            let $el = $(this);
            $el.tooltipster({
                animation: 'fade',
                delay: 200,
                theme: 'tooltipster-light',
                trigger: 'hover',
                position: $el.data('position') || 'right',
                iconCloning: false,
                maxWidth: 300,
                contentAsHTML: true,
                interactive: true
            }).focus(function () {
                $(this).tooltipster('show');
            }).blur(function () {
                $(this).tooltipster('hide');
            });
        });
    });
</script>

    



<script type="text/javascript">
    bizx.cmp.ifConsent({ purposes: ['storage', 'measurement'], vendors: 'google-analytics'}, function () {
        /* jshint ignore:start */
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
                (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
        /* jshint ignore:end */

        window.dataLayer = window.dataLayer || [];
        function gtag(){ window.dataLayer.push(arguments); }
        window.gtag = window.gtag || gtag;
        bizx.cmp.embedScript("https://www.googletagmanager.com/gtag/js");
        gtag('js', new Date());
        gtag('set', {
            'page_location': 'https://sourceforge.net/p/xsb/src/2712/tree/trunk/XSB/docs/userman/system.tex',
        });
    });
</script>










<script>
        function gam(id){
            bizx.cmp.ifConsent({ purposes: 'all' }, function () {
                bizx.cmp.embedScript(`https://pagead2.googlesyndication.com/pagead/js/pcd.js?${id}`,
                    true,  // async
                    'head', // location
                    null, // callback
                    false, // defer
                    {id: `google-pcd-tag-${id}`, 'data-audience-pixel': 'dc_iu=/41014381/DFPAudiencePixel;dc_seg=' + id});
            });
        }

        
            gam("8901705213");gam("8901712041");</script>

<script type="text/javascript">
    /*global ga, gtag */

    
        
        bizx.cmp.ifConsent({ purposes: ['storage', 'measurement'], vendors: 'google-analytics'}, function () {
            gtag('config', 'G-1H226E4E4L', {
                
                send_page_view: false,
                'SF_Page_Type': '', 
                user_properties: {
                    'SF_Logged_in': 'Logged Out', 
                },
                'devicePixelRatio': SF.devicePixelRatio, 
            });
            gtag('event', 'page_view', { send_to: 'G-1H226E4E4L' });
        });
    
    
    
        
</script>

</body>
</html>