From af2071bcb90dca29bd280f9d436de7cba1fca927 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Fri, 11 May 2018 21:11:25 -0700 Subject: [PATCH] Eliminate optional environment arg to write/display/etc. Also eliminate output-port/write-object and make-unparser-state. --- src/runtime/output-port.scm | 15 ++++++--------- src/runtime/printer.scm | 32 ++++---------------------------- src/runtime/runtime.pkg | 4 +--- 3 files changed, 11 insertions(+), 40 deletions(-) diff --git a/src/runtime/output-port.scm b/src/runtime/output-port.scm index 64dc162f7..f50d87627 100644 --- a/src/runtime/output-port.scm +++ b/src/runtime/output-port.scm @@ -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))) diff --git a/src/runtime/printer.scm b/src/runtime/printer.scm index 19d39cdf8..99007feff 100644 --- a/src/runtime/printer.scm +++ b/src/runtime/printer.scm @@ -139,12 +139,11 @@ USA. *unparser-string-length-limit*)) (define-record-type - (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. ;;;; 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) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index fec7653c7..14c2deacb 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -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 ))) -- 2.25.1