~ chicken-core (chicken-5) 61c90bffa8512d64e99a28a90a7c3f2518b4d1e6
commit 61c90bffa8512d64e99a28a90a7c3f2518b4d1e6
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Fri Oct 27 10:18:38 2017 +0200
Commit: Peter Bex <peter@more-magic.net>
CommitDate: Sat Oct 28 17:33:17 2017 +0200
Renamed "read-all" to "read-list".
Previously this was called "read-file" and then renamed to "read-all".
As the C4 "read-all" has the same signature as the C5 "read-all", this has
now been renamed to "read-list" to avoid porting pain.
Signed-off-by: Peter Bex <peter@more-magic.net>
diff --git a/NEWS b/NEWS
index a3741145..e8cc5dc4 100644
--- a/NEWS
+++ b/NEWS
@@ -65,6 +65,7 @@
- file-{read,write,execute}-access will now raise an exception when
the file doesn't exist or some other non-access related problem is
detected (fixes #1386, thanks to Vasilij Schneidermann).
+ - `read-file` has been renamed to `read-list`.
- Module system
- The compiler has been modularised, for improved namespacing. This
diff --git a/chicken-install.scm b/chicken-install.scm
index 0162feb7..e50ed870 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -315,7 +315,7 @@
((override)
(set! override
(if (and (pair? (cdr x)) (string? (cadr x)))
- (call-with-input-file (cadr x) read-all)
+ (call-with-input-file (cadr x) read-list)
(cdr x))))
((location)
(set! default-locations
@@ -323,7 +323,7 @@
((hack)
(set! hacks (append hacks (list (eval (cadr x))))))
(else (broken x))))
- (call-with-input-file deff read-all))))))
+ (call-with-input-file deff read-list))))))
;; set variables with HTTP proxy information
@@ -1108,12 +1108,12 @@ EOF
(->string (car p))
(cons (->string (car p))
(cadr p))))
- (with-input-from-file (cadr args) read-all))))
+ (with-input-from-file (cadr args) read-list))))
(loop (cddr args)))
((equal? arg "-override")
(unless (pair? (cdr args)) (usage 1))
(set! override
- (call-with-input-file (cadr args) read-all))
+ (call-with-input-file (cadr args) read-list))
(loop (cddr args)))
;;XXX
diff --git a/core.scm b/core.scm
index 5fff8df5..67bf2eb4 100644
--- a/core.scm
+++ b/core.scm
@@ -585,7 +585,7 @@
(imps (##sys#compiled-module-registration (##sys#current-module)))
(oldimps
(and (file-exists? fname)
- (call-with-input-file fname read-all))))
+ (call-with-input-file fname read-expressions))))
(cond ((equal? imps oldimps)
(when verbose-mode
(print "not generating import library `" fname "' for module `"
diff --git a/extras.scm b/extras.scm
index 7c148cdf..5c998600 100644
--- a/extras.scm
+++ b/extras.scm
@@ -30,7 +30,7 @@
(uses data-structures))
(module chicken.io
- (read-all read-buffered read-byte read-line
+ (read-list read-buffered read-byte read-line
read-lines read-string read-string! read-token
write-byte write-line write-string)
@@ -41,10 +41,10 @@
;;; Read expressions from file:
-(define read-all
+(define read-list
(let ((read read))
(lambda (#!optional (port ##sys#standard-input) (reader read) max)
- (##sys#check-input-port port #t 'read-all)
+ (##sys#check-input-port port #t 'read-list)
(do ((x (reader port) (reader port))
(i 0 (fx+ i 1))
(xs '() (cons x xs)))
diff --git a/scrutinizer.scm b/scrutinizer.scm
index 90afe0fe..074681f1 100644
--- a/scrutinizer.scm
+++ b/scrutinizer.scm
@@ -1770,7 +1770,7 @@
(mark-variable name '##compiler#type-source 'db)
(when specs
(install-specializations name specs)))))
- (call-with-input-file dbfile read-all))
+ (call-with-input-file dbfile read-expressions))
#t)))
(define (emit-type-file source-file type-file db block-compilation)
diff --git a/support.scm b/support.scm
index 9d00b370..517a1e57 100644
--- a/support.scm
+++ b/support.scm
@@ -34,6 +34,7 @@
debugging-chicken with-debugging-output quit-compiling
emit-syntax-trace-info check-signature stringify symbolify
build-lambda-list c-ify-string valid-c-identifier?
+ read-expressions
bytes->words words->bytes
check-and-open-input-file close-checked-input-file fold-inner
constant? collapsable-literal? immediate? basic-literal?
@@ -294,6 +295,12 @@
(define (sort-symbols lst)
(sort lst (lambda (s1 s2) (string<? (symbol->string s1) (symbol->string s2)))))
+(define (read-expressions #!optional (port (current-input-port)))
+ (do ((x (read port) (read port))
+ (i 0 (add1 i))
+ (xs '() (cons x xs)))
+ ((eof-object? x) (reverse xs))))
+
;;; Predicates on expressions and literals:
@@ -1659,7 +1666,7 @@
(##sys#put!
id '##core#db
(append (or (##sys#get id '##core#db) '()) (list (cdr e))) )))
- (call-with-input-file dbfile read-all))))
+ (call-with-input-file dbfile read-expressions))))
;;; Print version/usage information:
diff --git a/types.db b/types.db
index aff01fc7..321e8ef9 100644
--- a/types.db
+++ b/types.db
@@ -1544,7 +1544,7 @@
;; io
-(chicken.io#read-all (#(procedure #:enforce) chicken.io#read-all (#!optional input-port (procedure (input-port) *) fixnum) list))
+(chicken.io#read-list (#(procedure #:enforce) chicken.io#read-list (#!optional input-port (procedure (input-port) *) fixnum) list))
(chicken.io#read-buffered (#(procedure #:enforce) chicken.io#read-buffered (#!optional input-port) string))
(chicken.io#read-byte (#(procedure #:enforce) chicken.io#read-byte (#!optional input-port) *))
(chicken.io#read-line (#(procedure #:enforce) chicken.io#read-line (#!optional input-port (or false fixnum)) (or eof string)))
Trap