Re: Getting source location information

2005-12-14 Thread Kevin Ryde
Bruce Korb <[EMAIL PROTECTED]> writes: > > OK. Let's put it in the doc then, too. :-) I added it. ___ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel

Re: Getting source location information

2005-12-01 Thread Ludovic Courtès
Hi, [EMAIL PROTECTED] (Ludovic Courtès) writes: > So I guess we're almost screwed because `scm_read ()' gets location info > from the port it's reading from. So if you provide it with a string port, > that will not work. Well, `set-port-filename!', `set-port-line!', etc. which Rob pointed out _

Re: Getting source location information

2005-11-30 Thread Han-Wen Nienhuys
Bruce Korb wrote: Hi, I am completely certain that this makes sense to you. To me, it does not. If I call ``scm_read(port)'' I have to attach the input file as a port. 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 anot

Re: Getting source location information

2005-11-30 Thread Bruce Korb
On Wednesday 30 November 2005 02:35 pm, Rob Browning wrote: > >SCM res = scm_call_3 (proc, str, file, line); > >// Let's forget columns -- we don't have scm_call_4. > > Actually it looks like there is a scm_call_4. OK. Let's put it in the doc then, too. :-) > > I'll give this a spin

Re: Getting source location information

2005-11-30 Thread Rob Browning
Bruce Korb <[EMAIL PROTECTED]> writes: > With the final piece being the C code: > >SCM proc = scm_c_eval_string ("eval-string-from-file"); This is probably fine, but you might also want to try the scm_c_module_lookup function(s). They should be a little bit more efficient: SCM proc = s

Re: Getting source location information

2005-11-30 Thread Bruce Korb
On Wednesday 30 November 2005 11:00 am, Rob Browning wrote: > If so, then I wondered if it might be possible to just implement the > function mentioned originally > i.e. ag_scm_c_eval_string_from_file_line, and here's what I came up > with. Note that I have no idea if this will actually work; I ha

Re: Getting source location information

2005-11-30 Thread Rob Browning
[EMAIL PROTECTED] (Ludovic Courtès) writes: > 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_FI

Re: Getting source location information

2005-11-30 Thread Ludovic Courtès
Bruce Korb <[EMAIL PROTECTED]> writes: > *Thank you*, Ludvic! Now we're getting some where. :-D Cool. ;-) > So, again, I need clarity. Are you saying this: First, the `scm_sym_*' things should be lower-case (I was using the GNU notation for function arguments). It's more complicated than th

Re: Getting source location information

2005-11-30 Thread Bruce Korb
On Wednesday 30 November 2005 08:04 am, Ludovic Courtès wrote: *Thank you*, Ludvic! Now we're getting some where. :-D > That the input file does not contain only Scheme source wasn't clear to > me. What I am doing is extracting Scheme code from an encompassing template and handing it off fo

Re: Getting source location information

2005-11-30 Thread Ludovic Courtès
Bruce Korb <[EMAIL PROTECTED]> 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

Re: Getting source location information

2005-11-30 Thread Bruce Korb
On Wednesday 30 November 2005 06:44 am, Ludovic Courtès wrote: > Bruce Korb <[EMAIL PROTECTED]> writes: > > > Because the file is mostly *NOT* scheme. > > I did say that you could use "Scheme constructs", "be it from Scheme > o[r] C code". In other words, you can either write `(read)' in a piece

Getting source location information

2005-11-30 Thread Ludovic Courtès
Bruce Korb <[EMAIL PROTECTED]> writes: > Because the file is mostly *NOT* scheme. I did say that you could use "Scheme constructs", "be it from Scheme o[r] C code". In other words, you can either write `(read)' in a piece of Scheme code, or call `scm_read ()' from your C code: both are strictly