Based on a patch by Nala Ginrut <nalaginrut@gmail.com>,
with suggestions from Mark H. Weaver.
* module/ice-9/control.scm (call-with-escape-continuation, call/ec): New
procedures.
(let-escape-continuation, let/ec): New macros.
* module/ice-9/futures.scm (let/ec): Remove.
* test-suite/tests/control.test ("escape-only continuations")["call/ec",
"let/ec"]: New tests.
* doc/ref/api-control.texi (Prompt Primitives): Document `call/ec',
`let/ec', and their long names.
* module/ice-9/control.scm (reset, shift): Add implementations of these
operators from Wolfgang J Moeller, derived from implementations by
Oleg Kiselyov.
(reset*, shift*): Procedural variants.
* test-suite/tests/control.test ("shift and reset"): Add tests,
originally from Oleg Kiselyov.
* module/ice-9/control.scm (%): Add a single-argument case, which
instates a default prompt with a default handler.
* libguile/script.c (scm_compile_shell_switches): Wrap user programs in
a default prompt.
* module/system/repl/common.scm (repl-eval): REPL expressions are user
programs too; wrap each one in a default prompt.
* module/ice-9/boot-9.scm (default-prompt-tag, make-prompt-tag): New
functions.
(call-with-prompt, abort-to-prompt): Rename from `prompt' and `abort',
respectively. These names are more clear, and allow `prompt' and
`abort' to have more convenient, less general bindings.
(default-throw-handler, custom-throw-handler, catch, %start-stack):
Adapt callers.
* module/ice-9/control.scm: Adapt re-export list.
(control): Remove binding, until we're sure that it is Sitaram's
control.
(abort): New binding, aborts to the nearest prompt with the default
tag.
(%): Use call-with-prompt.
* module/language/tree-il/primitives.scm (*primitive-expand-table*):
(*interesting-primitive-names*): Adapt for prompt/abort changes.
* test-suite/tests/control.test: Take advantage of the defaults for %
and abort.
* libguile/control.h:
* libguile/control.c: Remove scm_atcontrol and scm_atprompt.
(scm_c_make_prompt): Remove handler arg, as the handler is inline.
(scm_abort): New primitive, exported to Scheme as `abort'. The
compiler will also recognize calls to `abort', but this is the base
case.
(scm_init_control): Remove scm_register_control, just have this
function, which adds `abort' to the `(guile)' module.
* libguile/eval.c (eval): Add SCM_M_PROMPT case.
* libguile/init.c (scm_i_init_guile): Change scm_register_control call
into a nice orderly scm_init_control call.
* libguile/memoize.h: (scm_sym_at_prompt, SCM_M_PROMPT):
* libguile/memoize.c (MAKMEMO_PROMPT, scm_m_at_prompt, unmemoize): Add
prompt support to the memoizer.
* libguile/vm-i-system.c (prompt): Fix to not expect a handler on the
stack.
* module/ice-9/boot-9.scm (prompt): Add definition in terms of @prompt.
* module/ice-9/control.scm: Simplify, and don't play with the compiler
here, now that prompt and abort are primitive.
* module/ice-9/eval.scm (primitive-eval): Add a prompt case.
* module/language/tree-il/primitives.scm
(*interesting-primitive-names*): Add @prompt and prompt.
* module/language/tree-il/primitives.scm (define-primitive-expander):
Allow quoted datums. Allow all self-evaluating expressions to be
constants.
(prompt, control): Add primitive expanders to turn these into @prompt
and @control.
* module/ice-9/control.scm: New module, for delimited continuation
operators.
* module/Makefile.am: Add.