[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Guile Introspection
From: |
Thien-Thi Nguyen |
Subject: |
Re: Guile Introspection |
Date: |
Thu, 12 Jul 2007 15:09:45 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.97 (gnu/linux) |
() Andy Wingo <address@hidden>
() Mon, 09 Jul 2007 12:57:41 +0200
(I would really like to be able to get line numbers
so that the documentation that I autogenerate based
on introspection can be ordered as it appears in the
source. I poked at this a couple hours and failed.)
below is some code you can try. to play: save as x.scm
and issue the shell command: guile -s x.scm.
thi
________________________________________________________
(define (lc alist)
(list (assq-ref alist 'line)
(assq-ref alist 'column)))
(define (posn form)
(display "posn: ")
(write (cond ((not (pair? form)) "not a pair")
((source-properties form) => lc)
(else #f)))
(newline))
(define p (open-input-file "x.scm"))
(define (r)
(read-enable 'positions)
(let ((form (read p)))
(or (eof-object? form)
(begin
(display "form: ")
(write form)
(newline)
(posn form)
(r)))))
42
(r)