mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 06:41:13 +02:00
format's first arg is "destination"
* module/ice-9/format.scm: The argument to format is "destination", not "port". Fix this newly reintroduced buglet.
This commit is contained in:
parent
3d56118c50
commit
f02f8a6174
1 changed files with 18 additions and 18 deletions
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
;;; End of configuration ----------------------------------------------------
|
;;; End of configuration ----------------------------------------------------
|
||||||
|
|
||||||
(define (format port format-string . args)
|
(define (format destination format-string . args)
|
||||||
(define format:version "3.0")
|
(define format:version "3.0")
|
||||||
(define format:port #f) ; curr. format output port
|
(define format:port #f) ; curr. format output port
|
||||||
(define format:output-col 0) ; curr. format output tty column
|
(define format:output-col 0) ; curr. format output tty column
|
||||||
|
@ -1606,43 +1606,43 @@
|
||||||
(set! format:fn-str (make-string format:fn-max)) ; number buffer
|
(set! format:fn-str (make-string format:fn-max)) ; number buffer
|
||||||
(set! format:en-str (make-string format:en-max)) ; exponent buffer
|
(set! format:en-str (make-string format:en-max)) ; exponent buffer
|
||||||
|
|
||||||
(set! format:args (cons* port format-string args))
|
(set! format:args (cons* destination format-string args))
|
||||||
(set! format:arg-pos 0)
|
(set! format:arg-pos 0)
|
||||||
(set! format:pos 0)
|
(set! format:pos 0)
|
||||||
|
|
||||||
(cond
|
(cond
|
||||||
((or (and (boolean? port) ; port output
|
((or (and (boolean? destination) ; port output
|
||||||
port)
|
destination)
|
||||||
(output-port? port))
|
(output-port? destination))
|
||||||
(format:out (cond
|
(format:out (cond
|
||||||
((boolean? port) (current-output-port))
|
((boolean? destination) (current-output-port))
|
||||||
((output-port? port) port)
|
((output-port? destination) destination)
|
||||||
((number? port) (current-error-port)))
|
((number? destination) (current-error-port)))
|
||||||
format-string args))
|
format-string args))
|
||||||
((number? port)
|
((number? destination)
|
||||||
(issue-deprecation-warning
|
(issue-deprecation-warning
|
||||||
"Passing a number to format as the port is deprecated."
|
"Passing a number to format as the port is deprecated."
|
||||||
"Pass (current-error-port) instead.")
|
"Pass (current-error-port) instead.")
|
||||||
(format:out (current-error-port) format-string args))
|
(format:out (current-error-port) format-string args))
|
||||||
((and (boolean? port) ; string output
|
((and (boolean? destination) ; string output
|
||||||
(not port))
|
(not destination))
|
||||||
(call-with-output-string
|
(call-with-output-string
|
||||||
(lambda (port) (format:out port format-string args))))
|
(lambda (port) (format:out port format-string args))))
|
||||||
(else
|
(else
|
||||||
(format:error "bad destination `~a'" port))))
|
(format:error "bad destination `~a'" destination))))
|
||||||
|
|
||||||
(begin-deprecated
|
(begin-deprecated
|
||||||
(set! format
|
(set! format
|
||||||
(let ((format format))
|
(let ((format format))
|
||||||
(case-lambda
|
(case-lambda
|
||||||
((port format-string . args)
|
((destination format-string . args)
|
||||||
(if (string? port)
|
(if (string? destination)
|
||||||
(begin
|
(begin
|
||||||
(issue-deprecation-warning
|
(issue-deprecation-warning
|
||||||
"Omitting the destination port on a call to format is deprecated."
|
"Omitting the destination on a call to format is deprecated."
|
||||||
"Pass #f as the destination port, before the format string.")
|
"Pass #f as the destination, before the format string.")
|
||||||
(apply format #f port format-string args))
|
(apply format #f destination format-string args))
|
||||||
(apply format port format-string args)))
|
(apply format destination format-string args)))
|
||||||
((deprecated-format-string-only)
|
((deprecated-format-string-only)
|
||||||
(issue-deprecation-warning
|
(issue-deprecation-warning
|
||||||
"Omitting the destination port on a call to format is deprecated."
|
"Omitting the destination port on a call to format is deprecated."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue