@ciao-lang/ts-ciao-interface
Version:
Simple Ciao interface for node.
50 lines (39 loc) • 8.89 kB
HTML
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="theme-color" content="#273f79"/><link rel="stylesheet" href="lpdoc.css" type="text/css"/><script type="text/javascript" src="lpdoc.js"></script><title>Shell-style pathname pattern expansion — The Ciao System v1.22</title></head><body><div class="lpdoc-page fixleftbar"><a href="#" id="sidebar-toggle-button" class="lpdoc-navbutton"><span id="sidebar-button-arrow">☰</span></a><div id="sidebar" class="lpdoc-sidebar"><div style="height: 40px; margin-left: auto; margin-right: auto"><img src="ciao-logo_autofig.png" width=auto height=100%></div><div class="lpdoc-nav"><span class="lpdoc-on-right"><a class="lpdoc-navbutton" href="ExtraLibs.html">↑</a><a class="lpdoc-navbutton" href="color_space.html">←</a><a class="lpdoc-navbutton" href="regexp_doc.html">→</a><a class="lpdoc-navbutton" href="ciaosearch.html">🔍</a></span><span><a href="ciaofulltoc.html">TOC</a></span></div><hr></hr><ul class="lpdoc-itemize-sectpath"><li><a href="ciao.html">The Ciao System</a> »<br/> </li><li><a href="ExtraLibs.html">PART VIII - Additional libraries</a> »<br/> </li><li><a href=""><strong>Shell-style pathname pattern expansion</strong></a></li></ul><hr></hr><em>ON THIS PAGE</em><ul><li><a href="#Usage and interface">Usage and interface</a></li><li><a href="#Documentation on exports">Documentation on exports</a></li><li><a href="#Documentation on imports">Documentation on imports</a></li></ul></div><div class="lpdoc-main"><div id=""><h1>Shell-style pathname pattern expansion</h1><a class="lpdoc-idx-anchor" href="ciaosearch.html#glob"></a>
<strong>Author(s):</strong> <a class="lpdoc-idx-anchor" id="Manuel Hermenegildo" href="ciaosearch.html#Manuel Hermenegildo">Manuel Hermenegildo (original <tt>file_find.pl</tt>)</a>, <a class="lpdoc-idx-anchor" id="Jose F. Morales" href="ciaosearch.html#Jose F. Morales">Jose F. Morales</a>.<p>
This module provides file searching predicates to locate <a class="lpdoc-idx-anchor" id="0" href="ciaosearch.html#pathnames">pathnames</a> matching a <a href="http://en.wikipedia.org/wiki/Glob_(programming)"><em>globbing</em></a> pattern (shell wildcard expansion). <br/><div id="Usage and interface"><h2>Usage and interface</h2><div class="lpdoc-cartouche"><ul><li><strong>Library usage:</strong><br/><tt>:- use_module(library(glob)).</tt><li><strong>Exports:</strong><br/><ul class="lpdoc-itemize-minus"><li><em>Predicates:</em><br/><a class="lpdoc-idx-anchor" id="1" href="#glob/3"><tt>glob/3</tt></a>, <a class="lpdoc-idx-anchor" id="2" href="#glob/2"><tt>glob/2</tt></a>.
<li><em>Regular Types:</em><br/><a class="lpdoc-idx-anchor" id="3" href="#glob_pattern/1"><tt>glob_pattern/1</tt></a>.
</ul></ul></div></div><div id="Documentation on exports"><h2>Documentation on exports</h2><div><div class="lpdoc-defname"><span class="lpdoc-predtag">REGTYPE</span><a class="lpdoc-idx-anchor" id="glob_pattern/1" href="ciaosearch.html#glob_pattern/1">glob_pattern/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>glob_pattern(Pattern)</tt>
</span><p><span class="lpdoc-var">Pattern</span> is a pathname pattern whose components may contain shell-style wildcards.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="glob/3" href="ciaosearch.html#glob/3">glob/3</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>glob(Directory,Pattern,FileList)</tt>
</span><p>Search the list of pathnames <span class="lpdoc-var">FileList</span> matching the specified pathname pattern <span class="lpdoc-var">Pattern</span>. If <span class="lpdoc-var">Pattern</span> is an absolute path, <span class="lpdoc-var">Directory</span> is ignored. Otherwise, all matches are relative to <span class="lpdoc-var">Directory</span>. If <span class="lpdoc-var">Directory</span> does not exist <span class="lpdoc-var">FileList</span> is empty. The shortest version <a class="lpdoc-idx-anchor" id="4" href="#glob/2"><tt>glob/2</tt></a> can be used when <span class="lpdoc-var">Directory</span> is <tt>'.'</tt> (the current directory).<p>For example, <a class="lpdoc-idx-anchor" id="5" href="#glob/2"><tt>glob/2</tt></a> and <a class="lpdoc-idx-anchor" id="6" href="#glob/3"><tt>glob/3</tt></a> will give the following results in a typical Unix installation:<p><pre class="lpdoc-codeblock">?- use_module(library(glob)).
yes
?- cd('/bin').
yes
?- glob('e*', F).
F = [expr,ed,echo] ?
yes
?- glob('/', 'bin/e*', F).
F = ['bin/expr','bin/ed','bin/echo'] ?
yes
?- glob('/tmp', '../bin/e*', F).
F = ['../bin/expr','../bin/ed','../bin/echo'] ?
yes
?- cd('/tmp').
yes
?- glob('/bin/e*', F).
F = ['/bin/expr','/bin/ed','/bin/echo'] ?
yes
</pre> <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>glob(Directory,Pattern,FileList)</tt>
</span><p><span class="lpdoc-var">FileList</span> is the list of pathnames matching the specified pathname pattern <span class="lpdoc-var">Pattern</span>, relative to <span class="lpdoc-var">Directory</span>.</p><ul class="lpdoc-itemize-minus"><li><em>Call and exit should be compatible with:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="7" href="pathnames.html#pathname/1"><tt>pathnames:pathname/1</tt></a>)</span><span><span class="lpdoc-var">Directory</span> is a pathname (encoded as an atom)
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="8" href="pathnames.html#pathname/1"><tt>pathnames:pathname/1</tt></a>)</span><span><span class="lpdoc-var">Pattern</span> is a pathname (encoded as an atom)
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="9" href="basic_props.html#list/2"><tt>basic_props:list/2</tt></a>)</span><span><span class="lpdoc-var">FileList</span> is a list of <span class="lpdoc-var">pathname</span>s.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="glob/2" href="ciaosearch.html#glob/2">glob/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>glob(Pattern,FileList)</tt>
</span><p>Like <a class="lpdoc-idx-anchor" id="10" href="#glob/3"><tt>glob/3</tt></a>, relative to the current directory (equivalent to <tt>glob('.', Pattern, FileList)</tt>)</p><ul class="lpdoc-itemize-minus"><li><em>Call and exit should be compatible with:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="11" href="pathnames.html#pathname/1"><tt>pathnames:pathname/1</tt></a>)</span><span><span class="lpdoc-var">Pattern</span> is a pathname (encoded as an atom)
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="12" href="basic_props.html#list/2"><tt>basic_props:list/2</tt></a>)</span><span><span class="lpdoc-var">FileList</span> is a list of <span class="lpdoc-var">pathname</span>s.
</span>
</ul></div></div><p>
</div><div id="Documentation on imports"><h2>Documentation on imports</h2>This module has the following direct dependencies:<ul class="lpdoc-itemize-minus"><li><em>System library modules:</em><br/><a class="lpdoc-idx-anchor" id="13" href="regexp_code.html"><tt>regexp_code</tt></a>, <a class="lpdoc-idx-anchor" id="14" href="system.html"><tt>system</tt></a>, <a class="lpdoc-idx-anchor" id="15" href="pathnames.html"><tt>pathnames</tt></a>, <a class="lpdoc-idx-anchor" id="16" href="lists.html"><tt>lists</tt></a>, <a class="lpdoc-idx-anchor" id="17" href="aggregates.html"><tt>aggregates</tt></a>.
<li><em>Packages:</em><br/><a class="lpdoc-idx-anchor" id="18" href="ciaosearch.html#prelude"><tt>prelude</tt></a>, <a class="lpdoc-idx-anchor" id="19" href="ciaosearch.html#initial"><tt>initial</tt></a>, <a class="lpdoc-idx-anchor" id="20" href="condcomp_doc.html"><tt>condcomp</tt></a>, <a class="lpdoc-idx-anchor" id="21" href="assertions_doc.html"><tt>assertions</tt></a>, <a class="lpdoc-idx-anchor" id="22" href="ciaosearch.html#assertions/assertions_basic"><tt>assertions/assertions_basic</tt></a>, <a class="lpdoc-idx-anchor" id="23" href="regtypes_doc.html"><tt>regtypes</tt></a>, <a class="lpdoc-idx-anchor" id="24" href="isomodes_doc.html"><tt>isomodes</tt></a>, <a class="lpdoc-idx-anchor" id="25" href="ciaosearch.html#hiord"><tt>hiord</tt></a>.
</ul></div></div><div class="lpdoc-footer">Generated with LPdoc using Ciao</div></div><div class="lpdoc-clearer"></div></div></body></html>