From: Thien-Thi Nguyen <ttn@gnuvola.org>
To: Andy Wingo <wingo@pobox.com>
Cc: guile-user@gnu.org
Subject: Re: Guile Introspection
Date: Thu, 12 Jul 2007 15:09:45 +0200 [thread overview]
Message-ID: <878x9lu5t2.fsf@ambire.localdomain> (raw)
In-Reply-To: <1183978661.13149.5.camel@localhost.localdomain> (Andy Wingo's message of "Mon\, 09 Jul 2007 12\:57\:41 +0200")
() Andy Wingo <wingo@pobox.com>
() 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)
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
next prev parent reply other threads:[~2007-07-12 13:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-07 15:40 Guile Introspection Mike Gran
2007-07-08 0:18 ` Issac Trotts
2007-07-08 15:18 ` Ludovic Courtès
2007-07-09 10:57 ` Andy Wingo
2007-07-09 12:35 ` Ludovic Courtès
2007-07-12 13:09 ` Thien-Thi Nguyen [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-07-09 6:28 Marco Maggi
2007-07-10 12:51 Marco Maggi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878x9lu5t2.fsf@ambire.localdomain \
--to=ttn@gnuvola.org \
--cc=guile-user@gnu.org \
--cc=wingo@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).