From 4fe1da791cc1bd7ae69a3031ebfa9d2364110ee4 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 12 Nov 2008 03:25:24 +0000 Subject: [PATCH] display-list[-to-file] to display-lines[-to-file] svn: r12402 --- collects/scheme/file.ss | 18 +++++++++--------- collects/scheme/port.ss | 8 ++++---- .../scribblings/reference/filesystem.scrbl | 4 ++-- collects/scribblings/reference/port-lib.scrbl | 6 +++--- collects/tests/mzscheme/filelib.ss | 14 +++++++------- collects/tests/mzscheme/portlib.ss | 4 ++-- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/collects/scheme/file.ss b/collects/scheme/file.ss index fd670562d4..aff7714760 100644 --- a/collects/scheme/file.ss +++ b/collects/scheme/file.ss @@ -19,7 +19,7 @@ file->bytes-lines display-to-file write-to-file - display-list-to-file) + display-lines-to-file) (require "private/portlines.ss") @@ -420,17 +420,17 @@ (->file 'display-to-file f mode exists (lambda (p) (display s p)))) (define (write-to-file s f - #:mode [mode 'binary] - #:exists [exists 'error]) + #:mode [mode 'binary] + #:exists [exists 'error]) (->file 'write-to-file f mode exists (lambda (p) (write s p)))) -(define (display-list-to-file l f - #:mode [mode 'binary] - #:exists [exists 'error] - #:separator [newline #"\n"]) +(define (display-lines-to-file l f + #:mode [mode 'binary] + #:exists [exists 'error] + #:separator [newline #"\n"]) (unless (list? l) - (raise-type-error 'display-list-to-file "list" l)) - (->file 'display-list-to-file f mode exists + (raise-type-error 'display-lines-to-file "list" l)) + (->file 'display-lines-to-file f mode exists (lambda (p) (do-lines->port l p newline)))) diff --git a/collects/scheme/port.ss b/collects/scheme/port.ss index 30a4f85e8b..6da4408f75 100644 --- a/collects/scheme/port.ss +++ b/collects/scheme/port.ss @@ -8,7 +8,7 @@ port->bytes port->lines port->bytes-lines - display-list) + display-lines) (define (port->string-port who p) (unless (input-port? p) @@ -29,9 +29,9 @@ (define (port->bytes-lines [p (current-input-port)] #:line-mode [mode 'any]) (port->x-lines 'port->bytes-lines p mode read-bytes-line)) - (define (display-list l [p (current-output-port)] #:separator [newline #"\n"]) + (define (display-lines l [p (current-output-port)] #:separator [newline #"\n"]) (unless (list? l) - (raise-type-error 'display-list "list" l)) + (raise-type-error 'display-lines "list" l)) (unless (output-port? p) - (raise-type-error 'display-list "output-port" p)) + (raise-type-error 'display-lines "output-port" p)) (do-lines->port l p newline))) diff --git a/collects/scribblings/reference/filesystem.scrbl b/collects/scribblings/reference/filesystem.scrbl index 76f590f2f3..20c6fba204 100644 --- a/collects/scribblings/reference/filesystem.scrbl +++ b/collects/scribblings/reference/filesystem.scrbl @@ -599,8 +599,8 @@ Uses @scheme[display] to print @scheme[v] to @scheme[path]. The @scheme[mode-fla Like @scheme[display-to-file], but using @scheme[write] instead of @scheme[display].} -@defproc[(display-list-to-file [lst list?] - [path path-string?] +@defproc[(display-lines-to-file [lst list?] + [path path-string?] [#:separator separator any/c #"\n"] [#:mode mode-flag (or/c 'binary 'text) 'binary] [#:exists exists-flag (or/c 'error 'append 'update diff --git a/collects/scribblings/reference/port-lib.scrbl b/collects/scribblings/reference/port-lib.scrbl index 104b9792c0..3bb948465b 100644 --- a/collects/scribblings/reference/port-lib.scrbl +++ b/collects/scribblings/reference/port-lib.scrbl @@ -34,9 +34,9 @@ Read all characters from @scheme[in], breaking them into lines. The Like @scheme[port->lines], but reading bytes and collecting them into lines like @scheme[read-bytes-line].} -@defproc[(display-list [lst list?] - [out output-port? (current-output-port)] - [#:separator separator any/c #"\n"]) +@defproc[(display-lines [lst list?] + [out output-port? (current-output-port)] + [#:separator separator any/c #"\n"]) void?]{ Use @scheme[display] to each each element of @scheme[lst] to @scheme[out], adding diff --git a/collects/tests/mzscheme/filelib.ss b/collects/tests/mzscheme/filelib.ss index 1fcb9f456b..f1f66cdb2d 100644 --- a/collects/tests/mzscheme/filelib.ss +++ b/collects/tests/mzscheme/filelib.ss @@ -9,7 +9,7 @@ (define tmp-name "tmp0-filelib") (when (file-exists? tmp-name) (delete-file tmp-name)) -(display-list-to-file '("a" "b" "c") tmp-name #:separator #"\r\n" #:mode 'binary) +(display-lines-to-file '("a" "b" "c") tmp-name #:separator #"\r\n" #:mode 'binary) (test "a\r\nb\r\nc\r\n" file->string tmp-name #:mode 'binary) (test #"a\r\nb\r\nc\r\n" file->bytes tmp-name) (test '("a" "b" "c") file->lines tmp-name) @@ -36,9 +36,9 @@ (err/rt-chk-test (file->string "x" #:mode 'other)) (err/rt-chk-test (file->bytes "x" #:mode 'other)) (err/rt-chk-test (file->value "x" #:mode 'other)) -(err/rt-chk-test (display-list-to-file 10 "x")) -(err/rt-chk-test (display-list-to-file '(10) "x" #:mode 'other)) -(err/rt-chk-test (display-list-to-file '(10) "x" #:exists 'other)) +(err/rt-chk-test (display-lines-to-file 10 "x")) +(err/rt-chk-test (display-lines-to-file '(10) "x" #:mode 'other)) +(err/rt-chk-test (display-lines-to-file '(10) "x" #:exists 'other)) (err/rt-chk-test (file->lines "x" #:line-mode 'junk)) (err/rt-chk-test (file->lines "x" #:mode 'other)) (err/rt-chk-test (file->bytes-lines "x" #:line-mode 'junk)) @@ -47,9 +47,9 @@ (err/rt-chk-test (display-to-file "y" "x" #:mode 'other)) (err/rt-chk-test (write-to-file #"y" "x" #:exists 'other)) (err/rt-chk-test (write-to-file #"y" "x" #:mode 'other)) -(err/rt-chk-test (display-list-to-file 'y "x")) -(err/rt-chk-test (display-list-to-file '(y) "x" #:exists 'other)) -(err/rt-chk-test (display-list-to-file '(y) "x" #:mode 'other)) +(err/rt-chk-test (display-lines-to-file 'y "x")) +(err/rt-chk-test (display-lines-to-file '(y) "x" #:exists 'other)) +(err/rt-chk-test (display-lines-to-file '(y) "x" #:mode 'other)) ;; ---------------------------------------- diff --git a/collects/tests/mzscheme/portlib.ss b/collects/tests/mzscheme/portlib.ss index 5e7fcf2113..6bd7dad3e3 100644 --- a/collects/tests/mzscheme/portlib.ss +++ b/collects/tests/mzscheme/portlib.ss @@ -25,10 +25,10 @@ (test (string-length x) 'long-string (bytes-length (port->bytes (p))))) (let ([p (open-output-bytes)]) - (display-list '(1 2 3) p) + (display-lines '(1 2 3) p) (test "1\n2\n3\n" get-output-string p)) (let ([p (open-output-bytes)]) - (display-list '(1 2 3) p #:separator #"!!") + (display-lines '(1 2 3) p #:separator #"!!") (test "1!!2!!3!!" get-output-string p)) ;; ----------------------------------------