guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

wrong-type-arg in scm_display_backtrace


From: William Morgan
Subject: wrong-type-arg in scm_display_backtrace
Date: Tue, 24 Dec 2002 16:46:07 -0500
User-agent: Mutt/1.4i

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 <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]