mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-18 09:40:25 +02:00
%start-stack in Scheme, in terms of prompts
* libguile/debug.h: * libguile/debug.c (scm_sys_start_stack): Removed, we implement this in Scheme now. * libguile/vm.h: * libguile/vm.c (scm_vm_call_with_new_stack): Likewise removed. * module/ice-9/boot-9.scm (%start-stack): Implement in terms of prompts. (%stacks): New fluid, for tracking active stacks. (start-stack): Implement using syntax-rules.
This commit is contained in:
parent
5c606217a4
commit
a6cd355510
5 changed files with 15 additions and 20 deletions
|
@ -1022,8 +1022,20 @@ If there is no handler at all, Guile prints an error and then exits."
|
|||
;;; {The interpreter stack}
|
||||
;;;
|
||||
|
||||
(defmacro start-stack (tag exp)
|
||||
`(%start-stack ,tag (lambda () ,exp)))
|
||||
(define %stacks (make-fluid))
|
||||
(define (%start-stack tag thunk)
|
||||
(let ((prompt-tag (gensym)))
|
||||
(prompt prompt-tag
|
||||
(lambda ()
|
||||
(with-fluids ((%stacks (acons tag prompt-tag
|
||||
(or (fluid-ref %stacks) '()))))
|
||||
(thunk)))
|
||||
(lambda (k . args)
|
||||
(%start-stack tag (lambda () (apply k args)))))))
|
||||
(define-syntax start-stack
|
||||
(syntax-rules ()
|
||||
((_ tag exp)
|
||||
(%start-stack tag (lambda () exp)))))
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue