~ chicken-core (chicken-5) b17e47253eb8f05114ae5dbfa9bd30e758e9fd4f
commit b17e47253eb8f05114ae5dbfa9bd30e758e9fd4f
Author: Evan Hanson <evhan@foldling.org>
AuthorDate: Thu Jan 14 00:12:31 2016 +1300
Commit: Evan Hanson <evhan@foldling.org>
CommitDate: Tue Mar 8 22:52:33 2016 +1300
Remove scan-input-lines from unit utils
It's now available as an extension, instead.
Also, fix a missing dependency on ports in runbench.sh.
diff --git a/NEWS b/NEWS
index b088d390..c5cd6bfa 100644
--- a/NEWS
+++ b/NEWS
@@ -14,8 +14,8 @@
- Core libraries
- Removed support for memory-mapped files (posix), queues (data-structures),
- binary-search (data-structures) and object-eviction (lolevel). These
- are now available as eggs.
+ binary-search (data-structures), scan-input-lines (utils), and
+ object-eviction (lolevel). These are now available as eggs.
- Removed the srfi-1, srfi-13, srfi-14, srfi-18 and srfi-69 units.
These are now available as eggs.
- Added the `executable-pathname` procedure for retrieving a path to
diff --git a/manual/Unit utils b/manual/Unit utils
index ccccd1ab..64d9ade0 100644
--- a/manual/Unit utils
+++ b/manual/Unit utils
@@ -81,20 +81,6 @@ A parameter that holds a list of default options that should be given
to {{csc}} after invocation of the {{compile-file}} procedure.
The initial default options are {{-O2 -d2}}.
-=== Scanning through an input port
-
-==== scan-input-lines
-
-<procedure>(scan-input-lines REGEXP [PORT])</procedure>
-
-Reads lines from {{PORT}} (defaults to the result of {{(current-input-port)}})
-using {{read-line}} and returns the result of {{(irregex-search REGEXP LINE)}},
-if the match succeeds. If no match could be found, {{#f}} is returned.
-
-{{REGEXP}} may also be a procedure of one argument which is called for each
-input line and should return a non-false value on success, which will then
-be the result of the call to {{scan-input-lines}}.
-
=== Asking the user for confirmation
diff --git a/tests/sgrep.scm b/tests/sgrep.scm
index ebd8c51a..6dc442f1 100644
--- a/tests/sgrep.scm
+++ b/tests/sgrep.scm
@@ -1,7 +1,7 @@
;;;; sgrep.scm - grepping benchmark
-(use irregex extras utils posix)
+(use irregex extras utils ports)
(define big-string
@@ -17,14 +17,12 @@
(lambda ()
(let ((h 0)
(c 0))
- (scan-input-lines
- (lambda (line)
- (set! c (fx+ c 1))
- ;(when (zero? (fxmod c 500)) (print* "."))
- (when (irregex-search expr line)
- (set! h (fx+ h 1)))
- #f))
- ;(newline)
+ (do ((line (read-line) (read-line)))
+ ((eof-object? line))
+ (set! c (fx+ c 1))
+ ;(when (zero? (fxmod c 500)) (print* "."))
+ (when (irregex-search expr line)
+ (set! h (fx+ h 1))))
h))))))))
(define-syntax rx1
diff --git a/types.db b/types.db
index 606c4109..b751058e 100644
--- a/types.db
+++ b/types.db
@@ -2258,5 +2258,4 @@
(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)))
(chicken.utils#compile-file-options (#(procedure #:clean #:enforce) chicken.utils#compile-file-options (#!optional (list-of string)) (list-of string)))
-(chicken.utils#scan-input-lines (#(procedure #:enforce) chicken.utils#scan-input-lines (* #!optional input-port) *))
(chicken.utils#yes-or-no? (#(procedure #:enforce) chicken.utils#yes-or-no? (string #!rest) *))
diff --git a/utils.scm b/utils.scm
index 5caf2898..985296a3 100644
--- a/utils.scm
+++ b/utils.scm
@@ -35,7 +35,6 @@
(compile-file
compile-file-options
read-all
- scan-input-lines
system*
yes-or-no?
qs)
@@ -127,20 +126,6 @@
(else #f)))))))
-;;; Scan lines until regex or predicate matches
-
-(define scan-input-lines
- (lambda (rx #!optional (port ##sys#standard-input))
- (let ((rx (if (procedure? rx)
- rx
- (cute irregex-search (irregex rx) <>))))
- (let loop ()
- (let ((ln (read-line port)))
- (and (not (eof-object? ln))
- (or (rx ln)
- (loop))))))))
-
-
;; Ask for confirmation
#>
Trap