Eliminate optional environment arg to write/display/etc.
authorChris Hanson <org/chris-hanson/cph>
Sat, 12 May 2018 04:11:25 +0000 (21:11 -0700)
committerChris Hanson <org/chris-hanson/cph>
Sat, 12 May 2018 04:11:25 +0000 (21:11 -0700)
Also eliminate output-port/write-object and make-unparser-state.

src/runtime/output-port.scm
src/runtime/printer.scm
src/runtime/runtime.pkg

index 64dc162f746ed2ce96608bb678b064ec0b907d65..f50d876277e40c04d6d270aeb27fbdd025628df5 100644 (file)
@@ -52,9 +52,6 @@ USA.
 (define (output-port/discretionary-flush port)
   ((textual-port-operation/discretionary-flush-output port) port))
 
-(define (output-port/write-object port object environment)
-  (print-top-level object port #t environment))
-
 (define (output-port/x-size port)
   (or (let ((operation (textual-port-operation port 'x-size)))
        (and operation
@@ -131,19 +128,19 @@ USA.
               (fix:> n 0)))
        (output-port/discretionary-flush port))))
 
-(define (display object #!optional port environment)
+(define (display object #!optional port)
   (let ((port (optional-output-port port 'display)))
-    (print-top-level object port #f environment)
+    (print-top-level object port #f)
     (output-port/discretionary-flush port)))
 
-(define (write object #!optional port environment)
+(define (write object #!optional port)
   (let ((port (optional-output-port port 'write)))
-    (output-port/write-object port object environment)
+    (print-top-level object port #t)
     (output-port/discretionary-flush port)))
 
-(define (write-line object #!optional port environment)
+(define (write-line object #!optional port)
   (let ((port (optional-output-port port 'write-line)))
-    (output-port/write-object port object environment)
+    (print-top-level object port #t)
     (output-port/write-char port #\newline)
     (output-port/discretionary-flush port)))
 
index 19d39cdf8bf2914f0750089f4bf813d7f62aaddb..99007fefff4327abf6f254e376277ca5c008a489 100644 (file)
@@ -139,12 +139,11 @@ USA.
                  *unparser-string-length-limit*))
 \f
 (define-record-type <context>
-    (make-context port mode environment list-depth in-brackets?
+    (make-context port mode list-depth in-brackets?
                  list-breadth-limit list-depth-limit)
     context?
   (port context-port)
   (mode context-mode)
-  (environment context-environment)
   (list-depth context-list-depth)
   (in-brackets? context-in-brackets?)
   (list-breadth-limit context-list-breadth-limit)
@@ -153,7 +152,6 @@ USA.
 (define (context-down-list context)
   (make-context (context-port context)
                (context-mode context)
-               (context-environment context)
                (+ 1 (context-list-depth context))
                (context-in-brackets? context)
                (context-list-breadth-limit context)
@@ -162,7 +160,6 @@ USA.
 (define (context-in-brackets context)
   (make-context (context-port context)
                (context-mode context)
-               (context-environment context)
                0
                #t
                within-brackets:list-breadth-limit
@@ -177,18 +174,6 @@ USA.
 (define (context-char-set context)
   (textual-port-char-set (context-port context)))
 
-(define (make-unparser-state port list-depth slashify? environment)
-  (guarantee output-port? port)
-  (guarantee environment? environment)
-  (guarantee exact-nonnegative-integer? list-depth)
-  (make-context port
-               (if slashify? 'normal 'display)
-               environment
-               list-depth
-               #f
-               (get-param:printer-list-breadth-limit)
-               (get-param:printer-list-depth-limit)))
-
 (define (with-current-unparser-state context procedure)
   (parameterize* (list (cons initial-context context))
     (lambda ()
@@ -199,32 +184,23 @@ USA.
 \f
 ;;;; Top Level
 
-(define (print-top-level object port slashify? environment)
+(define (print-top-level object port slashify?)
   (guarantee output-port? port)
-  (if (not (default-object? environment))
-      (guarantee environment? environment))
   (print-object object
                (top-level-context port
-                                  (if slashify? 'normal 'display)
-                                  environment)))
+                                  (if slashify? 'normal 'display))))
 
-(define (top-level-context port mode environment)
+(define (top-level-context port mode)
   (let ((context (initial-context)))
     (if context
        (make-context port
                      mode
-                     (if (default-object? environment)
-                         (context-environment context)
-                         environment)
                      (context-list-depth context)
                      (context-in-brackets? context)
                      (context-list-breadth-limit context)
                      (context-list-depth-limit context))
        (make-context port
                      mode
-                     (if (default-object? environment)
-                         (nearest-repl/environment)
-                         environment)
                      0
                      #f
                      (get-param:printer-list-breadth-limit)
index fec7653c7d48cb4a965db4f4d4f01ade6a3a308a..14c2deacb9cd18c76019ef8d40002981f931c5c3 100644 (file)
@@ -2812,7 +2812,6 @@ USA.
          output-port/line-start?
          output-port/synchronize-output
          output-port/write-char
-         output-port/write-object
          output-port/write-string
          output-port/write-substring
          output-port/x-size
@@ -4868,8 +4867,7 @@ USA.
   (export (runtime pretty-printer)
          get-param:printer-list-breadth-limit
          get-param:printer-list-depth-limit
-         prefix-pair?
-         make-unparser-state)
+         prefix-pair?)
   (export (runtime record)
          (rtd:unparser-state <context>)))