Changeset 5327
- Timestamp:
- Oct 9, 2006, 2:18:35 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ccl/level-1/l1-reader.lisp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/level-1/l1-reader.lisp
r5318 r5327 26 26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 27 27 28 ;;; Maps character codes to character names, for (some of the) first 2K codes.29 (defvar *character-names* #2048(nil))30 31 28 ;;; Maps character names to characters 32 29 (defvar *name->char* (make-hash-table :test #'equalp)) 30 ;;; Maps characters to (canonical) character names. 31 (defvar *char->name* (make-hash-table :test #'eql)) 33 32 34 33 ;;; This isn't thread-safe. If the user really wants to register character 35 34 ;;; names from multiple threads, they should do their own locking. 36 35 (defun register-character-name (name char) 37 (let* ((code (char-code char))) 38 (when (>= code (length *character-names*)) 39 (setq *character-names* (%extend-vector 0 *character-names* (+ code 1024)))) 40 (setf (gethash name *name->char*) char) 41 (unless (svref *character-names* code) 42 (setf (svref *character-names* code) name)))) 36 (setf (gethash name *name->char*) char) 37 (unless (gethash char *char->name*) 38 (setf (gethash char *char->name*) name))) 43 39 44 40 (dolist (pair '( … … 48 44 ("Rubout" . #\177) ("Page" . #\014) ("Tab" . #\011) 49 45 ("Backspace" . #\010) ("Return" . #\015) ("Linefeed" . #\012) 50 ;; Other character names. (When available, standard names51 ;; should be used for printing in preference to any non-standard52 ;; names.)46 ;; Other character names. (When available, standard 47 ;; names should be used for printing in preference to 48 ;; any non-standard names.) 53 49 ("Null" . #\000) ("Nul" . #\000) 54 50 ("Bell" . #\007) ; ^G , used by Franz (and others with bells.) … … 58 54 ("PageDown" . #\014)("Formfeed" . #\014) ("FF" . #\014) 59 55 ("CR" . #\015) 56 ("Sub" . #\032) 60 57 ("ESC" . #\033) ("Escape" . #\033) ("Clear" . #\033) 61 58 ("Altmode" . #\033) ("ALT" . #\033) … … 1813 1810 ("Line_Separator" . #\u+2028) 1814 1811 ("Paragraph_Separator" . #\u+2029) 1812 ("Replacement_Character" . #\u+fffd) 1815 1813 )) 1816 1814 (destructuring-bind (name . char) pair
Note:
See TracChangeset
for help on using the changeset viewer.
