sqaush! rdelim
* mes/module/mes/guile.mes (read-line): Move to ... * mes/module/ice-9/rdelim.scm (read-line): ...here.
This commit is contained in:
parent
842d9b7978
commit
bc1a687703
|
@ -16,4 +16,18 @@
|
|||
;;; You should have received a copy of the GNU General Public License
|
||||
;;; along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (ice-9 rdelim))
|
||||
(define-module (ice-9 rdelim)
|
||||
#:export (read-line))
|
||||
|
||||
(define (read-line . rest)
|
||||
(let* ((port (if (pair? rest) (car rest) (current-input-port)))
|
||||
(handle-delim (if (and (pair? rest) (pair? (cdr rest))) (cadr rest) 'trim))
|
||||
(c (read-char port)))
|
||||
(if (eof-object? c) c
|
||||
(list->string
|
||||
(let loop ((c c))
|
||||
(if (or (eof-object? c) (eq? c #\newline)) (case handle-delim
|
||||
((trim) '())
|
||||
((concat) '(#\newline))
|
||||
(else (error (format #f "not supported: handle-delim=~a" handle-delim))))
|
||||
(cons c (loop (read-char port)))))))))
|
||||
|
|
|
@ -66,19 +66,6 @@
|
|||
|
||||
(define (drain-input port) (read-string))
|
||||
|
||||
(define (read-line . rest)
|
||||
(let* ((port (if (pair? rest) (car rest) (current-input-port)))
|
||||
(handle-delim (if (and (pair? rest) (pair? (cdr rest))) (cadr rest) 'trim))
|
||||
(c (read-char port)))
|
||||
(if (eof-object? c) c
|
||||
(list->string
|
||||
(let loop ((c c))
|
||||
(if (or (eof-object? c) (eq? c #\newline)) (case handle-delim
|
||||
((trim) '())
|
||||
((concat) '(#\newline))
|
||||
(else (error (format #f "not supported: handle-delim=~a" handle-delim))))
|
||||
(cons c (loop (read-char port)))))))))
|
||||
|
||||
(define (object->string x . rest)
|
||||
(with-output-to-string
|
||||
(lambda () ((if (pair? rest) (car rest) write) x))))
|
||||
|
|
Loading…
Reference in New Issue