(top-repl): Revert part of the 2001-05-19 change.
authorMarius Vollmer <mvo@zagadka.de>
Fri, 1 Jun 2001 14:01:27 +0000 (14:01 +0000)
committerMarius Vollmer <mvo@zagadka.de>
Fri, 1 Jun 2001 14:01:27 +0000 (14:01 +0000)
When defining the guile-user module, do not use any modules.  Add
them to guile-user when `top-repl' is called.

ice-9/boot-9.scm

index 4c4f0a9..f4089c8 100644 (file)
       (lambda (v) (fluid-set! using-readline? v)))))
 
 (define (top-repl)
-
-  ;; Load emacs interface support if emacs option is given.
-  (if (and (module-defined? the-root-module 'use-emacs-interface)
-          (module-ref the-root-module 'use-emacs-interface))
-      (load-emacs-interface))
-
-  (let ((old-handlers #f)
-       (signals (if (provided? 'posix)
-                    `((,SIGINT . "User interrupt")
-                      (,SIGFPE . "Arithmetic error")
-                      (,SIGBUS . "Bad memory access (bus error)")
-                      (,SIGSEGV .
-                                "Bad memory access (Segmentation violation)"))
-                    '())))
-
-    (dynamic-wind
-
-     ;; call at entry
-     (lambda ()
-       (let ((make-handler (lambda (msg)
-                            (lambda (sig)
-                              ;; Make a backup copy of the stack
-                              (fluid-set! before-signal-stack
-                                          (fluid-ref the-last-stack))
-                              (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.
-     (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)))))
+  (let ((guile-user-module (resolve-module '(guile-user))))
+
+    ;; Load emacs interface support if emacs option is given.
+    (if (and (module-defined? the-root-module 'use-emacs-interface)
+            (module-ref the-root-module 'use-emacs-interface))
+       (load-emacs-interface))
+
+    ;; Use some convenient modules (in reverse order)
+    
+    (if (provided? 'regex)
+       (module-use! guile-user-module (resolve-module '(ice-9 regex))))
+    (if (provided? 'threads)
+       (module-use! guile-user-module (resolve-module '(ice-9 threads))))
+    ;; 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))) 
+
+    (set-current-module guile-user-module)
+
+    (let ((old-handlers #f)
+         (signals (if (provided? 'posix)
+                      `((,SIGINT . "User interrupt")
+                        (,SIGFPE . "Arithmetic error")
+                        (,SIGBUS . "Bad memory access (bus error)")
+                        (,SIGSEGV
+                         . "Bad memory access (Segmentation violation)"))
+                      '())))
+
+      (dynamic-wind
+
+         ;; call at entry
+         (lambda ()
+           (let ((make-handler (lambda (msg)
+                                 (lambda (sig)
+                                   ;; Make a backup copy of the stack
+                                   (fluid-set! before-signal-stack
+                                               (fluid-ref the-last-stack))
+                                   (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.
+         (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)
   `(catch #t (lambda () ,expr)
 
 ;; Place the user in the guile-user module.
 ;;
-(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)))
+(define-module (guile-user))
 
 ;;; boot-9.scm ends here