|
55 | 55 | (defun select-? () |
56 | 56 | (terpri) |
57 | 57 | (format t |
58 | | - "Inspect commands:~%~ |
59 | | - n (or N or Newline): inspects the field (recursively).~%~ |
60 | | - s (or S): skips the field.~%~ |
61 | | - p (or P): pretty-prints the field.~%~ |
62 | | - a (or A): aborts the inspection ~ |
63 | | - of the rest of the fields.~%~ |
64 | | - u (or U) form: updates the field ~ |
65 | | - with the value of the form.~%~ |
66 | | - e (or E) form: evaluates and prints the form.~%~ |
67 | | - q (or Q): quits the inspection.~%~ |
68 | | - ?: prints this.~%~%")) |
| 58 | + "Inspect commands:~@ |
| 59 | + n (or N or Newline): inspects the field (recursively).~@ |
| 60 | + s (or S): skips the field.~@ |
| 61 | + p (or P): pretty-prints the field.~@ |
| 62 | + a (or A): aborts the inspection ~ |
| 63 | + of the rest of the fields.~@ |
| 64 | + u (or U) form: updates the field ~ |
| 65 | + with the value of the form.~@ |
| 66 | + e (or E) form: evaluates and prints the form.~@ |
| 67 | + q (or Q): quits the inspection.~@ |
| 68 | + ?: prints this.~2%")) |
69 | 69 |
|
70 | 70 | (defun read-inspect-command (label object allow-recursive) |
71 | 71 | (declare (special *quit-tag* *quit-tags*)) |
|
258 | 258 | (defun inspect-cons (cons) |
259 | 259 | (format t "~S - cons" cons) |
260 | 260 | (when *inspect-mode* |
261 | | - (do ((i 0 (1+ i)) |
262 | | - (l cons (cdr l))) |
263 | | - ((atom l) |
264 | | - (case l |
265 | | - ((t nil) ;; no point in inspecting recursively t nor nil. |
266 | | - (inspect-print (format nil "nthcdr ~D: ~~S" i) l)) |
267 | | - (t |
268 | | - (inspect-recursively (format nil "nthcdr ~D:" i) |
269 | | - l (cdr (nthcdr (1- i) cons)))))) |
270 | | - (inspect-recursively (format nil "nth ~D:" i) |
271 | | - (car l) (nth i cons))))) |
| 261 | + (do ((i 0 (1+ i)) |
| 262 | + (l cons (cdr l))) |
| 263 | + ((atom l) |
| 264 | + (case l |
| 265 | + ((t nil) ;; no point in inspecting recursively t nor nil. |
| 266 | + (inspect-print (format nil "nthcdr ~D: ~~S" i) l)) |
| 267 | + (t |
| 268 | + (inspect-recursively (format nil "nthcdr ~D:" i) |
| 269 | + l (cdr (nthcdr (1- i) cons)))))) |
| 270 | + (inspect-recursively (format nil "nth ~D:" i) |
| 271 | + (car l) (nth i cons))))) |
272 | 272 |
|
273 | 273 | (defun inspect-string (string) |
274 | 274 | (format t (if (simple-string-p string) "~S - simple string" "~S - string") |
@@ -468,28 +468,27 @@ q (or Q): quits the inspection.~%~ |
468 | 468 | (when (and (not *inspect-mode*) |
469 | 469 | (or (> *inspect-level* 5) |
470 | 470 | (member object *inspect-history*))) |
471 | | - (prin1 object) |
472 | | - (return-from inspect-object)) |
| 471 | + (prin1 object) |
| 472 | + (return-from inspect-object)) |
473 | 473 | (incf *inspect-level*) |
474 | 474 | (push object *inspect-history*) |
475 | 475 | (catch 'ABORT-INSPECT |
476 | 476 | (let ((* object)) |
477 | | - (cond |
478 | | - ((symbolp object) (inspect-symbol object)) |
479 | | - ((packagep object) (inspect-package object)) |
480 | | - ((characterp object) (inspect-character object)) |
481 | | - ((numberp object) (inspect-number object)) |
482 | | - ((consp object) (inspect-cons object)) |
483 | | - ((stringp object) (inspect-string object)) |
484 | | - ((vectorp object) (inspect-vector object)) |
485 | | - ((arrayp object) (inspect-array object)) |
486 | | - ((hash-table-p object) (inspect-hashtable object)) |
487 | | - ;; Note that this needs to get generic functions, |
488 | | - ;; so keep it before the instancep test. |
489 | | - ((functionp object) (inspect-function object)) |
490 | | - ((sys:instancep object) (inspect-instance object)) |
491 | | - ((sys:cxx-object-p object) (describe-object object *standard-output*)) |
492 | | - (t (format t "~S - ~S" object (type-of object))))))) |
| 477 | + (cond ((symbolp object) (inspect-symbol object)) |
| 478 | + ((packagep object) (inspect-package object)) |
| 479 | + ((characterp object) (inspect-character object)) |
| 480 | + ((numberp object) (inspect-number object)) |
| 481 | + ((consp object) (inspect-cons object)) |
| 482 | + ((stringp object) (inspect-string object)) |
| 483 | + ((vectorp object) (inspect-vector object)) |
| 484 | + ((arrayp object) (inspect-array object)) |
| 485 | + ((hash-table-p object) (inspect-hashtable object)) |
| 486 | + ;; Note that this needs to get generic functions, |
| 487 | + ;; so keep it before the instancep test. |
| 488 | + ((functionp object) (inspect-function object)) |
| 489 | + ((sys:instancep object) (inspect-instance object)) |
| 490 | + ((sys:cxx-object-p object) (describe-object object *standard-output*)) |
| 491 | + (t (format t "~S - ~S" object (type-of object))))))) |
493 | 492 |
|
494 | 493 | (defun default-inspector (object) |
495 | 494 | "Args: (object) |
@@ -518,17 +517,17 @@ inspect commands, or type '?' to the inspector." |
518 | 517 | object) |
519 | 518 |
|
520 | 519 | (defun describe (object &optional (stream *standard-output*) |
521 | | - &aux (*inspect-mode* nil) |
522 | | - (*inspect-level* 0) |
523 | | - (*inspect-history* nil) |
524 | | - (*print-level* nil) |
525 | | - (*print-length* nil) |
526 | | - (*standard-output* (cond ((streamp stream) stream) |
527 | | - ((null stream) *standard-output*) |
528 | | - ((eq stream t) *terminal-io*) |
529 | | - (t (error 'type-error |
530 | | - :datum stream |
531 | | - :expected-type '(or stream t nil)))))) |
| 520 | + &aux (*inspect-mode* nil) |
| 521 | + (*inspect-level* 0) |
| 522 | + (*inspect-history* nil) |
| 523 | + (*print-level* nil) |
| 524 | + (*print-length* nil) |
| 525 | + (*standard-output* (cond ((streamp stream) stream) |
| 526 | + ((null stream) *standard-output*) |
| 527 | + ((eq stream t) *terminal-io*) |
| 528 | + (t (error 'type-error |
| 529 | + :datum stream |
| 530 | + :expected-type '(or stream t nil)))))) |
532 | 531 | "Args: (object &optional (stream *standard-output*)) |
533 | 532 | Prints information about OBJECT to STREAM." |
534 | 533 | (terpri) |
|
0 commit comments