guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting source location information


From: Ludovic Courtès
Subject: Re: Getting source location information
Date: Wed, 30 Nov 2005 17:04:28 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

Bruce Korb <address@hidden> writes:

> That read function reads an s-expr.  How can that work if
> the non-Scheme text in the file is not an s-expr?  I don't see another
> function for getting text from a port.  Am I missing something?
> Especially troubling is the phrase, "Any whitespace before the
> next token is discarded."  I do not want tokenized input.  I want raw
> text.  I have my own methods for determining when something needs
> a Scheme evaluation.

That the input file does not contain only Scheme source wasn't clear to
me.  Then, in fact, it would make sense to use `scm_c_eval_string ()',
provided your tool is able to determine the boundaries of the Scheme
expression (if it's not, you'd better use `scm_read ()').

After the `scm_c_eval_string ()', you can `printf ()' whatever location
information you want.  If you want to use source locations in a
Guile-friendly way (so that Guile can, for instance, display location
information in backtraces), then you may want to use
`scm_set_source_property_x (sexp, key, datum)' (where KEY may be one of
SCM_SYM_FILENAME, SCM_SYM_LINE, SCM_SYM_COLUMN) which is defined in
`srcprop.h'.

But again, this is a problem (and a solution) relevant to your tool, not
to Guile in general.

Thanks,
Ludovic.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]