X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fearly-print.lisp;h=7df6c1837bf63cfd3554631d9c802a6e5645adc4;hb=f1407e424f1063203af07d2e61ceef58515a4797;hp=6f7d9e614f9c073818a6edcd2761016965fb4f33;hpb=6044a3ac0bcca2f650f76f665a0cf30b8d8e3beb;p=sbcl.git diff --git a/src/code/early-print.lisp b/src/code/early-print.lisp index 6f7d9e6..7df6c18 100644 --- a/src/code/early-print.lisp +++ b/src/code/early-print.lisp @@ -13,30 +13,29 @@ ;;;; 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))))))) +;;; 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) - #!+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." `(when (and (not *print-readably*) *print-length* (>= ,index *print-length*))