From: Chris Hanson Date: Tue, 31 Jan 1995 19:35:11 +0000 (+0000) Subject: Eliminate end-of-file marker handling code. This is the code that X-Git-Tag: 20090517-FFI~6686 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=dabb94f1b0dc90e306742a052d200afc91fc5d14;p=mit-scheme.git Eliminate end-of-file marker handling code. This is the code that used to handle ^Z in DOS files -- but the ^Z convention is very old and not worth putting in explicit support for. --- diff --git a/v7/src/edwin/fileio.scm b/v7/src/edwin/fileio.scm index 7a47c798b..8c7bce9b8 100644 --- a/v7/src/edwin/fileio.scm +++ b/v7/src/edwin/fileio.scm @@ -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 diff --git a/v7/src/runtime/dosprm.scm b/v7/src/runtime/dosprm.scm index 9791b405b..bd9d0ecf9 100644 --- a/v7/src/runtime/dosprm.scm +++ b/v7/src/runtime/dosprm.scm @@ -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 () diff --git a/v7/src/runtime/dospth.scm b/v7/src/runtime/dospth.scm index fffd48cff..4e233f67b 100644 --- a/v7/src/runtime/dospth.scm +++ b/v7/src/runtime/dospth.scm @@ -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)) (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)) ;;;; 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 diff --git a/v7/src/runtime/fileio.scm b/v7/src/runtime/fileio.scm index 8151b36a6..4f894f10b 100644 --- a/v7/src/runtime/fileio.scm +++ b/v7/src/runtime/fileio.scm @@ -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) diff --git a/v7/src/runtime/io.scm b/v7/src/runtime/io.scm index ed68078dd..45e8d37a2 100644 --- a/v7/src/runtime/io.scm +++ b/v7/src/runtime/io.scm @@ -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)))) diff --git a/v7/src/runtime/os2prm.scm b/v7/src/runtime/os2prm.scm index 709433183..160963f1b 100644 --- a/v7/src/runtime/os2prm.scm +++ b/v7/src/runtime/os2prm.scm @@ -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) (define (initialize-system-primitives!) (discard-select-registry-result-vectors!) diff --git a/v7/src/runtime/pathnm.scm b/v7/src/runtime/pathnm.scm index c118510f6..4910e37b9 100644 --- a/v7/src/runtime/pathnm.scm +++ b/v7/src/runtime/pathnm.scm @@ -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))) (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))) ;;;; 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)) diff --git a/v7/src/runtime/unxprm.scm b/v7/src/runtime/unxprm.scm index 730884e48..967fb1132 100644 --- a/v7/src/runtime/unxprm.scm +++ b/v7/src/runtime/unxprm.scm @@ -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) ;;; Queues after-restart daemon to clean up environment space diff --git a/v7/src/runtime/unxpth.scm b/v7/src/runtime/unxpth.scm index a3468e758..2f9b7a7d2 100644 --- a/v7/src/runtime/unxpth.scm +++ b/v7/src/runtime/unxpth.scm @@ -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