1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-06 12:10:28 +02:00

(top-repl): Revert part of the 2001-05-19 change.

When defining the guile-user module, do not use any modules.  Add
them to guile-user when `top-repl' is called.
This commit is contained in:
Marius Vollmer 2001-06-01 14:01:27 +00:00
parent ee2718a9ec
commit 615bfe7277

View file

@ -2838,59 +2838,77 @@
(lambda (v) (fluid-set! using-readline? v))))) (lambda (v) (fluid-set! using-readline? v)))))
(define (top-repl) (define (top-repl)
(let ((guile-user-module (resolve-module '(guile-user))))
;; Load emacs interface support if emacs option is given. ;; Load emacs interface support if emacs option is given.
(if (and (module-defined? the-root-module 'use-emacs-interface) (if (and (module-defined? the-root-module 'use-emacs-interface)
(module-ref the-root-module 'use-emacs-interface)) (module-ref the-root-module 'use-emacs-interface))
(load-emacs-interface)) (load-emacs-interface))
(let ((old-handlers #f) ;; Use some convenient modules (in reverse order)
(signals (if (provided? 'posix)
`((,SIGINT . "User interrupt") (if (provided? 'regex)
(,SIGFPE . "Arithmetic error") (module-use! guile-user-module (resolve-module '(ice-9 regex))))
(,SIGBUS . "Bad memory access (bus error)") (if (provided? 'threads)
(,SIGSEGV . (module-use! guile-user-module (resolve-module '(ice-9 threads))))
"Bad memory access (Segmentation violation)")) ;; load debugger on demand
'()))) (module-use! guile-user-module
(make-autoload-interface guile-user-module
'(ice-9 debugger) '(debug)))
(module-use! guile-user-module (resolve-module '(ice-9 session)))
(module-use! guile-user-module (resolve-module '(ice-9 debug)))
;; so that builtin bindings will be checked first
(module-use! guile-user-module (resolve-module '(guile)))
(dynamic-wind (set-current-module guile-user-module)
;; call at entry (let ((old-handlers #f)
(lambda () (signals (if (provided? 'posix)
(let ((make-handler (lambda (msg) `((,SIGINT . "User interrupt")
(lambda (sig) (,SIGFPE . "Arithmetic error")
;; Make a backup copy of the stack (,SIGBUS . "Bad memory access (bus error)")
(fluid-set! before-signal-stack (,SIGSEGV
(fluid-ref the-last-stack)) . "Bad memory access (Segmentation violation)"))
(save-stack %deliver-signals) '())))
(scm-error 'signal
#f
msg
#f
(list sig))))))
(set! old-handlers
(map (lambda (sig-msg)
(sigaction (car sig-msg)
(make-handler (cdr sig-msg))))
signals))))
;; the protected thunk. (dynamic-wind
(lambda ()
(let ((status (scm-style-repl)))
(run-hook exit-hook)
status))
;; call at exit. ;; call at entry
(lambda () (lambda ()
(map (lambda (sig-msg old-handler) (let ((make-handler (lambda (msg)
(if (not (car old-handler)) (lambda (sig)
;; restore original C handler. ;; Make a backup copy of the stack
(sigaction (car sig-msg) #f) (fluid-set! before-signal-stack
;; restore Scheme handler, SIG_IGN or SIG_DFL. (fluid-ref the-last-stack))
(sigaction (car sig-msg) (save-stack %deliver-signals)
(car old-handler) (scm-error 'signal
(cdr old-handler)))) #f
signals old-handlers))))) msg
#f
(list sig))))))
(set! old-handlers
(map (lambda (sig-msg)
(sigaction (car sig-msg)
(make-handler (cdr sig-msg))))
signals))))
;; the protected thunk.
(lambda ()
(let ((status (scm-style-repl)))
(run-hook exit-hook)
status))
;; call at exit.
(lambda ()
(map (lambda (sig-msg old-handler)
(if (not (car old-handler))
;; restore original C handler.
(sigaction (car sig-msg) #f)
;; restore Scheme handler, SIG_IGN or SIG_DFL.
(sigaction (car sig-msg)
(car old-handler)
(cdr old-handler))))
signals old-handlers))))))
(defmacro false-if-exception (expr) (defmacro false-if-exception (expr)
`(catch #t (lambda () ,expr) `(catch #t (lambda () ,expr)
@ -2905,15 +2923,6 @@
;; Place the user in the guile-user module. ;; Place the user in the guile-user module.
;; ;;
(define-module (guile-user) (define-module (guile-user))
:use-module (guile) ;so that bindings will be checked here first
:use-module (ice-9 session)
:use-module (ice-9 debug)
:autoload (ice-9 debugger) (debug)) ;load debugger on demand
(if (provided? 'threads)
(use-modules (ice-9 threads)))
(if (provided? 'regex)
(use-modules (ice-9 regex)))
;;; boot-9.scm ends here ;;; boot-9.scm ends here