Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 723830890bac44da3d113209b14e090b > files > 249

sbcl-1.0.31-1mdv2010.0.i586.rpm

<html lang="en">
<head>
<title>The defsystem form - asdf Manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="asdf Manual">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Defining-systems-with-defsystem.html#Defining-systems-with-defsystem" title="Defining systems with defsystem">
<link rel="prev" href="Defining-systems-with-defsystem.html#Defining-systems-with-defsystem" title="Defining systems with defsystem">
<link rel="next" href="A-more-involved-example.html#A-more-involved-example" title="A more involved example">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This manual describes asdf, a system definition facility for Common
Lisp programs and libraries.

asdf Copyright (C) 2001-2004 Daniel Barlow and contributors

This manual Copyright (C) 2001-2004 Daniel Barlow and
contributors

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="The-defsystem-form"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="A-more-involved-example.html#A-more-involved-example">A more involved example</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Defining-systems-with-defsystem.html#Defining-systems-with-defsystem">Defining systems with defsystem</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Defining-systems-with-defsystem.html#Defining-systems-with-defsystem">Defining systems with defsystem</a>
<hr>
</div>

<!-- node-name,  next,  previous,  up -->
<h3 class="section">2.1 The defsystem form</h3>

<p>Systems can be constructed programmatically by instantiating
components using make-instance.  Most of the time, however, it is much
more practical to use a static <code>defsystem</code> form.  This section
begins with an example of a system definition, then gives the full
grammar of <code>defsystem</code>.

   <p>Let's look at a simple system.  This is a complete file that would
usually be saved as <samp><span class="file">hello-lisp.asd</span></samp>:

<pre class="lisp">     (defpackage hello-lisp-system
       (:use :common-lisp :asdf))
     
     (in-package :hello-lisp-system)
     
     (defsystem "hello-lisp"
         :description "hello-lisp: a sample Lisp system."
         :version "0.2"
         :author "Joe User &lt;joe@example.com&gt;"
         :licence "Public Domain"
         :components ((:file "packages")
                      (:file "macros" :depends-on ("packages"))
                      (:file "hello" :depends-on ("macros"))))
</pre>
   <p>Some notes about this example:

     <ul>
<li>The file starts with <code>defpackage</code> and <code>in-package</code> forms to
make and use a package expressly for defining this system in.  This
package is named by taking the system name and suffixing
<code>-system</code> - note that it is <em>not</em> the same package as you
will use for the application code.

     <p>This is not absolutely required by asdf, but helps avoid namespace
pollution and so is considered good form.

     <li>The defsystem form defines a system named "hello-lisp" that contains
three source files: <samp><span class="file">packages</span></samp>, <samp><span class="file">macros</span></samp> and <samp><span class="file">hello</span></samp>.

     <li>The file <samp><span class="file">macros</span></samp> depends on <samp><span class="file">packages</span></samp> (presumably because
the package it's in is defined in <samp><span class="file">packages</span></samp>), and the file
<samp><span class="file">hello</span></samp> depends on <samp><span class="file">macros</span></samp> (and hence, transitively on
<samp><span class="file">packages</span></samp>).  This means that asdf will compile and load
<samp><span class="file">packages</span></samp> and <samp><span class="file">macros</span></samp> before starting the compilation of
file <samp><span class="file">hello</span></samp>.

     <li>The files are located in the same directory as the file with the
system definition.  asdf resolves symbolic links before loading the system
definition file and stores its location in the resulting
system<a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</sup></a>.  This is a good thing because the user can
move the system sources without having to edit the system definition.

   </ul>

   <div class="footnote">
<hr>
<h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> It is possible, though almost never necessary, to
override this behaviour.</p>

   <hr></div>

   </body></html>