Eliminate end-of-file marker handling code. This is the code that
authorChris Hanson <org/chris-hanson/cph>
Tue, 31 Jan 1995 19:35:11 +0000 (19:35 +0000)
committerChris Hanson <org/chris-hanson/cph>
Tue, 31 Jan 1995 19:35:11 +0000 (19:35 +0000)
used to handle ^Z in DOS files -- but the ^Z convention is very old
and not worth putting in explicit support for.

v7/src/edwin/fileio.scm
v7/src/runtime/dosprm.scm
v7/src/runtime/dospth.scm
v7/src/runtime/fileio.scm
v7/src/runtime/io.scm
v7/src/runtime/os2prm.scm
v7/src/runtime/pathnm.scm
v7/src/runtime/unxprm.scm
v7/src/runtime/unxpth.scm

index 7a47c798bc5e41d9d9b77a5cb048fffbd490bff5..8c7bce9b8817dbee07c4c695a275d356e1a4fb1b 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: fileio.scm,v 1.123 1995/01/06 01:07:23 cph Exp $
+;;;    $Id: fileio.scm,v 1.124 1995/01/31 19:35:11 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-95 Massachusetts Institute of Technology
 ;;;
@@ -140,11 +140,7 @@ Each procedure is called with three arguments:
             (and *translate-file-data-on-input?*
                  (let ((translation (pathname-newline-translation truename)))
                    (and translation
-                        (make-input-buffer channel
-                                           4096
-                                           translation
-                                           (pathname-end-of-file-marker/input
-                                            truename)))))))
+                        (make-input-buffer channel 4096 translation))))))
        (bind-condition-handler (list condition-type:allocation-failure)
            (lambda (condition)
              condition
index 9791b405bd6431eec43038ae7a1604d155b853f2..bd9d0ecf970f58b2079218590a49ce2ae25444fa 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: dosprm.scm,v 1.24 1995/01/06 00:39:44 cph Exp $
+$Id: dosprm.scm,v 1.25 1995/01/31 19:34:24 cph Exp $
 
 Copyright (c) 1992-95 Massachusetts Institute of Technology
 
@@ -286,12 +286,6 @@ MIT in each case. |#
 (define (os/default-end-of-line-translation)
   "\r\n")
 
-(define (os/default-end-of-file-marker/input)
-  #f)
-
-(define (os/default-end-of-file-marker/output)
-  #f)
-
 (define (initialize-system-primitives!)
   (let ((reset!
         (lambda ()
index fffd48cffe5e6d3520020c474dd9d63c97ecfffe..4e233f67b953c05c3e95b42e38a7fb122b27c99e 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: dospth.scm,v 1.21 1995/01/06 00:39:50 cph Exp $
+$Id: dospth.scm,v 1.22 1995/01/31 19:34:38 cph Exp $
 
 Copyright (c) 1992-95 Massachusetts Institute of Technology
 
@@ -38,8 +38,6 @@ MIT in each case. |#
 (declare (usual-integrations))
 \f
 (define hook/dos/end-of-line-string)
-(define hook/dos/end-of-file-marker/input)
-(define hook/dos/end-of-file-marker/output)
 
 (define sub-directory-delimiters
   ;; Allow forward slashes as well as backward slashes so that
@@ -66,15 +64,10 @@ MIT in each case. |#
                  dos/user-homedir-pathname
                  dos/init-file-pathname
                  dos/pathname-simplify
-                 dos/end-of-line-string
-                 dos/end-of-file-marker/input
-                 dos/end-of-file-marker/output))
+                 dos/end-of-line-string))
 
 (define (initialize-package!)
   (set! hook/dos/end-of-line-string default/dos/end-of-line-string)
-  (set! hook/dos/end-of-file-marker/input default/dos/end-of-file-marker/input)
-  (set! hook/dos/end-of-file-marker/output
-       default/dos/end-of-file-marker/output)
   (add-pathname-host-type! 'DOS make-dos-host-type))
 \f
 ;;;; Pathname Parser
@@ -359,18 +352,4 @@ MIT in each case. |#
 
 (define (default/dos/end-of-line-string pathname)
   pathname                             ; ignored
-  (os/default-end-of-line-translation))
-
-(define (dos/end-of-file-marker/input pathname)
-  (hook/dos/end-of-file-marker/input pathname))
-
-(define (default/dos/end-of-file-marker/input pathname)
-  pathname                             ; ignored
-  (os/default-end-of-file-marker/input))
-
-(define (dos/end-of-file-marker/output pathname)
-  (hook/dos/end-of-file-marker/output pathname))
-
-(define (default/dos/end-of-file-marker/output pathname)
-  pathname                             ; ignored
-  (os/default-end-of-file-marker/output))
\ No newline at end of file
+  (os/default-end-of-line-translation))
\ No newline at end of file
index 8151b36a6d5b65b902c80445e0db3c301c631b50..4f894f10bfb9f0f031a092015038d7feae888d4b 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Id: fileio.scm,v 1.8 1994/11/20 05:04:35 cph Exp $
+$Id: fileio.scm,v 1.9 1995/01/31 19:34:39 cph Exp $
 
-Copyright (c) 1991-94 Massachusetts Institute of Technology
+Copyright (c) 1991-95 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -108,8 +108,7 @@ MIT in each case. |#
           (make-file-state
            (make-input-buffer channel
                               input-buffer-size
-                              (pathname-newline-translation pathname)
-                              (pathname-end-of-file-marker/input pathname))
+                              (pathname-newline-translation pathname))
            false
            pathname))))
     (set-channel-port! channel port)
@@ -129,8 +128,7 @@ MIT in each case. |#
            false
            (make-output-buffer channel
                                output-buffer-size
-                               (pathname-newline-translation pathname)
-                               (pathname-end-of-file-marker/output pathname))
+                               (pathname-newline-translation pathname))
            pathname))))
     (set-channel-port! channel port)
     port))
