mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-17 01:00:20 +02:00
make scm_make_continuation internal
* libguile/continuations.h: * libguile/continuations.c (scm_i_make_continuation): Change from scm_make_continuation, and make internal. * libguile/vm-i-system.c (call/cc, tail-call/cc): Adapt callers. * test-suite/standalone/test-unwind.c (check_cont_body): Adapt a test. * doc/ref/api-control.texi (Continuations): Update docs.
This commit is contained in:
parent
babfc7b2c3
commit
997659f898
6 changed files with 9 additions and 20 deletions
|
@ -410,15 +410,6 @@ invoke that continuation.
|
|||
This is in common use since the latter is rather long.
|
||||
@end deffn
|
||||
|
||||
@deftypefn {C Function} SCM scm_make_continuation (int *first)
|
||||
Capture the current continuation as described above. The return value
|
||||
is the new continuation, and @var{*first} is set to 1.
|
||||
|
||||
When the continuation is invoked, @code{scm_make_continuation} will
|
||||
return again, this time returning the value (or set of multiple
|
||||
values) passed in that invocation, and with @var{*first} set to 0.
|
||||
@end deftypefn
|
||||
|
||||
@sp 1
|
||||
@noindent
|
||||
Here is a simple example,
|
||||
|
|
|
@ -60,7 +60,7 @@ static scm_t_bits tc16_continuation;
|
|||
|
||||
|
||||
|
||||
/* scm_make_continuation will return a procedure whose objcode contains an
|
||||
/* scm_i_make_continuation will return a procedure whose objcode contains an
|
||||
instruction to reinstate the continuation. Here, as in gsubr.c and smob.c, we
|
||||
define the form of that trampoline function.
|
||||
*/
|
||||
|
@ -189,9 +189,9 @@ continuation_print (SCM obj, SCM port, scm_print_state *state SCM_UNUSED)
|
|||
/* this may return more than once: the first time with the escape
|
||||
procedure, then subsequently with the value to be passed to the
|
||||
continuation. */
|
||||
#define FUNC_NAME "scm_make_continuation"
|
||||
#define FUNC_NAME "scm_i_make_continuation"
|
||||
SCM
|
||||
scm_make_continuation (int *first)
|
||||
scm_i_make_continuation (int *first)
|
||||
{
|
||||
scm_i_thread *thread = SCM_I_CURRENT_THREAD;
|
||||
SCM cont;
|
||||
|
|
|
@ -71,7 +71,7 @@ typedef struct
|
|||
|
||||
|
||||
|
||||
SCM_API SCM scm_make_continuation (int *first);
|
||||
SCM_INTERNAL SCM scm_i_make_continuation (int *first);
|
||||
SCM_INTERNAL SCM scm_i_call_with_current_continuation (SCM proc);
|
||||
SCM_INTERNAL SCM scm_i_continuation_to_frame (SCM cont);
|
||||
SCM_INTERNAL void scm_i_continuation_call (SCM cont, size_t n, SCM *argv);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009
|
||||
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010
|
||||
* Free Software Foundation, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
|
|
@ -1093,7 +1093,7 @@ VM_DEFINE_INSTRUCTION (64, call_cc, "call/cc", 0, 1, 1)
|
|||
SCM proc, cont;
|
||||
POP (proc);
|
||||
SYNC_ALL ();
|
||||
cont = scm_make_continuation (&first);
|
||||
cont = scm_i_make_continuation (&first);
|
||||
if (first)
|
||||
{
|
||||
PUSH ((SCM)fp); /* dynamic link */
|
||||
|
@ -1130,7 +1130,7 @@ VM_DEFINE_INSTRUCTION (65, tail_call_cc, "tail-call/cc", 0, 1, 1)
|
|||
SCM proc, cont;
|
||||
POP (proc);
|
||||
SYNC_ALL ();
|
||||
cont = scm_make_continuation (&first);
|
||||
cont = scm_i_make_continuation (&first);
|
||||
ASSERT (sp == vp->sp);
|
||||
ASSERT (fp == vp->fp);
|
||||
if (first)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2004, 2005, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
|
@ -137,12 +137,10 @@ SCM
|
|||
check_cont_body (void *data)
|
||||
{
|
||||
scm_t_dynwind_flags flags = (data? SCM_F_DYNWIND_REWINDABLE : 0);
|
||||
int first;
|
||||
SCM val;
|
||||
|
||||
scm_dynwind_begin (flags);
|
||||
|
||||
val = scm_make_continuation (&first);
|
||||
val = scm_c_eval_string ("(call/cc (lambda (k) k))");
|
||||
scm_dynwind_end ();
|
||||
return val;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue