Coverage report: /home/ellis/comp/core/app/skel/core/print.lisp
Kind | Covered | All | % |
expression | 0 | 169 | 0.0 |
branch | 0 | 16 | 0.0 |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;;; print.lisp --- Skel Printer
7
;; SK-PRINT is the top-level interface, and dispatches on all sorts of SKEL
8
;; objects. The output is different than the PRINT-OBJECT methods, which are
9
;; implemented in the SKEL/CORE/OBJ package.
11
;; SK-PRINT is the 'external print' representation, which is structured, akin
12
;; to PPRINT - while PRINT-OBJECT is the 'internal print' and unstructured
15
;; All printer parameters are dynamic and dispatch occurs in the same manner
16
;; as the standard Lisp Printer. Additional parameters may be provided in the
20
(in-package :skel/core/print)
21
(declaim (optimize (speed 3)))
22
;; sb-pretty::*standard-pprint-dispatch-table*
25
(declaim (inline sk-coerce-name sk-coerce-sequence))
27
(defun sk-coerce-name (name &optional (case :downcase))
28
(if (eql :downcase case) (string-downcase name) (string-upcase name)))
30
(defun sk-coerce-sequence (seq &optional limit)
37
(defun sk-print-slot (slot self &key (stream *standard-output*) (limit 8) (case :downcase))
38
(declare (stream stream) (skel self))
39
(let ((name (sb-mop:slot-definition-name slot))
41
(when (slot-boundp self name)
42
(let ((val (slot-value self name))
43
(name (sk-coerce-name name case)))
45
(string (format stream ":~A ~A~%" name val))
46
(cons (unless (sequence:emptyp val) (format stream ":~A ~A~%" name val)))
47
(vector (unless (sequence:emptyp val)
48
(format stream ":~A [" name)
49
(pprint-tabular stream (sk-coerce-sequence val limit) nil nil 2)
51
(if (and limit (> #2=(length val) #1=(the positive-fixnum limit)))
52
(format stream " ...~d]~%" (- #2# limit))
53
(format stream "]~%"))))
54
(hash-table (unless (zerop (hash-table-count val))
55
(format stream ":~A {" name)
56
(pprint-tabular stream (sk-coerce-sequence (hash-table-alist val) limit)
58
(if (and limit (> #4=(hash-table-count val) #3=(the positive-fixnum limit)))
59
(format stream " ...~d}~%" (- #4# limit))
60
(format stream "}~%"))))
61
(t (format stream ":~A ~A~%" name val)))))))
63
(defmethod sk-print ((self skel) &key (stream *standard-output*) (id t) exclude (case :downcase) direct (limit 8) &allow-other-keys)
64
(declare (stream stream) (positive-fixnum limit))
65
(let ((name (skel/core/obj::sk-slot-name self (when (eql :downcase case))))
68
(format stream "~S ~A~%"
70
(format-sxhash (obj/id:id self)))
71
(format stream "~S~%" name)))
73
(lambda (slot) (sk-print-slot slot self :stream stream :limit limit :case case))
74
(remove-if (lambda (x) (member (keywordicate (sb-mop:slot-definition-name x)) exclude))
76
(sb-mop:class-direct-slots (class-of self))
77
(sb-mop:class-slots (class-of self)))))