@@ -143,14 +141,8 @@ MIT in each case. |#
          (port/copy
           i/o-file-template
           (make-file-state
-           (make-input-buffer channel
-                              input-buffer-size
-                              translation
-                              (pathname-end-of-file-marker/input pathname))
-           (make-output-buffer channel
-                               output-buffer-size
-                               translation
-                               (pathname-end-of-file-marker/output pathname))
+           (make-input-buffer channel input-buffer-size translation)
+           (make-output-buffer channel output-buffer-size translation)
            pathname))))
     (set-channel-port! channel port)
     port))
@@ -167,7 +159,6 @@ MIT in each case. |#
          (port/copy input-file-template
                     (make-file-state (make-input-buffer channel
                                                         input-buffer-size
-                                                        false
                                                         false)
                                      false
                                      pathname))))
@@ -186,7 +177,6 @@ MIT in each case. |#
                     (make-file-state false
                                      (make-output-buffer channel
                                                          output-buffer-size
-                                                         false
                                                          false)
                                      pathname))))
     (set-channel-port! channel port)
@@ -199,11 +189,9 @@ MIT in each case. |#
          (port/copy i/o-file-template
                     (make-file-state (make-input-buffer channel
                                                         input-buffer-size
-                                                        false
                                                         false)
                                      (make-output-buffer channel
                                                          output-buffer-size
-                                                         false
                                                          false)
                                      pathname))))
     (set-channel-port! channel port)
index ed68078ddfa92c24cf4e61c0b85a06fa98eed797..45e8d37a2a1bed3a655f0ffbbdaf276835f6869f 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: io.scm,v 14.41 1995/01/06 00:44:47 cph Exp $
+$Id: io.scm,v 14.42 1995/01/31 19:34:41 cph Exp $
 
 Copyright (c) 1988-95 Massachusetts Institute of Technology
 
@@ -559,8 +559,7 @@ MIT in each case. |#
   string
   position
   line-translation                     ; string that newline maps to
-  logical-size
-  end-marker)
+  logical-size)
 
 (define (output-buffer-sizes translation buffer-size)
   (let ((logical-size
@@ -573,8 +572,7 @@ MIT in each case. |#
                (fix:+ logical-size
                       (fix:- (string-length translation) 1))))))
 
-(define (make-output-buffer channel buffer-size
-                           #!optional line-translation end-marker)
+(define (make-output-buffer channel buffer-size #!optional line-translation)
   (let ((translation
         (if (default-object? line-translation)
             (os/default-end-of-line-translation)
@@ -586,15 +584,9 @@ MIT in each case. |#
                                  (make-string string-size))
                             0
                             translation
-                            logical-size
-                            (if (default-object? end-marker)
-                                (os/default-end-of-file-marker/output)
-                                end-marker))))))
+                            logical-size)))))
 
 (define (output-buffer/close buffer)
-  (cond ((output-buffer/end-marker buffer)
-        => (lambda (marker)
-             (output-buffer/write-char-block buffer marker))))
   (output-buffer/drain-block buffer)
   (channel-close (output-buffer/channel buffer)))
 
