unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: William Morgan <wmorgan-gu2@masanjin.net>
Subject: wrong-type-arg in scm_display_backtrace
Date: Sun, 29 Dec 2002 20:31:49 -0500	[thread overview]
Message-ID: <20021230013149.GB25056@masanjin.net> (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


             reply	other threads:[~2002-12-30  1:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-30  1:31 William Morgan [this message]
2002-12-31 23:42 ` wrong-type-arg in scm_display_backtrace 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

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=20021230013149.GB25056@masanjin.net \
    --to=wmorgan-gu2@masanjin.net \
    /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).