Re: Literate files and ASDF

Richard M Kreuter <[email protected]> Sat, 09 Jun 2007 20:11:39 -0400
Newsgroups gmane.lisp.cclan.general
Message-ID <[email protected]>
C Y <[email protected]> writes:

> Something like:
>
> (defsystem #:boot
>   :name "BOOT Language Compiler"
>   :author "The Axiom Team"
>   :version "1.0"
>   :components
>   ((:module "BOOT-BOOTSTRAP"
>             :pathname #.(make-pathname :directory '(:relative "src"
> "boot"))
>             :components
>             ((:cl-pamphlet "ptyout" :chunk "ptyout.clisp")
>              (:cl-pamphlet "tytree1" :chunk "tytree1.clisp")))
>     (:module "BOOT"
>             :pathname #.(make-pathname :directory '(:relative "src"
> "boot"))
>             :components
>             ((:boot-pamphlet "ptyout" :chunk "*")
>              (:boot-pamphlet "tytree1" :chunk "*"))))
>
> Is what I would like to do.
>
> Reading the asdf source code, I'm thinking that I would have to
> define custom versions of the component parser and possibly the
> toplevel defsystem macro itself in order to be able to read the
> extra :chunk information in the component definition - is this true?

No.  First an example, then an explanation:

CL-USER> (defclass some-component (asdf:component)
           ((some-slot :initarg :some-slot :accessor some-slot)))
#<STANDARD-CLASS SOME-COMPONENT>
CL-USER> (asdf:defsystem some-system
	   :components ((:some-component "some-component-name"
					 :some-slot 'some-value)))
#<ASDF:SYSTEM "some-system" {50FF60A1}>
CL-USER> (describe (first (asdf:module-components *)))
#<SOME-COMPONENT "some-component-name" {511D8E49}>
is an instance of class #<STANDARD-CLASS SOME-COMPONENT>.
The following slots have :INSTANCE allocation:
 NAME                 "some-component-name"
 VERSION              #<unbound slot>
 IN-ORDER-TO          NIL
 DO-FIRST             ((ASDF:COMPILE-OP (ASDF:LOAD-OP)))
 INLINE-METHODS       NIL
 PARENT               #<ASDF:SYSTEM "some-system" {50FF60A1}>
 RELATIVE-PATHNAME    NIL
 OPERATION-TIMES      #<HASH-TABLE :TEST EQL :COUNT 0 {511D9619}>
 PROPERTIES           NIL
 SOME-SLOT            'SOME-VALUE

Note the last line.

Explanation: asdf instantiates components in the function
PARSE-COMPONENT-FORM.  P-C-F first creates component instances by
calling MAKE-INSTANCE with a class name and no initargs, and then
calls REINITIALIZE-INSTANCE on the component with a few fixed-up
initargs and any keyword argument that's not one of a small number of
keywords that are part of the DEFSYSTEM syntax.  So you're basically
free to add new initargs to your component classes.

Hope that helps,
RmK


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/