unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
Cc: guile-user@gnu.org, spikegran@earthlink.net
Subject: Re: Guile top-level functions
Date: Mon, 17 Jan 2005 08:38:59 +0000	[thread overview]
Message-ID: <41EB79A3.3040608@ossau.uklinux.net> (raw)
In-Reply-To: <87sm50x6m0.fsf@zip.com.au>

Kevin Ryde wrote:
> Mike Gran <spk121@yahoo.com> writes:
> 
>>I had thought it would be neat to color code them by module.  Is there
>>a way from the C API to find out the filename and line number of a SCM
>>procedure?
> 
> 
> I was wanting that the other day too, from the procedure would be
> good, from the module variable would be even better.  The reader gets
> the information, but is it thrown away?

Not if you set the 'positions read option, i.e.

(read-enable 'positions)

Then source location information is saved in a weak hash table 
(scm_source_whash, I think) indexed by each read pair.  Given a read 
expression X, you can get its filename, line and column from

(source-property X 'filename)
(source-property X 'line)
(source-property X 'column)

I'm now sure, though, how to access this for a given procedure; I 
suspect there are two problems:

- procedure-source may return a new unmemoized copy of the procedure's 
source, not the original source, and without source properties attached

- it may be impossible to enable the 'positions option early enough in 
boot-9.scm to catch everything that you want to catch.

I hope this is some help, though.

	Neil


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


  reply	other threads:[~2005-01-17  8:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-16 19:54 Guile top-level functions Mike Gran
2005-01-17  0:05 ` Kevin Ryde
2005-01-17  8:38   ` Neil Jerram [this message]
2005-01-17 22:20     ` Kevin Ryde
2005-01-17 23:15       ` Neil Jerram
2005-01-18  0:23         ` Kevin Ryde
2005-01-19 21:39           ` Neil Jerram
2005-01-19 22:15             ` Kevin Ryde

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=41EB79A3.3040608@ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=guile-user@gnu.org \
    --cc=spikegran@earthlink.net \
    /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).