(#\&): Use `issue-deprecation-warning' instead of
[bpt/guile.git] / ice-9 / lineio.scm
index 768aaef..25711f8 100644 (file)
@@ -1,6 +1,6 @@
 ;;; installed-scm-file
 
-;;;;   Copyright (C) 1996 Free Software Foundation, Inc.
+;;;;   Copyright (C) 1996, 1998 Free Software Foundation, Inc.
 ;;;; 
 ;;;; This program is free software; you can redistribute it and/or modify
 ;;;; it under the terms of the GNU General Public License as published by
@@ -20,7 +20,8 @@
 
 \f
 
-(define-module #/ice-9/lineio)
+(define-module (ice-9 lineio)
+  :use-module (ice-9 readline))
 
 \f
 ;;; {Line Buffering Input Ports}
 ;;;
 ;;;    read-string     which returns the next line of input
 ;;;    unread-string   which pushes a line back onto the stream
+;;; 
+;;; The implementation of unread-string is kind of limited; it doesn't
+;;; interact properly with unread-char, or any of the other port
+;;; reading functions.  Only read-string will get you back the things that
+;;; unread-string accepts.
 ;;;
 ;;; Normally a "line" is all characters up to and including a newline.
 ;;; If lines are put back using unread-string, they can be broken arbitrarily
@@ -81,7 +87,7 @@
                     (let ((c (string-ref (car buffers))))
                       (if (= 1 (string-length (car buffers)))
                           (set! buffers (cdr buffers))
-                          (set-car! buffers (make-shared-substring (car buffers) 1)))
+                          (set-car! buffers (substring (car buffers) 1)))
                       c))))
 
         (propogate-close (lambda () (close-port underlying-port)))
@@ -90,9 +96,7 @@
 
         (unread-string (lambda (str)
                          (and (< 0 (string-length str))
-                              (if (ungetc-char-ready? self)
-                                  (set! buffers (append! (list str (string (read-char self))) buffers))
-                                  (set! buffers (cons str buffers))))))
+                                  (set! buffers (cons str buffers)))))
 
         (read-string (lambda ()
                       (cond
                         (let ((answer (car buffers)))
                           (set! buffers (cdr buffers))
                           answer))
-                       ((ungetc-char-ready? self)
-                        (read-line self 'include-newline))
                        (else
-                        (read-line underlying-port 'include-newline))))))
+                        (read-line underlying-port 'concat)))))) ;handle-newline->concat
 
     (set-object-property! self 'unread-string unread-string)
     (set-object-property! self 'read-string read-string)