[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Replacement for SCM_SETJMPBUF?
From: |
Rob Browning |
Subject: |
Replacement for SCM_SETJMPBUF? |
Date: |
Fri, 14 Sep 2001 10:53:41 -0500 |
User-agent: |
Gnus/5.090004 (Oort Gnus v0.04) Emacs/20.7 |
At Trow's request, I'm trying to port guppi to our guile beta, and it
has some code (borrowed from scwm apparently), that calls
SCM_SETJMPBUF. Since that macro's been eliminated, is there a
replacement?
If someone can explain a bit, I'll add the relevant verbage to NEWS.
I'm not yet completely sure what the code in question is doing, but in
case it helps (in particular, in case there's a better way to handle
this altogether) here's the relevant function:
static SCM
scm_internal_cwdr_no_unwind (scm_catch_body_t body, void *body_data,
scm_catch_handler_t handler, void *handler_data,
SCM_STACKITEM * stack_start)
{
#ifdef USE_STACKJMPBUF
scm_contregs static_jmpbuf;
#endif
int old_ints_disabled = scm_ints_disabled;
SCM old_rootcont;
struct cwdr_no_unwind_handler_data my_handler_data;
SCM answer = SCM_UNSPECIFIED;
/* Create a fresh root continuation. */
{
SCM new_rootcont;
SCM_NEWCELL (new_rootcont);
SCM_REDEFER_INTS;
#ifdef USE_STACKJMPBUF
SCM_SETJMPBUF (new_rootcont, &static_jmpbuf);
#else
SCM_SETJMPBUF (new_rootcont,
scm_must_malloc ((long) sizeof (scm_contregs),
"inferior root continuation"));
#endif
SCM_SETCAR (new_rootcont, scm_tc7_contin);
SCM_DYNENV (new_rootcont) = SCM_EOL;
SCM_BASE (new_rootcont) = stack_start;
SCM_SEQ (new_rootcont) = (SCM) - 1; /* warning: neg value in unsigned int */
#ifdef DEBUG_EXTENSIONS
SCM_DFRAME (new_rootcont) = 0;
#endif
old_rootcont = scm_rootcont;
scm_rootcont = new_rootcont;
SCM_REALLOW_INTS;
}
#ifdef DEBUG_EXTENSIONS
SCM_DFRAME (old_rootcont) = scm_last_debug_frame;
scm_last_debug_frame = 0;
#endif
{
my_handler_data.run_handler = 0;
answer = scm_internal_catch (SCM_BOOL_T,
body, body_data,
cwdr_no_unwind_handler, &my_handler_data);
}
SCM_REDEFER_INTS;
#ifdef USE_STACKCJMPBUF
SCM_SETJMPBUF (scm_rootcont, NULL);
#endif
#ifdef DEBUG_EXTENSIONS
scm_last_debug_frame = SCM_DFRAME (old_rootcont);
#endif
scm_rootcont = old_rootcont;
SCM_REALLOW_INTS;
scm_ints_disabled = old_ints_disabled;
/* Now run the real handler iff the body did a throw. */
if (my_handler_data.run_handler)
return handler (handler_data, my_handler_data.tag, my_handler_data.args);
else
return answer;
}
--
Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG=1C58 8B2C FB5E 3F64 EA5C 64AE 78FE E5FE F0CB A0AD
Re: Replacement for SCM_SETJMPBUF?, Maciej Stachowiak, 2001/09/15