Eliminate WRITE-STRING output-port operation.
authorChris Hanson <org/chris-hanson/cph>
Tue, 16 Feb 1999 00:53:21 +0000 (00:53 +0000)
committerChris Hanson <org/chris-hanson/cph>
Tue, 16 Feb 1999 00:53:21 +0000 (00:53 +0000)
v7/src/runtime/fileio.scm
v7/src/runtime/genio.scm
v7/src/runtime/output.scm
v7/src/runtime/port.scm
v7/src/runtime/runtime.pkg
v7/src/runtime/strott.scm
v8/src/runtime/runtime.pkg

index 408bc8f8303cd1f8ee5c0459a2c6a9fef6653efe..4437a9683015e24d0e001d1b0dfb6578ca2d0890 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: fileio.scm,v 1.13 1999/02/16 00:40:59 cph Exp $
+$Id: fileio.scm,v 1.14 1999/02/16 00:49:52 cph Exp $
 
 Copyright (c) 1991-1999 Massachusetts Institute of Technology
 
@@ -60,7 +60,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
           (SET-OUTPUT-BUFFER-SIZE ,operation/set-output-buffer-size)
           (SET-OUTPUT-TERMINAL-MODE ,operation/set-output-terminal-mode)
           (WRITE-CHAR ,operation/write-char)
-          (WRITE-STRING ,operation/write-string)
           (WRITE-SUBSTRING ,operation/write-substring)))
        (other-operations
         `((CLOSE ,operation/close)
index 87918d67ad2269c530fb96feb77636824c14454f..9f1a818e2dec7b5b44b9369d5d856810cfb783e5 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: genio.scm,v 1.10 1999/02/16 00:41:03 cph Exp $
+$Id: genio.scm,v 1.11 1999/02/16 00:50:04 cph Exp $
 
 Copyright (c) 1991-1999 Massachusetts Institute of Technology
 
@@ -58,7 +58,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
           (SET-OUTPUT-BUFFER-SIZE ,operation/set-output-buffer-size)
           (SET-OUTPUT-TERMINAL-MODE ,operation/set-output-terminal-mode)
           (WRITE-CHAR ,operation/write-char)
-          (WRITE-STRING ,operation/write-string)
           (WRITE-SUBSTRING ,operation/write-substring)))
        (other-operations
         `((CLOSE ,operation/close)
@@ -224,9 +223,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 (define (operation/write-char port char)
   (output-buffer/write-char-block (port/output-buffer port) char))
 
-(define (operation/write-string port string)
-  (output-buffer/write-string-block (port/output-buffer port) string))
-
 (define (operation/write-substring port string start end)
   (output-buffer/write-substring-block (port/output-buffer port)
                                       string start end))
index a4e7e4a35ddc3545d76f3a1fdb2a0c2073f92f66..db96ce65fb847e99f7e89df01fb7aeadef4cda1b 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: output.scm,v 14.17 1999/01/02 06:11:34 cph Exp $
+$Id: output.scm,v 14.18 1999/02/16 00:49:02 cph Exp $
 
 Copyright (c) 1988-1999 Massachusetts Institute of Technology
 
@@ -30,7 +30,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   ((output-port/operation/write-char port) port char))
 
 (define (output-port/write-string port string)
-  ((output-port/operation/write-string port) port string))
+  (output-port/write-substring port string 0 (string-length string)))
 
 (define (output-port/write-substring port string start end)
   ((output-port/operation/write-substring port) port string start end))
index 4d44c846b51bd1d8e6bccabd25f957fbe6c7b632..b5fc7644a65cd4ad4848dce0019d3596f8c1d3e1 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: port.scm,v 1.11 1999/01/02 06:11:34 cph Exp $
+$Id: port.scm,v 1.12 1999/02/16 00:49:21 cph Exp $
 
 Copyright (c) 1991-1999 Massachusetts Institute of Technology
 
@@ -40,7 +40,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
       READ-SUBSTRING
       ;; output operations:
       WRITE-CHAR
-      WRITE-STRING
       WRITE-SUBSTRING
       FLUSH-OUTPUT
       DISCRETIONARY-FLUSH-OUTPUT)))
