1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-22 04:30:19 +02:00

* boot-9.scm (error-catching-loop thunk): use a status variable to

return the quit args.
(scm-style-repl): call -quit, passing return value from
error-catching-repl.  Make -quit return its args.
stand-along-repl: comment out, since it seems unused.
(top-repl): convert the value returned by scm-style-repl to
an integer and return it.

(error-catching-loop thunk): discard trailing junk after a (quit).
This commit is contained in:
Gary Houston 1997-03-02 06:09:41 +00:00
parent e6aa2a8a24
commit 8e44e7a0c7
3 changed files with 100 additions and 69 deletions

View file

@ -1,3 +1,15 @@
Sun Mar 2 05:25:11 1997 Gary Houston <ghouston@actrix.gen.nz>
* boot-9.scm (error-catching-loop thunk): use a status variable to
return the quit args.
(scm-style-repl): call -quit, passing return value from
error-catching-repl. Make -quit return its args.
stand-along-repl: comment out, since it seems unused.
(top-repl): convert the value returned by scm-style-repl to
an integer and return it.
(error-catching-loop thunk): discard trailing junk after a (quit).
Sat Mar 1 15:24:39 1997 Mikael Djurfeldt <mdj@mdj.nada.kth.se> Sat Mar 1 15:24:39 1997 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
* boot-9.scm: Removed the old printer code. * boot-9.scm: Removed the old printer code.

View file

@ -37,11 +37,11 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@ transform = @program_transform_name@
VERSION = @VERSION@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
module = @module@
PACKAGE = @PACKAGE@
MAINT = @MAINT@ MAINT = @MAINT@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
PACKAGE = @PACKAGE@
VERSION = @VERSION@
module = @module@
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign

View file

@ -2058,6 +2058,7 @@
(define abort-hook '()) (define abort-hook '())
(define (error-catching-loop thunk) (define (error-catching-loop thunk)
(let ((status #f))
(define (loop first) (define (loop first)
(let ((next (let ((next
(catch #t (catch #t
@ -2070,8 +2071,10 @@
(lambda () (lambda ()
(first) (first)
;; This line is needed because mark doesn't do closures quite right. ;; This line is needed because mark
;; Unreferenced locals should be collected. ;; doesn't do closures quite right.
;; Unreferenced locals should be
;; collected.
;; ;;
(set! first #f) (set! first #f)
(let loop ((v (thunk))) (let loop ((v (thunk)))
@ -2084,7 +2087,9 @@
(lambda (key . args) (lambda (key . args)
(case key (case key
((quit) ((quit)
(read-line) ; discard trailing junk and linefeed.
(force-output) (force-output)
(set! status args)
#f) #f)
((switch-repl) ((switch-repl)
@ -2101,11 +2106,14 @@
(write args (current-error-port)) (write args (current-error-port))
(newline (current-error-port)) (newline (current-error-port))
(if (and (not has-shown-debugger-hint?) (if (and (not has-shown-debugger-hint?)
(not (memq 'backtrace (debug-options-interface))) (not (memq 'backtrace
(debug-options-interface)))
(stack? the-last-stack)) (stack? the-last-stack))
(begin (begin
(newline (current-error-port)) (newline (current-error-port))
(display "Type \"(backtrace)\" to get more information.\n" (current-error-port)) (display
"Type \"(backtrace)\" to get more information.\n"
(current-error-port))
(set! has-shown-debugger-hint? #t))) (set! has-shown-debugger-hint? #t)))
(set! stack-saved? #f))) (set! stack-saved? #f)))
@ -2116,8 +2124,8 @@
(apply handle-system-error key args)) (apply handle-system-error key args))
(else (else
(apply bad-throw key args)))))))))) (apply bad-throw key args))))))))))
(and next (loop next)))) (if next (loop next) status)))
(loop (lambda () #t))) (loop (lambda () #t))))
;;(define the-last-stack #f) Defined by scm_init_backtrace () ;;(define the-last-stack #f) Defined by scm_init_backtrace ()
(define stack-saved? #f) (define stack-saved? #f)
@ -2252,13 +2260,13 @@
(repl-report)) (repl-report))
(force-output))))) (force-output)))))
(-quit (lambda () (-quit (lambda (args)
(if scm-repl-verbose (if scm-repl-verbose
(begin (begin
(display ";;; QUIT executed, repl exitting") (display ";;; QUIT executed, repl exitting")
(newline) (newline)
(repl-report))) (repl-report)))
#t)) args))
(-abort (lambda () (-abort (lambda ()
(if scm-repl-verbose (if scm-repl-verbose
@ -2268,15 +2276,17 @@
(repl-report))) (repl-report)))
(repl -read -eval -print)))) (repl -read -eval -print))))
(error-catching-repl -read (let ((status (error-catching-repl -read
-eval -eval
-print))) -print)))
(-quit status))))
(define (stand-alone-repl)
(let ((oport (current-input-port))) ;(define (stand-alone-repl)
(set-current-input-port *stdin*) ; (let ((oport (current-input-port)))
(scm-style-repl) ; (set-current-input-port *stdin*)
(set-current-input-port oport))) ; (scm-style-repl)
; (set-current-input-port oport)))
@ -2444,7 +2454,16 @@
;; (set-current-output-port outp) ;; (set-current-output-port outp)
;; (set-current-error-port errp) ;; (set-current-error-port errp)
(define (top-repl) (scm-style-repl)) (define (top-repl)
;; scm-style-repl returns the list of arguments from quit: convert to
;; an integer status and return.
(let ((quit-args (scm-style-repl)))
(if (null? quit-args)
0
(let ((cqa (car quit-args)))
(cond ((number? cqa) cqa)
((eq? cqa #f) 1)
(else 0))))))
(defmacro false-if-exception (expr) (defmacro false-if-exception (expr)
`(catch #t (lambda () ,expr) `(catch #t (lambda () ,expr)