use libguile dynamic wind + c pseudo-closures
authorBT Templeton <bt@hcoop.net>
Fri, 19 Jul 2013 20:57:48 +0000 (16:57 -0400)
committerRobin Templeton <robin@terpri.org>
Mon, 9 Feb 2015 18:04:21 +0000 (13:04 -0500)
commit316bec86ae3d476d0a73a7420bf612fbe64acb8e
tree1cfa5d06fc45d1a35b415958f44693d56a142017
parent543140beb6baecb4743e2ae251cd31e3834f0b7d
use libguile dynamic wind + c pseudo-closures

* src/eval.c (specpdl_arg): Remove.
  (set_catchlist, set_handlerlist, restore_catchtag): New functions.
  (internal_catch, internal_lisp_condition_case)
  (internal_condition_case, internal_condition_case_1)
  (internal_condition_case_2, internal_condition_case_n): Use
  `call_with_prompt'.
  (unwind_to_catch): Use `abort_to_prompt'.
  (set_lisp_eval_depth): New function.

  (record_in_backtrace): Set an unwind handler to remove the backtrace
  entry.

  (eval_sub, Ffuncall, specbind, record_unwind_protect_ptr_1): Use
  Guile unwind handlers.

  (call_void): New function.

  (record_unwind_protect_1, record_unwind_protect_int_1)
  (record_unwind_protect_void_1): Use `record_unwind_protect_ptr_1'.

  (unbind_once): Now static. Remove support for `SPECPDL_UNWIND',
  `SPECPDL_UNWIND_PTR', `SPECPDL_UNWIND_INT' and `SPECPDL_UNWIND_VOID'
  specpdl entries.

  (dynwind_begin): Use `scm_dynwind_begin'.
  (dynwind_end): Use `scm_dynwind_end'.

  (unbind_to_1, unbind_to): Remove.

  (backtrace_eval_unrewind): Remove support for `SPECPDL_UNWIND',
  `SPECPDL_UNWIND_PTR', `SPECPDL_UNWIND_INT' and `SPECPDL_UNWIND_VOID'
  specpdl entries.

  (abort_to_prompt, call_with_prompt, make_prompt_tag): New functions.

  (struct handler, struct catchtag): Moved from "lisp.h".

  src/keyboard.c (save_getcjmp, restore_getcjmp): Remove.

  (read_event_from_main_queue, read_decoded_event_from_main_queue)
  (read_char, read_char_1, quit_throw_to_read_char): Use delimited
  continuations instead of `setjmp' and `longjmp'.

* src/lisp.h (SPECPDL_FRAME, SPECPDL_UNWIND, SPECPDL_UNWIND_PTR)
  (SPECPDL_UNWIND_INT, SPECPDL_UNWIND_VOID): Remove. All references
  changed.

  (struct handler, struct catchtag): Move to "eval.c".

--------------------------------------------------

* src/emacs.c (main2): Call `init_guile'.

* src/eval.c (icc_thunk, icc_handler, icc_handler_n)
  (icc_lisp_handler): New functions.

  (internal_catch, internal_lisp_condition_case)
  (internal_condition_case, internal_condition_case_1)
  (internal_condition_case_2, internal_condition_case_n): Use
  `make_c_closure' and the above functions.

* src/guile.c: New file.
  (make_c_closure, apply_c_closure, init_guile): New functions.

* src/keyboard.c (read_char_thunk, read_char_handle_quit): New
  functions.
  (read_char): Use `make_c_closure' and the above functions.
src/Makefile.in
src/emacs.c
src/eval.c
src/guile.c [new file with mode: 0644]
src/guile.h [new file with mode: 0644]
src/keyboard.c
src/lisp.h