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 (:constructor make-pprint-dispatch-table
(&optional entries
))
19 (:copier nil
) ; needs a deep copy
21 ;; A list of all the entries (except for CONS entries below) in highest
22 ;; to lowest priority.
23 (entries nil
:type list
)
24 ;; A hash table mapping things to entries for type specifiers of the
25 ;; form (CONS (MEMBER <thing>)). If the type specifier is of this form,
26 ;; we put it in this hash table instead of the regular entries table.
27 (cons-entries (make-hash-table :test
'eql
) :read-only t
))
29 (declaim (freeze-type pprint-dispatch-table
))
32 (defmethod print-object ((table pprint-dispatch-table
) stream
)
33 (print-unreadable-object (table stream
:type t
:identity t
)))
35 ;;; These structures are mutually referential and we want to compile their
36 ;;; type-checks efficiently. Essentially the way to do that is define
37 ;;; each structure during both make-host passes. This is a KLUDGE.
39 (sb!xc
:deftype posn
() 'fixnum
)
41 (sb!xc
:defstruct
(queued-op (:constructor nil
)
45 (sb!xc
:defstruct
(block-end (:include queued-op
)
47 (suffix nil
:type
(or null simple-string
)))
49 (sb!xc
:defstruct
(section-start (:include queued-op
)
53 (section-end nil
:type
(or null newline block-end
)))
55 (sb!xc
:defstruct
(newline (:include section-start
)
58 :type
(member :linear
:fill
:miser
:literal
:mandatory
)))