[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Re: A few questions
From: |
felix winkelmann |
Subject: |
Re: [Chicken-users] Re: A few questions |
Date: |
Mon, 4 Feb 2008 07:09:52 +0100 |
On Jan 31, 2008 5:45 PM, Mark Fredrickson <address@hidden> wrote:
>
> Compiling with -X docinfo could add all of this to a unit.db file
> which could be optionally loaded, so we could eliminate overhead for
> cases where you don't need the info. Perhaps (use-with-info xyz) to
> load?
>
The svn trunk of chicken provides now a hook that can be exploited like
this:
; x.scm:
(set! ##compiler#process-lambda-documentation
(let ((out #f))
(lambda (dest doc lam)
(unless out
(set! out
(open-output-file
(pathname-replace-extension ##compiler#source-filename ".doc") ) ) )
(with-output-to-port out (cut pp `(,dest ,doc)))
lam) ) )
; y.scm:
(define (foo)
"this is a test"
33)
(define (bar)
(noop))
(define baz
(let ((x 1))
(lambda ()
"perhaps..."
'ok)))
(let ()
(define (yes)
"something else."
(print 1)))
Running "csc -X x.scm y.scm" will produce (among compiling x) this
in "x.doc":
(foo "this is a test")
(baz "perhaps...")
Apologies for the mindless example.
cheers,
felix