1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 20:00:19 +02:00
Commit graph

9 commits

Author SHA1 Message Date
Andy Wingo
6dd87f4d8c Add suspendable-continuation?
* doc/ref/api-control.texi (Prompt Primitives): Document
  suspendable-continuation?.
* libguile/control.c (scm_suspendable_continuation_p): New procedure.
  (scm_init_ice_9_control): New extension procedure, defines
  suspendable-continuation?.
  (scm_init_control): Register scm_init_ice_9_control.
* libguile/eval.c (eval):
* libguile/throw.c (catch):
* libguile/continuations.c (scm_i_make_continuation): Restore resumable
  prompt cookie after continuation invocation.
* libguile/vm.c (scm_call_n): Arrange to set resumable_prompt_cookie
  during invocation of VM.
* libguile/vm.h (struct scm_vm): Add resumable_prompt_cookie member.
* module/ice-9/control.scm: Export suspendable-continuation?.
* test-suite/tests/control.test ("suspendable-continuation?"): New
  test.
2016-12-12 21:13:00 +01:00
Ludovic Courtès
55e26a49db Add call/ec' and let/ec'.
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.
2013-04-05 22:54:14 +02:00
Andy Wingo
0c65f52c6d more define-syntax-rule usage
* module/ice-9/boot-9.scm:
* module/ice-9/control.scm:
* module/ice-9/futures.scm:
* module/ice-9/optargs.scm:
* module/ice-9/poll.scm:
* module/ice-9/receive.scm:
* module/ice-9/threads.scm:
* module/ice-9/vlist.scm:
* module/language/assembly/compile-bytecode.scm:
* module/language/ecmascript/compile-tree-il.scm:
* module/language/tree-il.scm:
* module/oop/goops.scm:
* module/oop/goops/simple.scm:
* module/oop/goops/stklos.scm:
* module/srfi/srfi-1.scm:
* module/srfi/srfi-35.scm:
* module/srfi/srfi-39.scm:
* module/srfi/srfi-45.scm:
* module/srfi/srfi-67/compare.scm:
* module/sxml/match.scm:
* module/system/repl/error-handling.scm:
* module/system/repl/repl.scm:
* module/system/vm/inspect.scm:
* module/texinfo.scm:
* module/web/server.scm: Use define-syntax-rule, where it makes sense.
2011-09-02 11:36:14 +02:00
Andy Wingo
18e444b40e add reset and shift
* 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.
2011-04-28 15:48:28 +02:00
Andy Wingo
32ce4058db prompt around REPL evaluations, and around `guile' program invocation
* 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.
2010-03-12 11:54:26 +01:00
Andy Wingo
8fc43b12c7 prompt, abort -> call-with-prompt, abort-to-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.
2010-03-09 22:24:25 +01:00
Andy Wingo
c8df99730a (ice-9 control) fixes
* module/ice-9/control.scm (%): Fix to allow tagged and default-tagged
  prompts.
  (abort): Re-export.
2010-02-24 23:20:38 +01:00
Andy Wingo
747022e4cb prompt as part of guile's primitive language
* 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.
2010-02-19 22:44:24 +01:00
Andy Wingo
9b2a2a391a add (ice-9 control)
* 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.
2010-01-31 20:40:24 +01:00