From 4c43806dd76cec18f41b07df2fee2eb6e32d2f30 Mon Sep 17 00:00:00 2001 From: felix Date: Fri, 27 Oct 2017 10:18:38 +0200 Subject: [PATCH] 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. --- NEWS | 1 + chicken-install.scm | 8 ++++---- core.scm | 2 +- extras.scm | 6 +++--- scrutinizer.scm | 2 +- support.scm | 9 ++++++++- types.db | 2 +- 7 files changed, 19 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index c14fea4..2702cb3 100644 --- a/NEWS +++ b/NEWS @@ -62,6 +62,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 0162feb..e50ed87 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 5fff8df..67bf2eb 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 7c148cd..5c99860 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 90afe0f..074681f 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 9d00b37..517a1e5 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) (stringstring 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 aff01fc..321e8ef 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))) -- 1.7.9.5