[Top][All Lists]

[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: Sun, 29 Dec 2002 20:31:49 -0500
User-agent: Mutt/1.4i

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

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.


William <address@hidden>

reply via email to

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