~ chicken-core (chicken-5) 93d97a11067af69b18b345f5ed29a8d8603b075c
commit 93d97a11067af69b18b345f5ed29a8d8603b075c Author: Evan Hanson <evhan@foldling.org> AuthorDate: Mon Jan 18 23:36:24 2016 +1300 Commit: Evan Hanson <evhan@foldling.org> CommitDate: Tue Mar 8 22:52:33 2016 +1300 Drop `read-all` from unit utils diff --git a/chicken-bug.scm b/chicken-bug.scm index 7bc302cd..2c8ffeef 100644 --- a/chicken-bug.scm +++ b/chicken-bug.scm @@ -70,13 +70,13 @@ (print "\n\nchicken-config.h:\n") (with-input-from-file (make-pathname +c-include-path+ "chicken-config.h") (lambda () - (display (read-all)) ) ) + (display (read-string)))) (newline) (when (and (string=? +cc+ "gcc") (feature? 'unix)) (print "CC seems to be gcc, trying to obtain version...\n") (with-input-from-pipe "gcc -v 2>&1" (lambda () - (display (read-all))))) + (display (read-string))))) (newline) ) (define (usage code) @@ -136,7 +136,7 @@ EOF (string-append msg "\n\nFile added: " arg "\n\n" - (read-all arg) ) ) ) ) ) + (with-input-from-file arg read-string)))))) args) (unless files (set! msg (string-append msg "\n\n" (user-input)))) diff --git a/manual/Unit utils b/manual/Unit utils index 64d9ade0..d4a63d2e 100644 --- a/manual/Unit utils +++ b/manual/Unit utils @@ -21,17 +21,6 @@ Similar to {{(system (sprintf FORMATSTRING ARGUMENT1 ...))}}, but signals an error should the invoked program return a nonzero exit status. -=== Reading a file's contents - -==== read-all - -<procedure>(read-all [FILE-OR-PORT])</procedure> - -If {{FILE-OR-PORT}} is a string, then this procedure returns the contents of the file -as a string. If {{FILE-OR-PORT}} is a port, all remaining input is read and returned as -a string. The port is not closed. If no argument is provided, input will be read from the -port that is the current value of {{(current-input-port)}}. - === Shell argument quoting diff --git a/scripts/mini-salmonella.scm b/scripts/mini-salmonella.scm index 3ebff2b0..4bd62a57 100644 --- a/scripts/mini-salmonella.scm +++ b/scripts/mini-salmonella.scm @@ -76,7 +76,7 @@ (on-exit (lambda () (delete-file* *tmplogfile*))) (define (copy-log egg file) - (let ((log (read-all file))) + (let ((log (with-input-from-file file read-string))) (with-output-to-file *errlogfile* (lambda () (print #\newline egg #\:) diff --git a/setup-download.scm b/setup-download.scm index 37a9022d..e7204b6a 100644 --- a/setup-download.scm +++ b/setup-download.scm @@ -349,7 +349,7 @@ host port (string-append locn "?list=1") proxy-host proxy-port proxy-user-pass))) - (let ((ls (read-all in))) + (let ((ls (read-string #f in))) (close-input-port in) (close-output-port out) ls)))) diff --git a/tests/port-tests.scm b/tests/port-tests.scm index 2f759b63..3eabf489 100644 --- a/tests/port-tests.scm +++ b/tests/port-tests.scm @@ -96,7 +96,7 @@ EOF (get-output-string out)))) ;; fill buffers -(read-all "compiler.scm") +(with-input-from-file "compiler.scm" read-string) (print "slow...") (time diff --git a/tests/reader-tests.scm b/tests/reader-tests.scm index 7dd5b7cf..89bbf35c 100644 --- a/tests/reader-tests.scm +++ b/tests/reader-tests.scm @@ -1,9 +1,8 @@ ;;;; reader-tests.scm -(use (only io read-line) - (only ports with-input-from-string with-output-to-string) - (only utils read-all)) +(use (only io read-line read-string) + (only ports with-input-from-string with-output-to-string)) (set-sharp-read-syntax! #\& (lambda (p) (read p) (values))) @@ -24,4 +23,4 @@ !! bye (assert (string=? output "hi\nfoo\nbaz\nbye\n")) -(assert (string=? " ." (with-input-from-string "\x20\u0020\U00000020\056" read-all))) +(assert (string=? " ." (with-input-from-string "\x20\u0020\U00000020\056" read-string))) diff --git a/tests/sgrep.scm b/tests/sgrep.scm index 7a3522c6..b99f5dd2 100644 --- a/tests/sgrep.scm +++ b/tests/sgrep.scm @@ -5,7 +5,7 @@ (define big-string - (read-all (optional (command-line-arguments) "compiler.scm"))) + (with-input-from-file (optional (command-line-arguments) "compiler.scm") read-string)) (define-syntax bgrep (syntax-rules () diff --git a/types.db b/types.db index 4fe8c8b9..a7912e03 100644 --- a/types.db +++ b/types.db @@ -2258,7 +2258,6 @@ ;; utils -(chicken.utils#read-all (#(procedure #:enforce) chicken.utils#read-all (#!optional (or input-port string)) string)) (chicken.utils#system* (#(procedure #:clean #:enforce) chicken.utils#system* (string #!rest) undefined)) (chicken.utils#qs (#(procedure #:clean #:enforce) chicken.utils#qs (string) string)) (chicken.utils#compile-file (#(procedure #:clean #:enforce) chicken.utils#compile-file (string #!rest) (or false string))) diff --git a/utils.scm b/utils.scm index c05a81e2..94f4ca69 100644 --- a/utils.scm +++ b/utils.scm @@ -34,7 +34,6 @@ (module chicken.utils (compile-file compile-file-options - read-all system* yes-or-no? qs) @@ -61,15 +60,6 @@ (##sys#error "shell invocation failed with non-zero return status" str n) ) ) ) ) -;;; Read file as string from given filename or port: - -(define (read-all . file) - (let ([file (optional file ##sys#standard-input)]) - (if (port? file) - (read-string #f file) - (with-input-from-file file (cut read-string #f) #:binary) ) ) ) - - ;;; Quote string for shell (define (qs str #!optional (platform (build-platform)))Trap