1 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; This software is derived from the CMU CL system, which was
5 ;;;; written at Carnegie Mellon University and released into the
6 ;;;; public domain. The software is in the public domain and is
7 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
8 ;;;; files for more information.
10 (in-package "SB!FORMAT")
12 (define-condition format-error
(error reference-condition
)
13 ((complaint :reader format-error-complaint
:initarg
:complaint
)
14 (args :reader format-error-args
:initarg
:args
:initform nil
)
15 (control-string :reader format-error-control-string
16 :initarg
:control-string
17 :initform
*default-format-error-control-string
*)
18 (offset :reader format-error-offset
:initarg
:offset
19 :initform
*default-format-error-offset
*)
20 (second-relative :reader format-error-second-relative
21 :initarg
:second-relative
:initform nil
)
22 (print-banner :reader format-error-print-banner
:initarg
:print-banner
24 (:report %print-format-error
)
25 (:default-initargs
:references nil
))
27 (defun %print-format-error
(condition stream
)
29 "~:[~*~;error in ~S: ~]~?~@[~% ~A~% ~V@T^~@[~V@T^~]~]"
30 (format-error-print-banner condition
)
32 (format-error-complaint condition
)
33 (format-error-args condition
)
34 (format-error-control-string condition
)
35 (format-error-offset condition
)
36 (format-error-second-relative condition
)))
38 (defstruct format-directive
39 (string (missing-arg) :type simple-string
)
40 (start (missing-arg) :type
(and unsigned-byte fixnum
))
41 (end (missing-arg) :type
(and unsigned-byte fixnum
))
42 (character (missing-arg) :type character
)
43 (colonp nil
:type
(member t nil
))
44 (atsignp nil
:type
(member t nil
))
45 (params nil
:type list
))
46 (defmethod print-object ((x format-directive
) stream
)
47 (print-unreadable-object (x stream
)
48 (write-string (format-directive-string x
)
50 :start
(format-directive-start x
)
51 :end
(format-directive-end x
))))