ILISP and SBCL left me very deeply nested in the debugger. In the
short term, this change will probably provoke more ILISP/SBCL
squabbles, but hopefully it will be an improvement in the long run.)
-?? minor incompatible change: The default output representation for
- unprintable ASCII characters which, unlike e.g. #\Newline, don't
- have names defined in the ANSI Common Lisp standard, is now based
- on their ASCII symbolic names: #\Nul, #\Soh, #\Stx, etc.
+* minor incompatible change: The CHAR-NAME of unprintable ASCII
+ characters which, unlike e.g. #\Newline and #\Tab, don't have names
+ specified in the ANSI Common Lisp standard, is now based on their
+ ASCII symbolic names (#\Nul, #\Soh, #\Stx, etc.) The old CMU CL
+ names (#\Null, #\^a, #\^b, etc.) are still accepted by NAME-CHAR.
?? Old operator names in the style DEF-FOO are now deprecated in
favor of new corresponding names DEFINE-FOO, for consistency with
the naming convention used in the ANSI standard (DEFSTRUCT, DEFVAR,
leaving some filing for later:-) from the monster
EVAL/EVAL-WHEN/%COMPILE/DEFUN/DEFSTRUCT cleanup:
** made inlining DEFUN inside MACROLET work again
-* incompatible changes listed in NEWS:
- ** changed default output representation of *PRINT-ESCAPE*-ed
- unprintable ASCII characters to #\Nul, #\Soh, etc.
+ ** (SB-DEBUG:BACKTRACE) output should start with something
+ including the name BACKTRACE, not (as in 0.pre7.88)
+ just "0: (\"hairy arg processor\" ...)"
* more renaming in global external names:
** used DEFINE-THE-FOO-THING and DEFFOO style consistently (and
deprecated supported extensions named in the DEF-FOO
(deftype char-code ()
`(integer 0 (,char-code-limit)))
+;;; This is the alist of (character-name . character) for characters
+;;; with long names. The first name in this list for a given character
+;;; is used on typeout and is the preferred form for input.
(macrolet ((frob (char-names-list)
(collect ((results))
(dolist (code char-names-list)
(destructuring-bind (ccode names) code
(dolist (name names)
(results (cons name (code-char ccode))))))
- `(defparameter *char-name-alist* ',(results)
- #!+sb-doc
- "This is the alist of (character-name . character) for characters with
- long names. The first name in this list for a given character is used
- on typeout and is the preferred form for input."))))
- (frob ((#x00 ("Null" "^@" "Nul"))
- (#x01 ("^a" "Soh"))
- (#x02 ("^b" "Stx"))
- (#x03 ("^c" "Etx"))
- (#x04 ("^d" "Eot"))
- (#x05 ("^e" "Enq"))
- (#x06 ("^f" "Ack"))
- (#x07 ("Bell" "^g" "Bel"))
- (#x08 ("Backspace" "^h" "Bs"))
- (#x09 ("Tab" "^i" "Ht"))
- (#x0A ("Newline" "Linefeed" "^j" "Lf" "Nl" ))
+ `(defparameter *char-name-alist* ',(results)))))
+ ;; Note: The *** markers here indicate character names which are
+ ;; required by the ANSI specification of #'CHAR-NAME. For the others,
+ ;; we prefer the ASCII standard name.
+ (frob ((#x00 ("Nul" "Null" "^@"))
+ (#x01 ("Soh" "^a"))
+ (#x02 ("Stx" "^b"))
+ (#x03 ("Etx" "^c"))
+ (#x04 ("Eot" "^d"))
+ (#x05 ("Enq" "^e"))
+ (#x06 ("Ack" "^f"))
+ (#x07 ("Bel" "Bell" "^g"))
+ (#x08 ("Backspace" "^h" "Bs")) ; *** See Note above.
+ (#x09 ("Tab" "^i" "Ht")) ; *** See Note above.
+ (#x0A ("Newline" "Linefeed" "^j" "Lf" "Nl" )) ; *** See Note above.
(#x0B ("Vt" "^k"))
- (#x0C ("Page" "^l" "Form" "Formfeed" "Ff" "Np"))
- (#x0D ("Return" "^m" "Cr"))
- (#x0E ("^n" "So"))
- (#x0F ("^o" "Si"))
- (#x10 ("^p" "Dle"))
- (#x11 ("^q" "Dc1"))
- (#x12 ("^r" "Dc2"))
- (#x13 ("^s" "Dc3"))
- (#x14 ("^t" "Dc4"))
- (#x15 ("^u" "Nak"))
- (#x16 ("^v" "Syn"))
- (#x17 ("^w" "Etb"))
- (#x18 ("^x" "Can"))
- (#x19 ("^y" "Em"))
- (#x1A ("^z" "Sub"))
- (#x1B ("Escape" "^[" "Altmode" "Esc" "Alt"))
- (#x1C ("^\\" "Fs"))
- (#x1D ("^]" "Gs"))
- (#x1E ("^^" "Rs"))
- (#x1F ("^_" "Us"))
- (#x20 ("Space" "Sp"))
- (#x7f ("Rubout" "Delete" "Del")))))
+ (#x0C ("Page" "^l" "Form" "Formfeed" "Ff" "Np")) ; *** See Note above.
+ (#x0D ("Return" "^m" "Cr")) ; *** See Note above.
+ (#x0E ("So" "^n"))
+ (#x0F ("Si" "^o"))
+ (#x10 ("Dle" "^p"))
+ (#x11 ("Dc1" "^q"))
+ (#x12 ("Dc2" "^r"))
+ (#x13 ("Dc3" "^s"))
+ (#x14 ("Dc4" "^t"))
+ (#x15 ("Nak" "^u"))
+ (#x16 ("Syn" "^v"))
+ (#x17 ("Etb" "^w"))
+ (#x18 ("Can" "^x"))
+ (#x19 ("Em" "^y"))
+ (#x1A ("Sub" "^z"))
+ (#x1B ("Esc" "Escape" "^[" "Altmode" "Alt"))
+ (#x1C ("Fs" "^\\"))
+ (#x1D ("Gs" "^]"))
+ (#x1E ("Rs" "^^"))
+ (#x1F ("Us" "^_"))
+ (#x20 ("Space" "Sp")) ; *** See Note above.
+ (#x7f ("Rubout" "Delete" "Del"))))) ; *** See Note above.
\f
;;;; accessor functions
(defun char-int (char)
#!+sb-doc
- "Return the integer code of CHAR. This is the same as char-code, as
- CMU Common Lisp does not implement character bits or fonts."
+ "Return the integer code of CHAR. (In SBCL this is the same as CHAR-CODE, as
+ there are no character bits or fonts.)"
(char-code char))
(defun code-char (code)
(defun character (object)
#!+sb-doc
- "Coerces its argument into a character object if possible. Accepts
+ "Coerce OBJECT into a CHARACTER if possible. Legal inputs are
characters, strings and symbols of length 1."
(flet ((do-error (control args)
(error 'simple-type-error
(defun char-name (char)
#!+sb-doc
- "Given a character object, char-name returns the name for that
- object (a symbol)."
+ "Return the name (a STRING) for a CHARACTER object."
(car (rassoc char *char-name-alist*)))
(defun name-char (name)
#!+sb-doc
- "Given an argument acceptable to string, name-char returns a character
- object whose name is that symbol, if one exists. Otherwise, () is returned."
+ "Given an argument acceptable to STRING, NAME-CHAR returns a character
+ whose name is that string, if one exists. Otherwise, NIL is returned."
(cdr (assoc (string name) *char-name-alist* :test #'string-equal)))
\f
;;;; predicates
--- /dev/null
+;;;; various CHARACTER tests without side-effects
+
+;;;; This software is part of the SBCL system. See the README file for
+;;;; more information.
+;;;;
+;;;; While most of SBCL is derived from the CMU CL system, the test
+;;;; files (like this one) were written from scratch after the fork
+;;;; from CMU CL.
+;;;;
+;;;; This software is in the public domain and is provided with
+;;;; absolutely no warranty. See the COPYING and CREDITS files for
+;;;; more information.
+
+(cl:in-package :cl-user)
+
+;;; ANSI's specification of #'CHAR-NAME imposes these constraints.
+;;;
+;;; (Obviously, the numeric values in this test implicitly assume
+;;; we're using an ASCII-based character set.)
+(dolist (i '(("Newline" 10)
+ ;; (ANSI also imposes a constraint on the "semi-standard
+ ;; character" "Linefeed", but in ASCII as interpreted by
+ ;; Unix it's shadowed by "Newline" and so doesn't exist
+ ;; as a separate character.)
+ ("Space" 32)
+ ("Tab" 9)
+ ("Page" 12)
+ ("Rubout" 127)
+ ("Return" 13)
+ ("Backspace" 8)))
+ (destructuring-bind (name code) i
+ (let ((named-char (name-char name))
+ (coded-char (code-char code)))
+ (assert (eql named-char coded-char))
+ (assert (characterp named-char))
+ (let ((coded-char-name (char-name coded-char)))
+ (assert (string= name coded-char-name))))))
;;; for internal versions, especially for internal versions off the
;;; main CVS branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.pre7.88"
+"0.pre7.89"