unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Volkan YAZICI <yazicivo@ttnet.net.tr>
Cc: guile-user@gnu.org
Subject: Re: saving and restoring the error stack trace
Date: Fri, 8 Sep 2006 09:09:45 +0300	[thread overview]
Message-ID: <20060908060944.GA1391@alamut> (raw)
In-Reply-To: <87zmdb4awq.fsf@ossau.uklinux.net>

On Sep 07 10:36, Neil Jerram wrote:
> Volkan YAZICI <yazicivo@ttnet.net.tr> 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


  reply	other threads:[~2006-09-08  6:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-25  9:39 saving and restoring the error stack trace Marco Maggi
2006-08-27 12:53 ` Neil Jerram
2006-08-28 22:21   ` Neil Jerram
2006-09-07  9:02     ` Volkan YAZICI
2006-09-07 21:36       ` Neil Jerram
2006-09-08  6:09         ` Volkan YAZICI [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-09-01 20:10 Marco Maggi
2006-08-31  6:04 Marco Maggi
2006-09-01  7:47 ` Neil Jerram
2006-09-01  9:39   ` Ludovic Courtès
2006-09-07 22:11     ` Neil Jerram
2006-08-29  3:08 dsmich
2006-09-01  7:34 ` Neil Jerram
2006-08-24 19:34 Marco Maggi
2006-08-24 21:53 ` Neil Jerram

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=20060908060944.GA1391@alamut \
    --to=yazicivo@ttnet.net.tr \
    --cc=guile-user@gnu.org \
    /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).