1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 13:30:26 +02:00

Move false-if-exception down in boot-9

* module/ice-9/boot-9.scm (false-if-exception): Move down.
This commit is contained in:
Andy Wingo 2019-11-07 15:07:14 +01:00
parent 9835ed1809
commit f9b594c482

View file

@ -1067,26 +1067,6 @@ VALUE."
(define call/cc call-with-current-continuation)
(define-syntax false-if-exception
(syntax-rules ()
((false-if-exception expr)
(catch #t
(lambda () expr)
(lambda args #f)))
((false-if-exception expr #:warning template arg ...)
(catch #t
(lambda () expr)
(lambda (key . args)
(for-each (lambda (s)
(if (not (string-null? s))
(format (current-warning-port) ";;; ~a\n" s)))
(string-split
(call-with-output-string
(lambda (port)
(format port template arg ...)
(print-exception port #f key args)))
#\newline))
#f)))))
@ -1843,6 +1823,33 @@ written into the port is returned."
file-name-separator-string)
file)))
;;; {Exception-handling helpers}
(define-syntax false-if-exception
(syntax-rules ()
((false-if-exception expr)
(catch #t
(lambda () expr)
(lambda args #f)))
((false-if-exception expr #:warning template arg ...)
(catch #t
(lambda () expr)
(lambda (key . args)
(for-each (lambda (s)
(if (not (string-null? s))
(format (current-warning-port) ";;; ~a\n" s)))
(string-split
(call-with-output-string
(lambda (port)
(format port template arg ...)
(print-exception port #f key args)))
#\newline))
#f)))))
;;; {Help for scm_shell}