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>
Sat, 18 Apr 2015 22:49:12 +0000 (18:49 -0400)
commit6376ba302aba4ddebec044a4c23673349af55c6b
tree922280cc9669cef3171a7eb78edd8376270a38cf
parent98d4da5e1812c76fae2cf6f232a4f26abeca070c
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