Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > e3d62627d1d1aab7ab1be2dd7f65a872 > files > 250

ecl-10.4.1-1.fc14.x86_64.rpm

<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Chapter&#160;11.&#160;Pathnames</title><link rel="stylesheet" href="ecl.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="The ECL manual"><link rel="up" href="pt01.html" title="Part&#160;I.&#160;Standards"><link rel="prev" href="ch10.html" title="Chapter&#160;10.&#160;Hash tables"><link rel="next" href="ch11s02.html" title="11.2.&#160;Wild pathnames and matching"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&#160;11.&#160;Pathnames</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch10.html">Prev</a>&#160;</td><th width="60%" align="center">Part&#160;I.&#160;Standards</th><td width="20%" align="right">&#160;<a accesskey="n" href="ch11s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter&#160;11.&#160;Pathnames"><div class="titlepage"><div><div><h2 class="title"><a name="sec.ansi.pathnames"></a>Chapter&#160;11.&#160;Pathnames</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="ch11.html#sec.ansi.pathnames.syntax">11.1. Syntax</a></span></dt><dt><span class="section"><a href="ch11s02.html">11.2. Wild pathnames and matching</a></span></dt></dl></div><div class="section" title="11.1.&#160;Syntax"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec.ansi.pathnames.syntax"></a>11.1.&#160;Syntax</h2></div></div></div><p>A pathname in the file system of Common-Lisp consists of six
  elements: host, device, directory, name, type and version. Pathnames are
  read and printed using the <code class="literal">#P</code> reader macro followed by
  the namestring. A namestring is a string which represents a pathname. The
  syntax of namestrings for logical pathnames is well explained in the <a class="xref" href="bi01.html#bib.ANSI">ANSI</a>
  and it can be roughly summarized as follows:

  </p><pre class="synopsis"><code class="literal">[<span class="optional"><em class="replaceable"><code>hostname</code></em>:</span>][<span class="optional">;</span>][<span class="optional"><em class="replaceable"><code>directory-item</code></em>;</span>]<sup>0 or more</sup>[<span class="optional"><em class="replaceable"><code>name</code></em></span>][<span class="optional">.<em class="replaceable"><code>type</code></em>[<span class="optional">.<em class="replaceable"><code>version</code></em></span>]</span>]</code>
  <em class="replaceable"><code>hostname</code></em> = <em class="replaceable"><code>word</code></em>
  <em class="replaceable"><code>directory-item</code></em> = <em class="replaceable"><code>wildcard-word</code></em>
  <em class="replaceable"><code>type</code></em>, <em class="replaceable"><code>name</code></em> = <em class="replaceable"><code>wildcard-word</code></em> without dots</pre><p>

  Here, <em class="replaceable"><code>wildcard-word</code></em> is a sequence of any
  character excluding <code class="literal">#\Null</code> and
  dots. <em class="replaceable"><code>word</code></em> is like a
  <em class="replaceable"><code>wildcard-word</code></em> but asterisks are excluded.</p><p>The way <span class="application">ECL</span> parses a namestring is by first looking for the
  <em class="replaceable"><code>hostname</code></em> component in the previous template. If
  it is found and it corresponds to a previously defined logical hostname, it
  assumes that the namestring corresponds to a logical pathname. If
  <em class="replaceable"><code>hostname</code></em> is not found or it is not a logical
  hostname, then <span class="application">ECL</span> tries the physical pathname syntax

  </p><pre class="synopsis"><code class="literal">[<span class="optional"><em class="replaceable"><code>device</code></em>:</span>][<span class="optional">[<span class="optional">//<em class="replaceable"><code>hostname</code></em></span>]/</span>][<span class="optional"><em class="replaceable"><code>directory-item</code></em>/</span>]<sup>0 or more</sup>[<span class="optional"><em class="replaceable"><code>name</code></em></span>][<span class="optional">.<em class="replaceable"><code>type</code></em></span>]</code>
  <em class="replaceable"><code>device</code></em>, <em class="replaceable"><code>hostname</code></em> = <em class="replaceable"><code>word</code></em>
  <em class="replaceable"><code>directory-item</code></em> = <em class="replaceable"><code>wildcard-word</code></em>
  <em class="replaceable"><code>type</code></em> = <em class="replaceable"><code>wildcard-word</code></em> without dots
  <em class="replaceable"><code>name</code></em> = [<span class="optional">.</span>]<em class="replaceable"><code>wildcard-word</code></em></pre><p>

  If this syntax also fails, then the namestring is not a valid pathname
  string and a <span class="type">parse-error</span> will be signalled.</p><p>It is important to remark that in <span class="application">ECL</span>, all physical namestrings
  result into pathnames with a version equal to
  <code class="literal">:NEWEST</code>. Pathnames which are not logical and have any
  other version (i. e. <code class="literal">NIL</code> or a number), cannot be printed
  readably, but can produce a valid namestring which results of ignoring the
  version.</p><p>Finally, an important rule applies to physical namestrings: if a
  namestring contains one or more periods `.', the last period separates the
  namestring into the file name and the filetype. However, a namestring with a
  single leading period results in a name with a period in it. This is for
  compatibility with Unix filenames such as <code class="filename">.bashrc</code>, where
  the leading period indicates that the file is hidden.</p><p>The previous rule has in important consequence, because it means that
  if you want to create a pathname without a name, you have to do it
  explicitely. In other words, <code class="literal">".*"</code> is equivalent to
  <code class="code">(MAKE-PATHNAME :NAME ".*" :TYPE NIL)</code>, while <code class="code">(MAKE-PATHNAME
  :NAME NIL :TYPE :WILD)</code> creates a pathname whose type is a
  wildcard.</p><p>The following table illustrates how the physical pathnames work with
  practical examples.</p><div class="table"><a name="id645347"></a><p class="title"><b>Table&#160;11.1.&#160;Examples of physical namestrings</b></p><div class="table-contents"><table summary="Examples of physical namestrings" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Namestring</th><th>Name</th><th>Type</th><th>Directory</th><th>Device</th></tr></thead><tbody><tr><td>"foo.lsp"</td><td>"foo"</td><td>"lsp"</td><td>NIL</td><td>NIL</td></tr><tr><td>".bashrc"</td><td>".bashrc"</td><td>NIL</td><td>NIL</td><td>NIL</td></tr><tr><td>".ecl.lsp"</td><td>".ecl"</td><td>"lsp"</td><td>NIL</td><td>NIL</td></tr><tr><td>"foo.*"</td><td>"foo"</td><td>:WILD</td><td>NIL</td><td>NIL</td></tr><tr><td>"*.*"</td><td>:WILD</td><td>:WILD</td><td>NIL</td><td>NIL</td></tr><tr><td>"ecl/build/bare.lsp"</td><td>"bare"</td><td>"lsp"</td><td>(:relative "ecl" "build")</td><td>NIL</td></tr><tr><td>"ecl/build/"</td><td>NIL</td><td>NIL</td><td>(:relative "ecl" "build")</td><td>NIL</td></tr><tr><td>"../../ecl/build/"</td><td>NIL</td><td>NIL</td><td>(:relative :up :up "ecl" "build")</td><td>NIL</td></tr><tr><td>"/etc/"</td><td>NIL</td><td>NIL</td><td>(:absolute "etc")</td><td>NIL</td></tr><tr><td>"C:/etc/"</td><td>NIL</td><td>NIL</td><td>(:absolute "etc")</td><td>"C"</td></tr><tr><td>".*"</td><td>".*"</td><td>NIL</td><td>NIL</td><td>NIL</td></tr><tr><td>#.(MAKE-PATHNAME :TYPE "*")</td><td>NIL</td><td>:WILD</td><td>NIL</td><td>NIL</td></tr></tbody></table></div></div><br class="table-break"></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch10.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="pt01.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="ch11s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&#160;10.&#160;Hash tables&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;11.2.&#160;Wild pathnames and matching</td></tr></table></div></body></html>