@@ -762,8 +754,7 @@ MIT in each case. |#
   ;; END-INDEX is zero iff CHANNEL is closed.
   end-index
   line-translation                     ; string that maps to newline
-  real-end
-  end-marker)
+  real-end)
 
 (define (input-buffer-size translation buffer-size)
   (cond ((not translation)
@@ -775,8 +766,7 @@ MIT in each case. |#
        (else
         buffer-size)))
 
-(define (make-input-buffer channel buffer-size
-                          #!optional line-translation end-marker)
+(define (make-input-buffer channel buffer-size #!optional line-translation)
   (let* ((translation
          (if (default-object? line-translation)
              (os/default-end-of-line-translation)
@@ -787,10 +777,7 @@ MIT in each case. |#
                        string-size
                        string-size
                        translation
-                       string-size
-                       (if (default-object? end-marker)
-                           (os/default-end-of-file-marker/input)
-                           end-marker))))
+                       string-size)))
 
 (define (input-buffer/close buffer)
   (without-interrupts
@@ -865,32 +852,16 @@ MIT in each case. |#
        (let ((n-read
               (channel-read channel string delta (string-length string))))
          (and n-read
-              (let ((n-read
-                     (let ((marker (input-buffer/end-marker buffer)))
-                       (let ((index
-                              (and marker
-                                   (channel-type=file? channel)
-                                   (substring-find-next-char
-                                    string
-                                    delta
-                                    (fix:+ delta n-read)
-                                    marker))))
-                         (if index
-                             (begin
-                               (channel-close channel)
-                               (fix:- index delta))
-                             (begin
-                               (if (fix:= n-read 0)
-                                   (channel-close channel))
-                               n-read))))))
-                (let ((end-index (fix:+ delta n-read)))
-                  (set-input-buffer/start-index! buffer 0)
-                  (set-input-buffer/end-index! buffer end-index)
-                  (set-input-buffer/real-end! buffer end-index)
-                  (if (and (input-buffer/line-translation buffer)
-                           (not (fix:= end-index 0)))
-                      (input-buffer/translate! buffer)
-                      end-index))))))))
+              (let ((end-index (fix:+ delta n-read)))
+                (if (fix:= n-read 0)
+                    (channel-close channel))
+                (set-input-buffer/start-index! buffer 0)
+                (set-input-buffer/end-index! buffer end-index)
+                (set-input-buffer/real-end! buffer end-index)
+                (if (and (input-buffer/line-translation buffer)
+                         (not (fix:= end-index 0)))
+                    (input-buffer/translate! buffer)
+                    end-index)))))))
 
 (define-integrable (input-buffer/fill* buffer)
   (let ((n (input-buffer/fill buffer)))
@@ -904,7 +875,6 @@ MIT in each case. |#
        (and (channel-open? channel)
            (channel-type=file? channel)
            (not (input-buffer/line-translation buffer))
-           (not (input-buffer/end-marker buffer))
            (let ((n
                   (fix:- (channel-file-length channel)
                          (channel-file-position channel))))
index 709433183719f87d09e64b266bfae6f6d6f203be..160963f1b8dd481365ed32f7ea37544f3fadc821 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Id: os2prm.scm,v 1.3 1995/01/06 00:39:38 cph Exp $
+$Id: os2prm.scm,v 1.4 1995/01/31 19:34:44 cph Exp $
 
-Copyright (c) 1994 Massachusetts Institute of Technology
+Copyright (c) 1994-95 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -216,12 +216,6 @@ MIT in each case. |#
 
 (define (os/default-end-of-line-translation)
   "\r\n")
-
-(define (os/default-end-of-file-marker/input)
-  #f)
-
-(define (os/default-end-of-file-marker/output)
-  #f)
 \f
 (define (initialize-system-primitives!)
   (discard-select-registry-result-vectors!)
index c118510f6a499a20ff2bc34b8ea4fbbcd13b7bd9..4910e37b92deeb00e90ad4e08069da28061128d7 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Id: pathnm.scm,v 14.29 1994/12/19 21:03:26 cph Exp $
+$Id: pathnm.scm,v 14.30 1995/01/31 19:34:47 cph Exp $
 
-Copyright (c) 1988-94 Massachusetts Institute of Technology
+Copyright (c) 1988-95 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -158,16 +158,6 @@ these rules:
   (let ((pathname (->pathname pathname)))
     ((host-operation/end-of-line-string (%pathname-host pathname))
      pathname)))
-
-(define (pathname-end-of-file-marker/input pathname)
-  (let ((pathname (->pathname pathname)))
-    ((host-operation/end-of-file-marker/input (%pathname-host pathname))
-     pathname)))
-
-(define (pathname-end-of-file-marker/output pathname)
-  (let ((pathname (->pathname pathname)))
-    ((host-operation/end-of-file-marker/output (%pathname-host pathname))
-     pathname)))
 \f
 (define (pathname=? x y)
   (let ((x (->pathname x))
@@ -456,9 +446,7 @@ these rules:
   (operation/user-homedir-pathname false read-only true)
   (operation/init-file-pathname false read-only true)
   (operation/pathname-simplify false read-only true)
-  (operation/end-of-line-string false read-only true)
-  (operation/end-of-file-marker/input false read-only true)
-  (operation/end-of-file-marker/output false read-only true))
+  (operation/end-of-line-string false read-only true))
 
 (define-structure (host (type vector)
                        (named ((ucode-primitive string->symbol)
@@ -514,12 +502,6 @@ these rules:
 
 (define (host-operation/end-of-line-string host)
   (host-type/operation/end-of-line-string (host/type host)))
-
-(define (host-operation/end-of-file-marker/input host)
-  (host-type/operation/end-of-file-marker/input (host/type host)))
-
-(define (host-operation/end-of-file-marker/output host)
-  (host-type/operation/end-of-file-marker/output (host/type host)))
 \f
 ;;;; File System Stuff
 
@@ -628,10 +610,8 @@ these rules:
     (let ((fail
           (lambda arguments
             (error "Unimplemented host type:" name arguments))))
-      (make-host-type index name
-                     fail fail fail fail fail
-                     fail fail fail fail fail
-                     fail fail fail))))
+      (make-host-type index name fail fail fail fail fail fail fail fail fail
+                     fail fail))))
 
 (define (reset-package!)
   (let ((host-type (host-name->type microcode-id/operating-system))
index 730884e48da572301b94eed417c8a6c039b9eebf..967fb113252040ec58758fad9a8dd81ca149e2f2 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: unxprm.scm,v 1.32 1995/01/06 00:39:31 cph Exp $
+$Id: unxprm.scm,v 1.33 1995/01/31 19:34:50 cph Exp $
 
 Copyright (c) 1988-95 Massachusetts Institute of Technology
 
@@ -282,12 +282,6 @@ MIT in each case. |#
 
 (define (os/default-end-of-line-translation)
   #f)
-
-(define (os/default-end-of-file-marker/input)
-  #f)
-
-(define (os/default-end-of-file-marker/output)
-  #f)
 \f
 ;;; Queues after-restart daemon to clean up environment space
 
index a3468e758a4da952ae350c5fd48f4c480badbb5a..2f9b7a7d267c892eeb875b703d7a45a646d48d16 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Id: unxpth.scm,v 14.16 1994/11/28 05:45:12 cph Exp $
+$Id: unxpth.scm,v 14.17 1995/01/31 19:34:54 cph Exp $
 
-Copyright (c) 1988-94 Massachusetts Institute of Technology
+Copyright (c) 1988-95 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -50,9 +50,7 @@ MIT in each case. |#
                  unix/user-homedir-pathname
                  unix/init-file-pathname
                  unix/pathname-simplify
-                 unix/end-of-line-string
-                 unix/end-of-file-marker/input
-                 unix/end-of-file-marker/output))
+                 unix/end-of-line-string))
 
 (define (initialize-package!)
   (add-pathname-host-type! 'UNIX make-unix-host-type))
@@ -310,12 +308,4 @@ MIT in each case. |#
 
 (define (unix/end-of-line-string pathname)
   pathname                             ; ignored
-  "\n")
-
-(define (unix/end-of-file-marker/input pathname)
-  pathname                             ; ignored
-  false)
-
-(define (unix/end-of-file-marker/output pathname)
-  pathname                             ; ignored
-  false)
\ No newline at end of file
+  "\n")
\ No newline at end of file