From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bruce Korb Newsgroups: gmane.lisp.guile.devel Subject: Re: Getting source location information Date: Wed, 30 Nov 2005 08:58:49 -0800 Organization: At Home Message-ID: <200511300858.49886.bruce.korb@gmail.com> References: <200511272025.32395.bruce.korb@gmail.com> <200511300730.44076.bruce.korb@gmail.com> <87psoixgtv.fsf@laas.fr> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1133375191 18075 80.91.229.2 (30 Nov 2005 18:26:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 30 Nov 2005 18:26:31 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Nov 30 19:26:20 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EhWCN-0002bW-26 for guile-devel@m.gmane.org; Wed, 30 Nov 2005 18:56:55 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EhWCM-00006u-35 for guile-devel@m.gmane.org; Wed, 30 Nov 2005 12:56:54 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EhVIK-00042a-SV for guile-devel@gnu.org; Wed, 30 Nov 2005 11:59:01 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EhVIJ-00041X-6P for guile-devel@gnu.org; Wed, 30 Nov 2005 11:59:00 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EhVII-00040x-Qc for guile-devel@gnu.org; Wed, 30 Nov 2005 11:58:58 -0500 Original-Received: from [207.115.57.74] (helo=ylpvm43.prodigy.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EhVII-00072k-U0 for guile-devel@gnu.org; Wed, 30 Nov 2005 11:58:59 -0500 Original-Received: from pimout1-ext.prodigy.net (pimout1-int.prodigy.net [207.115.5.65]) by ylpvm43.prodigy.net (8.12.10 outbound/8.12.10) with ESMTP id jAUGx02C015369 for ; Wed, 30 Nov 2005 11:59:00 -0500 X-ORBL: [69.226.209.231] Original-Received: from [192.168.1.4] (adsl-69-226-209-231.dsl.pltn13.pacbell.net [69.226.209.231]) by pimout1-ext.prodigy.net (8.13.4 outbound domainkey aix/8.13.4) with ESMTP id jAUGwnke259532; Wed, 30 Nov 2005 11:58:56 -0500 Original-To: Ludovic =?iso-8859-1?q?Court=E8s?= User-Agent: KMail/1.7.1 In-Reply-To: <87psoixgtv.fsf@laas.fr> Content-Disposition: inline X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:5434 Archived-At: On Wednesday 30 November 2005 08:04 am, Ludovic Court=E8s 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 for evaluation. When I said that, I was meaning to say that the file was not pure scheme code. > Then, in fact, it would make sense to use `scm_c_eval_string ()',=20 > provided your tool is able to determine the boundaries of the Scheme > expression (if it's not, you'd better use `scm_read ()'). It is easily done. > If you want to use source locations in a > Guile-friendly way (so that Guile can, for instance, display location > information in backtraces), *YES* !!! > then you may want to use=20 > `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'. So, again, I need clarity. Are you saying this: SCM res; SCM code =3D scm_from_locale_string (extracted_text); SCM file =3D scm_from_locale_string (file_name); SCM line =3D scm_from_int (line); scm_set_source_property_x (code, SCM_SYM_FILENAME, file); scm_set_source_property_x (code, SCM_SYM_LINE, line); res =3D scm_primitive_eval (code) > But again, this is a problem (and a solution) relevant to your tool, not > to Guile in general. Well, actually, I disagree. If any application wants to cope with embedded Guile extensions in their input files, they either have to solve this problem or else give up on being able to have Guile error messages reference the source location. My guess is is that other folks just invoke scm_c_eval_string() and don't sweat the message locations. That is what I first did. Then, I learned that getting location information was possible. However, the only way I could do it was by writing a piece of obnoxious code that delved deep into the bowels of Guile. That was wrong, but more important than not having file and line information. Now, the 1.7 implementation has invalidated portions of the non-deprecated 1.6 interface that I have been using. I am forced to rewrite a lot of stuff as a consequence. Here I am. :) Thanks again for all your help. Regards, Bruce _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel