unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* wrong-type-arg in scm_display_backtrace
@ 2002-12-24 21:46 William Morgan
  0 siblings, 0 replies; only message in thread
From: William Morgan @ 2002-12-24 21:46 UTC (permalink / raw)


Dear experts,

I am writing a C program that uses Guile as a scripting engine. In the
process of doing this, I need to catch Guile exceptions in my own handler.
However, when I try to display the backtrace, I invariably get the following
message:

Exception during displaying of backtrace: wrong-type-arg

Here's the exception-handling code (mostly copied from an old email here
by Mikael Djurfeldt):

--- cut here ---

SCM guile_error_handler(void *data, SCM tag, SCM throw_args) {
  SCM port = scm_def_errp;

  if (scm_ilength (throw_args) >= 3) {
    SCM stack = scm_fluid_ref(SCM_VARIABLE_REF (scm_the_last_stack_fluid_var));
    SCM subr = SCM_CAR (throw_args);
    SCM message = SCM_CADR (throw_args);
    SCM args = SCM_CADDR (throw_args);

    scm_newline (port);
    scm_display_backtrace (stack, port, SCM_UNDEFINED, SCM_UNDEFINED);
    scm_newline (port);
    scm_display_error (stack, port, subr, message, args, SCM_EOL);
    return SCM_BOOL_F;
  }
  else {
    scm_puts ("uncaught throw to ", port);
    scm_prin1 (tag, port, 0);
    scm_puts (": ", port);
    scm_prin1 (throw_args, port, 1);
    scm_putc ('\n', port);
  }

  return SCM_BOOL_T;
}

--- cut here ---

I don't fully understand the internals of Guile, particlarly how to deal with
fluids, so perhaps my treatment of scm_the_last_stack_fluid_var is incorrect?
(But the call to scm_display_error seems fine...)

Any help would be appreciated.

Thanks,

-- 
William <wmorgan-gu2@masanjin.net>


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-24 21:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-24 21:46 wrong-type-arg in scm_display_backtrace William Morgan

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).