annotate lisp/prim/disp-table.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children ac2d302a0011
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; disp-table.el --- functions for dealing with char tables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright (C) 1987, 1994 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Copyright (C) 1995 Sun Microsystems.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Author: Howard Gayle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; Maintainer: FSF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; Keywords: i18n
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; along with XEmacs; see the file COPYING. If not, write to the Free
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;; Synched up with: Not synched with FSF.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;; #### Need lots of work. make-display-table depends on a value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;; that is a define in the C code. Maybe we should just move the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;; function into C.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;; #### display-tables-as-vectors is really evil and a big pain in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;;; the ass.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;; Rewritten for XEmacs July 1995, Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (defun describe-display-table (dt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 "Describe the display table DT in a help buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (with-displaying-help-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (princ "\nCharacter display glyph sequences:\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (set-buffer standard-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (let ((vector (make-vector 256 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (i 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (while (< i 256)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (aset vector i (aref dt i))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (setq i (1+ i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (describe-vector vector)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (defun describe-current-display-table (&optional domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 "Describe the display table in use in the selected window and buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (or domain (setq domain (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (let ((disptab (specifier-instance current-display-table domain)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (if disptab
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (describe-display-table disptab)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (message "No display table"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (defun make-display-table ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 "Return a new, empty display table."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (make-vector 256 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 ;; #### we need a generic frob-specifier function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 ;; #### this also needs to be redone like frob-face-property.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;; Let me say one more time how much dynamic scoping sucks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (defun frob-display-table (fdt-function fdt-locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (or fdt-locale (setq fdt-locale 'global))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (or (specifier-spec-list current-display-table fdt-locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (add-spec-to-specifier current-display-table (make-display-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 fdt-locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (add-spec-list-to-specifier
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 current-display-table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (list (cons fdt-locale
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 #'(lambda (fdt-x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (funcall fdt-function (cdr fdt-x))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 fdt-x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (cdar (specifier-spec-list current-display-table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 fdt-locale)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (defun standard-display-8bit-1 (dt l h)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (while (<= l h)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (aset dt l (char-to-string l))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (setq l (1+ l))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (defun standard-display-8bit (l h &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 "Display characters in the range L to H literally."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (frob-display-table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 #'(lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (standard-display-8bit-1 x l h))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (defun standard-display-default-1 (dt l h)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (while (<= l h)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (aset dt l nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (setq l (1+ l))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (defun standard-display-default (l h &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 "Display characters in the range L to H using the default notation."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (frob-display-table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 #'(lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (standard-display-default-1 x l h))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (defun standard-display-ascii (c s &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 "Display character C using printable string S."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (frob-display-table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 #'(lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (aset x c s))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 ;;; #### should frob in a 'tty locale.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (defun standard-display-g1 (c sc &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 "Display character C as character SC in the g1 character set.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 This function assumes that your terminal uses the SO/SI characters;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 it is meaningless for an X frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (frob-display-table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 #'(lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (aset x c (concat "\016" (char-to-string sc) "\017")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ;;; #### should frob in a 'tty locale.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (defun standard-display-graphic (c gc &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 "Display character C as character GC in graphics character set.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 This function assumes VT100-compatible escapes; it is meaningless for an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 X frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (frob-display-table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 #'(lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (aset x c (concat "\e(0" (char-to-string gc) "\e(B")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 ;;; #### should frob in a 'tty locale.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 ;;; #### the FSF equivalent of this makes this character be displayed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 ;;; in the 'underline face. There's no current way to do this with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 ;;; XEmacs display tables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (defun standard-display-underline (c uc &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 "Display character C as character UC plus underlining."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (frob-display-table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 #'(lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (aset x c (concat "\e[4m" (char-to-string uc) "\e[m")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (defun standard-display-european (arg &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 "Toggle display of European characters encoded with ISO 8859.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 When enabled, characters in the range of 160 to 255 display not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 as octal escapes, but as accented characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 With prefix argument, enable European character display iff arg is positive."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (frob-display-table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 #'(lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (if (or (<= (prefix-numeric-value arg) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (and (null arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (equal (aref x 160) (char-to-string 160))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (standard-display-default-1 x 160 255)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (standard-display-8bit-1 x 160 255)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (provide 'disp-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 ;;; disp-table.el ends here