X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fearly-print.lisp;h=7df6c1837bf63cfd3554631d9c802a6e5645adc4;hb=840832c6ca7fae0af981d721bdbb38e567d575cf;hp=f3e7a744ab445d12bd8c2a2c4a88ea6570e29f97;hpb=a530bbe337109d898d5b4a001fc8f1afa3b5dc39;p=sbcl.git diff --git a/src/code/early-print.lisp b/src/code/early-print.lisp index f3e7a74..7df6c18 100644 --- a/src/code/early-print.lisp +++ b/src/code/early-print.lisp @@ -10,36 +10,32 @@ ;;;; files for more information. (in-package "SB!IMPL") - -(file-comment - "$Header$") ;;;; level and length abbreviations -(defvar *current-level* 0 - #!+sb-doc - "The current level we are printing at, to be compared against *PRINT-LEVEL*. - See the macro DESCEND-INTO for a handy interface to depth abbreviation.") +;;; The current level we are printing at, to be compared against +;;; *PRINT-LEVEL*. See the macro DESCEND-INTO for a handy interface to +;;; depth abbreviation. +(defvar *current-level-in-print* 0) +;;; Automatically handle *PRINT-LEVEL* abbreviation. If we are too +;;; deep, then a #\# is printed to STREAM and BODY is ignored. (defmacro descend-into ((stream) &body body) - #!+sb-doc - "Automatically handle *PRINT-LEVEL* abbreviation. If we are too deep, then - a # is printed to STREAM and BODY is ignored." (let ((flet-name (gensym))) `(flet ((,flet-name () ,@body)) (cond ((and (null *print-readably*) *print-level* - (>= *current-level* *print-level*)) + (>= *current-level-in-print* *print-level*)) (write-char #\# ,stream)) (t - (let ((*current-level* (1+ *current-level*))) + (let ((*current-level-in-print* (1+ *current-level-in-print*))) (,flet-name))))))) -(defmacro punt-if-too-long (index stream) - #!+sb-doc - "Punt if INDEX is equal or larger then *PRINT-LENGTH* (and *PRINT-READABLY* - is NIL) by outputting \"...\" and returning from the block named NIL." +;;; Punt if INDEX is equal or larger then *PRINT-LENGTH* (and +;;; *PRINT-READABLY* is NIL) by outputting \"...\" and returning from +;;; the block named NIL. +(defmacro punt-print-if-too-long (index stream) `(when (and (not *print-readably*) *print-length* (>= ,index *print-length*))