1 ;;;; Common Lisp pretty printer definitions that need to be on the
4 ;;;; This software is part of the SBCL system. See the README file for
7 ;;;; This software is derived from the CMU CL system, which was
8 ;;;; written at Carnegie Mellon University and released into the
9 ;;;; public domain. The software is in the public domain and is
10 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
11 ;;;; files for more information.
13 (in-package "SB!PRETTY")
15 ;; This comes early so that fndb can use PPRINT-DISPATCH-TABLE as
17 (sb!xc
:defstruct
(pprint-dispatch-table
18 (:conc-name pp-dispatch-
)
19 (:constructor make-pprint-dispatch-table
(&optional entries
))
20 (:copier nil
) ; needs a deep copy
22 ;; A list of all the entries (except for CONS entries below) in highest
23 ;; to lowest priority.
24 (entries nil
:type list
)
25 ;; A hash table mapping things to entries for type specifiers of the
26 ;; form (CONS (MEMBER <thing>)). If the type specifier is of this form,
27 ;; we put it in this hash table instead of the regular entries table.
28 (cons-entries (make-hash-table :test
'eql
) :read-only t
)
29 ;; NIL if this this table can't match any numeric type.
30 ;; The conservative value is T.
31 (number-matchable-p nil
))
33 (declaim (freeze-type pprint-dispatch-table
))
36 (defmethod print-object ((table pprint-dispatch-table
) stream
)
37 (print-unreadable-object (table stream
:type t
:identity t
)))
39 ;;; These structures are mutually referential and we want to compile their
40 ;;; type-checks efficiently. Essentially the way to do that is define
41 ;;; each structure during both make-host passes. This is a KLUDGE.
43 (sb!xc
:deftype posn
() 'fixnum
)
45 (sb!xc
:defstruct
(queued-op (:constructor nil
)
49 (sb!xc
:defstruct
(block-end (:include queued-op
)
51 (suffix nil
:type
(or null simple-string
)))
53 (sb!xc
:defstruct
(section-start (:include queued-op
)
57 (section-end nil
:type
(or null newline block-end
)))
59 (sb!xc
:defstruct
(newline (:include section-start
)
62 :type
(member :linear
:fill
:miser
:literal
:mandatory
)))