From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Volkan YAZICI Newsgroups: gmane.lisp.guile.user Subject: Re: saving and restoring the error stack trace Date: Fri, 8 Sep 2006 09:09:45 +0300 Message-ID: <20060908060944.GA1391@alamut> References: <87ejv2gx0x.fsf@ossau.uklinux.net> <87r6z0fqnj.fsf@ossau.uklinux.net> <20060907090226.GB1396@alamut> <87zmdb4awq.fsf@ossau.uklinux.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1157695914 13399 80.91.229.2 (8 Sep 2006 06:11:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 8 Sep 2006 06:11:54 +0000 (UTC) Cc: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Sep 08 08:11:52 2006 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GLZah-0003Ye-Gi for guile-user@m.gmane.org; Fri, 08 Sep 2006 08:11:51 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GLZag-0001SL-Va for guile-user@m.gmane.org; Fri, 08 Sep 2006 02:11:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GLZab-0001Md-3H for guile-user@gnu.org; Fri, 08 Sep 2006 02:11:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GLZaZ-0001Hv-Pg for guile-user@gnu.org; Fri, 08 Sep 2006 02:11:44 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GLZaZ-0001HU-KQ for guile-user@gnu.org; Fri, 08 Sep 2006 02:11:43 -0400 Original-Received: from [212.175.13.129] (helo=fep01.ttnet.net.tr) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GLZb6-0004u7-D2 for guile-user@gnu.org; Fri, 08 Sep 2006 02:12:16 -0400 Original-Received: from (unknown) by AVGW-I-1.ttnet.net.tr with smtp id 1f84_e5a435c4_3f00_11db_8c06_001422175f0e; Fri, 08 Sep 2006 09:11:42 +0300 Original-Received: from alamut ([85.101.175.34]) by fep01.ttnet.net.tr with ESMTP id <20060908061141.YULX10744.fep01.ttnet.net.tr@alamut>; Fri, 8 Sep 2006 09:11:41 +0300 Original-To: Neil Jerram Content-Disposition: inline In-Reply-To: <87zmdb4awq.fsf@ossau.uklinux.net> User-Agent: Mutt/1.4.2.1i X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:5499 Archived-At: On Sep 07 10:36, Neil Jerram wrote: > Volkan YAZICI writes: > > I've another situation that doesn't get executed inside a `catch' block. > > For instance, I need to make some variable definitions just before > > executing related code via scm_c_with_throw_handler(). The problem is, > > in these definitions when an error occurs (e.g. not enough memory in > > case of a scm_from_locale_string() call) I'm not able to handle it and > > program exists without my permission. > > > > In such a situation, should I try to place my whole definition related > > code into a SCM function and execute in a catch scope > > Yes, I think that's what you need to do. It's not too hard to do > this, is it? I've created a CALL_PROC_WITH_CATCH(proc, arg) macro for this purpose. I modified my place_scheme_args(), init_spi() and guile_eval_str() functions into their SCM equivalents and I call these functions via CALL_PROC_WITH_CATCH() macro. (You can find related code in the latest revision of plscheme.c) > > or is there any other way to fix this? > > Not unless you want to change the libguile code. No, thanks. That's not something I can wish from the PL/scheme users. > > [If you want to take a look at the related code, see > > place_scheme_args(), guile_eval_str() and handle_scm_res() functions > > called inside plscheme_func_handler() function in > > http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/~checkout~/plscheme/plscheme/plscheme.c?rev=1.4 > > URL.] > > It's interesting that you use separate catches for place_scheme_args, > init_spi and guile_eval_str. Does it really make sense to go ahead > with the guile_eval_str even if one (or both) of (place_scheme_args > init_spi) failed? > > My inclination would be to try to put everything inside a single > catch, if that is possible. In here, I cannot encapsulate them into a single catch block, because I need to make some other library calls between stages. (Yes these mentioned library calls can go in the SCM functions but this will just obfuscate code.) Also, the ereport() function in exception handler will exit from the current stack (and will be catched by the outer-most PG_TRY() block), which makes it impossible to continue to normal continuation. (Therefore, if one of them fails, next won't get run.) > I forgot to mention when I wrote it that you also need to be using the > debugging evaluator (otherwise make-stack doesn't do anything), but I > see that you've already got that sorted in your code. I figured that out when scm_make_stack() returned SCM_BOOL_F when debugging evaluator is not activated. Thanks so much for your kindly help. Regards. _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user