unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* wrong-type-arg in scm_display_backtrace
@ 2002-12-30  1:31 William Morgan
  2002-12-31 23:42 ` Neil Jerram
  0 siblings, 1 reply; 9+ messages in thread
From: William Morgan @ 2002-12-30  1:31 UTC (permalink / raw)


Dear Guile experts,

I am writing a C program that uses Guile as a scripting engine. There
doesn't seem to be a lot of documentation about this aspect of Guile and
I am relying my interpretation of other people's code. Now I have a
problem.

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 procedure I'm passing to scm_internal_cwdr
(mostly copied from an old email 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-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-01-10 20:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-30  1:31 wrong-type-arg in scm_display_backtrace William Morgan
2002-12-31 23:42 ` Neil Jerram
2003-01-05  3:57   ` William Morgan
2003-01-06 19:06     ` Neil Jerram
2003-01-07  5:42       ` William Morgan
2003-01-08 20:21         ` Neil Jerram
2003-01-08 22:38           ` William Morgan
2003-01-09 23:42             ` Neil Jerram
2003-01-10 20:31               ` vports from c questions 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).