@@ -78,9 +77,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 (define output-port/operation/write-char
   (record-accessor port-rtd 'WRITE-CHAR))
 
-(define output-port/operation/write-string
-  (record-accessor port-rtd 'WRITE-STRING))
-
 (define output-port/operation/write-substring
   (record-accessor port-rtd 'WRITE-SUBSTRING))
 
@@ -129,7 +125,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
          ((DISCARD-CHARS) (input-port/operation/discard-chars port))
          ((READ-SUBSTRING) (input-port/operation/read-substring port))
          ((WRITE-CHAR) (output-port/operation/write-char port))
-         ((WRITE-STRING) (output-port/operation/write-string port))
          ((WRITE-SUBSTRING) (output-port/operation/write-substring port))
          ((FLUSH-OUTPUT) (output-port/operation/flush-output port))
          ((DISCRETIONARY-FLUSH-OUTPUT)
@@ -371,11 +366,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 (define (default-operation/write-char port char)
   ((output-port/operation/write-substring port) port (string char) 0 1))
 
-(define (default-operation/write-string port string)
-  ((output-port/operation/write-substring port)
-   port
-   string 0 (string-length string)))
-
 (define (default-operation/write-substring port string start end)
   (let ((write-char (output-port/operation/write-char port)))
     (let loop ((index start))
@@ -390,12 +380,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 (define install-output-operations!
   (let ((operation-names
-        '(WRITE-CHAR WRITE-SUBSTRING WRITE-STRING
-                     FLUSH-OUTPUT DISCRETIONARY-FLUSH-OUTPUT))
+        '(WRITE-CHAR WRITE-SUBSTRING FLUSH-OUTPUT DISCRETIONARY-FLUSH-OUTPUT))
        (operation-defaults
         (list default-operation/write-char
               default-operation/write-substring
-              default-operation/write-string
               default-operation/flush-output
               default-operation/flush-output)))
     (let ((updaters
index e250057fc82fb5e84e45d39ecfdbc0d63d20d89d..7a20ed50c2d23a3ed839807009c5312a5ebeb32f 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: runtime.pkg,v 14.305 1999/02/16 00:40:48 cph Exp $
+$Id: runtime.pkg,v 14.306 1999/02/16 00:49:11 cph Exp $
 
 Copyright (c) 1988-1999 Massachusetts Institute of Technology
 
@@ -961,7 +961,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
          operation/set-output-buffer-size
          operation/set-output-terminal-mode
          operation/write-char
-         operation/write-string
          operation/write-substring)
   (initialization (initialize-package!)))
 
@@ -1124,7 +1123,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
          output-port/operation/discretionary-flush
          output-port/operation/flush-output
          output-port/operation/write-char
-         output-port/operation/write-string
          output-port/operation/write-substring
          output-port/state
          output-port?
index 3df72a20111b6a03ebb2d011ee1f446d7428668d..6176aa6e584fbe50f1550090016d0bc839c8f6ef 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: strott.scm,v 14.5 1999/01/02 06:19:10 cph Exp $
+$Id: strott.scm,v 14.6 1999/02/16 00:53:21 cph Exp $
 
 Copyright (c) 1988-1999 Massachusetts Institute of Technology
 
@@ -28,13 +28,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   (set! output-string-template
        (make-output-port `((WRITE-SELF ,operation/write-self)
                            (WRITE-CHAR ,operation/write-char)
-                           (WRITE-STRING ,operation/write-string))
-                         false)))
+                           (WRITE-SUBSTRING ,operation/write-substring))
+                         #f)))
 
 (define (with-output-to-truncated-string max thunk)
   (call-with-current-continuation
    (lambda (return)
-     (cons false
+     (cons #f
           (apply string-append
                  (reverse!
                   (let ((state
@@ -48,8 +48,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 (define-structure (output-string-state (type vector)
                                       (conc-name output-string-state/))
-  (return false read-only true)
-  (max-length false read-only true)
+  (return #f read-only #t)
+  (max-length #f read-only #t)
   accumulator
   counter)
 
@@ -59,21 +59,22 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
          (counter (output-string-state/counter state)))
       (if (zero? counter)
          ((output-string-state/return state)
-          (cons true (apply string-append (reverse! accumulator))))
+          (cons #t (apply string-append (reverse! accumulator))))
          (begin
            (set-output-string-state/accumulator!
             state
             (cons (string char) accumulator))
            (set-output-string-state/counter! state (-1+ counter)))))))
 
-(define (operation/write-string port string)
+(define (operation/write-substring port string start end)
   (let ((state (output-port/state port)))
-    (let ((accumulator (cons string (output-string-state/accumulator state)))
-         (counter
-          (- (output-string-state/counter state) (string-length string))))
+    (let ((accumulator
+          (cons (substring string start end)
+                (output-string-state/accumulator state)))
+         (counter (- (output-string-state/counter state) (- end start))))
       (if (negative? counter)
          ((output-string-state/return state)
-          (cons true
+          (cons #t
                 (substring (apply string-append (reverse! accumulator))
                            0
                            (output-string-state/max-length state))))
index 8fba96d36f04dca377c8458d550b9dd6c92f814e..b92937a70fbde638a88fba90cb156a9be6d20bad 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: runtime.pkg,v 14.311 1999/02/16 00:40:53 cph Exp $
+$Id: runtime.pkg,v 14.312 1999/02/16 00:49:36 cph Exp $
 
 Copyright (c) 1988-1999 Massachusetts Institute of Technology
 
@@ -965,7 +965,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
          operation/set-output-buffer-size
          operation/set-output-terminal-mode
          operation/write-char
-         operation/write-string
          operation/write-substring)
   (initialization (initialize-package!)))
 
@@ -1128,7 +1127,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
          output-port/operation/discretionary-flush
          output-port/operation/flush-output
          output-port/operation/write-char
-         output-port/operation/write-string
          output-port/operation/write-substring
          output-port/state
          output-port?