(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
(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)))
*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)
(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)
(define (context-in-brackets context)
(make-context (context-port context)
(context-mode context)
- (context-environment context)
0
#t
within-brackets:list-breadth-limit
(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 ()
\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)