Speed up PSXHASH on complex numbers.
[sbcl.git] / src / code / host-pprint.lisp
blob9dd0a798b58d761e817629da38bae0452626aa63
1 ;;;; Common Lisp pretty printer definitions that need to be on the
2 ;;;; host
4 ;;;; This software is part of the SBCL system. See the README file for
5 ;;;; more information.
6 ;;;;
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
16 ;; a type-specifier.
17 (sb!xc:defstruct (pprint-dispatch-table
18 (:constructor make-pprint-dispatch-table (&optional entries))
19 (:copier nil) ; needs a deep copy
20 (:predicate nil))
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))
31 #+sb-xc
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)
42 (:copier nil))
43 (posn 0 :type posn))
45 (sb!xc:defstruct (block-end (:include queued-op)
46 (:copier nil))
47 (suffix nil :type (or null simple-string)))
49 (sb!xc:defstruct (section-start (:include queued-op)
50 (:constructor nil)
51 (:copier nil))
52 (depth 0 :type index)
53 (section-end nil :type (or null newline block-end)))
55 (sb!xc:defstruct (newline (:include section-start)
56 (:copier nil))
57 (kind (missing-arg)
58 :type (member :linear :fill :miser :literal :mandatory)))