Comment fix.
[bpt/emacs.git] / lisp / term / internal.el
CommitLineData
c6a6499f 1;;; internal.el --- support for PC internal terminal -*- coding: raw-text; -*-
c8b836f6 2
1bd62036 3;; Copyright (C) 1993, 1994, 1998, 1999, 2001 Free Software Foundation, Inc.
c8b836f6
RS
4
5;; Author: Morten Welinder <terra@diku.dk>
c8b836f6
RS
6
7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software; you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation; either version 2, or (at your option)
12;; any later version.
13
14;; GNU Emacs is distributed in the hope that it will be useful,
15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; GNU General Public License for more details.
18
19;; You should have received a copy of the GNU General Public License
2fe590dc
EN
20;; along with GNU Emacs; see the file COPYING. If not, write to the
21;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22;; Boston, MA 02111-1307, USA.
23
24;;; Code:
25
c8b836f6
RS
26;; ---------------------------------------------------------------------------
27;; keyboard setup -- that's simple!
28(set-input-mode nil nil 0)
c8b836f6
RS
29(define-key function-key-map [backspace] "\177") ; Normal behaviour for BS
30(define-key function-key-map [delete] "\C-d") ; ... and Delete
31(define-key function-key-map [tab] [?\t])
32(define-key function-key-map [linefeed] [?\n])
33(define-key function-key-map [clear] [11])
34(define-key function-key-map [return] [13])
35(define-key function-key-map [escape] [?\e])
36(define-key function-key-map [M-backspace] [?\M-\d])
6d435deb 37(define-key function-key-map [M-delete] [?\M-d])
c8b836f6
RS
38(define-key function-key-map [M-tab] [?\M-\t])
39(define-key function-key-map [M-linefeed] [?\M-\n])
40(define-key function-key-map [M-clear] [?\M-\013])
41(define-key function-key-map [M-return] [?\M-\015])
42(define-key function-key-map [M-escape] [?\M-\e])
43(put 'backspace 'ascii-character 127)
44(put 'delete 'ascii-character 127)
45(put 'tab 'ascii-character ?\t)
46(put 'linefeed 'ascii-character ?\n)
47(put 'clear 'ascii-character 12)
48(put 'return 'ascii-character 13)
49(put 'escape 'ascii-character ?\e)
0064ab85
EZ
50
51;; ----------------------------------------------------------------------
52;; DOS display setup
53;; =================
54;;
55;; DOS can only support a single font. On most systems (with the
56;; possible exception of Far Eastern DOS versions), this means that
57;; two character sets are available at any given time: the ASCII
58;; charset, and a single national charset, usually mapped to codes
59;; above 128 (i.e., with 8th bit set). Which national charset is
60;; supported depends on the codepage loaded by the system when it
61;; boots; usually, this codepage cannot be changed without
62;; rebooting.
63;;
64;; Since each codepage can usually display character of a single
65;; MULE charset, Emacs can display a single MULE charset with the
66;; glyphs of the current codepage. The mapping from DOS codepages
67;; to MULE charsets is established by the charset property of the
68;; cpNNN-decode-table variables in codepage.el, which also
69;; defines translation tables for each such pair, and a bunch of
70;; functions to generate coding systems that use those translation
71;; tables to convert codepage-encoded text to the appropriate MULE
72;; charset and back. When Emacs starts on DOS, it automatically
73;; sets its default coding systems for file I/O and terminal output
74;; according to the currend DOS codepage, given by the
75;; `dos-codepage' variable.
76;;
77;; This leaves us with the problem of displaying character sets
78;; other than the one which maps directly into the current codepage.
79;; The following functions and variables handle this nuisance by
80;; defining a display table where each character that doesn't have a
81;; glyph in some codepage is mapped to a string which represents it.
82;; For example, a small c with cedilla is mapped to the string
83;; "{,c}" (the braces serve as a sign that this is a single
84;; character). A nice feature of the display tables is that Emacs
85;; knows that the string represents a single character, and thus
86;; cursor motion works as you'd expect: a single `C-f' moves past
87;; the entire string which represents a single character.
88;; ----------------------------------------------------------------------
89
90(defvar IT-character-translations
91 '(
92 (latin-iso8859-1
93 . [255 "!I" "|c" "Pd" "$$" "Ye" "|" "SE" "\"" "(c)"
94 "_a" "<<" "~" "--" "(R)" "'-" "^o" "+-" "^2" "^3"
95 "'" "u" ".P" "^." "'," "^1" "_o" ">>" "1/4" "1/2"
96 "3/4" "?I" "`A" "A'" "A^" "~A" "\"A" "Ao" "AE" ",C"
f3a3ea9a 97 "`E" "E'" "E^" "\"E" "`I" "I'" "I^" "\"I" "-D" "~N"
0064ab85 98 "`O" "O'" "O^" "~O" "\"O" "*x" "/O" "`U" "U'" "U^"
f3a3ea9a 99 "\"U" "Y'" "-P" "ss" "`a" "a'" "a^" "~a" "\"a" "ao"
0064ab85 100 "ae" ",c" "`e" "e'" "e^" "\"e" "`i" "i'" "i^" "\"i"
f3a3ea9a
EZ
101 "-d" "~n" "`o" "o'" "o^" "~o" "\"o" "-:" "/o" "`u"
102 "u'" "u^" "\"u" "y'" "-p" "\"y"]
0064ab85
EZ
103 )
104 (latin-iso8859-2
105 . [255 "A;" "'(" "/L" "$$" "L<" "S'" "SE" "\"" "S<"
106 ",S" "T<" "Z'" "--" "Z<" "Z^." "^o" "a;" "';" "/l"
107 "'" "l<" "s'" "'<" "'," "s<" ",s" "t<" "z'" "'"
108 "z<" "z^." "R'" "A'" "A^" "A(" "\"A" "L'" "C'" ",C"
109 "C<" "E'" "E;" "E:" "E<" "I'" "I^" "D<" "/D" "N'"
110 "N<" "O'" "O^" "O''" "\"O" "*x" "R<" "U^0" "U'" "U''"
111 "\"U" "Y'" ",T" "ss" "r'" "a'" "a^" "a(" "\"a" "l'"
112 "c'" ",c" "c<" "e'" "e;" "\"e" "e<" "i'" "i^" "d<"
113 "/d" "n'" "n<" "o'" "o^" "o''" "\"o" "-:" "r<" "u^0"
114 "u'" "u''" "\"u" "y'" ",t" "'."]
115 )
116 (latin-iso8859-3
117 . [255 "/H" "'(" "Pd" "$$" " " "H^" "SE" "\"" "I^."
118 ",S" "G(" "J^" "--" " " "Z^." "^o" "/h" "^2" "^3"
119 "'" "u" "h^" "." "'," "i^." ",s" "g(" "j^" "1/2"
120 " " "z^." "`A" "A'" "A^" " " "\"A" "C^." "C^" ",C"
121 "`E" "E'" "E^" "\"E" "`I" "I'" "I^" "\"I" " " "~N"
122 "`O" "O'" "O^" "G^." "\"O" "*x" "G^" "`U" "U'" "U^"
123 "\"U" "U(" "S^" "ss" "`a" "a'" "a^" " " "\"a" "c^."
124 "c^" ",c" "`e" "e'" "e^" "\"e" "`i" "i'" "i^" "\"i"
125 " " "~n" "`o" "o'" "o^" "g^." "\"o" "-:" "g^" "`u"
126 "u'" "u^" "\"u" "u(" "s^" "^."]
127 )
128 (latin-iso8859-4
129 . [255 "A;" "kk" ",R" "$$" "?I" ",L" "SE" "\"" "S<"
130 "E-" ",G" "/T" "--" "Z<" "'-" "^o" "a;" "';" ",r"
131 "'" "~i" ",l" "'<" "'," "s<" "e-" ",g" "/t" "NG"
132 "z<" "ng" "A-" "A'" "A^" "~A" "\"A" "Ao" "AE" "I;"
133 "C<" "E'" "E;" "\"E" "E^." "I'" "I^" "I-" "/D" ",N"
134 "O-" ",K" "O^" "~O" "\"O" "*x" "/O" "U;" "U'" "U^"
135 "\"U" "~U" "U-" "ss" "a-" "a'" "a^" "~a" "\"a" "ao"
136 "ae" "i;" "c<" "e'" "e;" "\"e" "e^." "i'" "i^" "i-"
137 "/d" ",n" "o-" ",k" "o^" "~o" "\"o" "-:" "/o" "u;"
138 "u'" "u^" "\"u" "~u" "u-" "^."]
139 )
140 (cyrillic-iso8859-5
141 . [255 "\"E" "Dj" "Gj" "IE" "Dz" "Ii" "Ji" "JE" "Lj"
142 "Nj" "Ts" "Kj" 240 "V%" "Dzh" 65 "B=" 66 226
143 68 69 "Z%" 51 85 "J=" 75 "L=" 77 72
144 79 "P=" 80 67 84 89 232 88 "C=" "C%"
145 "S%" "Sc" "=\"" "Y=" "%\"" "Ee" "Yu" "Ya" 97 98
146 "v=" "g=" 103 101 "z%" "z=" 117 "j=" 107 "l="
147 "m=" "n=" 111 110 112 99 "t=" 121 "f=" 120
148 "c=" "c%" "s%" "sc" "='" "y=" "%'" "ee" "yu" "ya"
149 "N0" "\"e" "dj" "gj" "ie" "dz" "ii" "ji" "je" "lj"
150 "nj" "ts" "kj" 21 "v%" "dzh"]
151 )
152 (arabic-iso8859-6
153 . [255 nil nil nil "$$" nil nil nil nil nil
154 nil nil ",+" "--" nil nil nil nil nil nil
155 nil nil nil nil nil nil nil ";+" nil nil
156 nil "?+" nil "H'" "aM" "aH" "wH" "ah" "yH"
157 "a+" "b+" "tm" "t+" "tk" "g+" "hk" "x+" "d+" "dk"
158 "r+" "z+" "s+" "sn" "c+" "dd" "tj" "zH" "e+" "i+"
159 nil nil nil nil nil "++" "f+" "q+" "k+" "l+"
160 "m+" "n+" "h+" "w+" "j+" "y+" ":+" "\"+" "=+" "/+"
161 "'+" "1+" "3+" "0+" nil nil nil nil nil nil
162 nil nil nil nil nil nil nil]
163 )
164 (greek-iso8859-7
165 . [255 "9'" "'9" "Pd" nil nil "|" "SE" "\"" "(c)"
166 nil "<<" "~" "--" nil "-M" "^o" "+-" "^2" "^3"
c35ba278
EZ
167 "'" "'%" "'A" "^." "'E" "'H" "'I" ">>" "'O" "1/2"
168 "'Y" "W%" "i3" 65 66 "G*" "D*" 69 90 72
169 "TH" 73 74 "L*" 77 78 "C*" 79 "P*" 80
170 nil "S*" 84 89 "F*" 88 "Q*" "W*" "\"I" "\"Y"
0064ab85 171 "a%" "e%" "y%" "i%" "u3" "a*" "b*" "g*" "d*" "e*"
c35ba278
EZ
172 "z*" "y*" "h*" "i*" 107 "l*" "m*" "n*" "c*" 111
173 "p*" "r*" "*s" "s*" "t*" 117 "f*" "x*" "q*" "w*"
174 "\"i" "\"u" "'o" "'u" "'w" nil]
0064ab85
EZ
175 )
176 (hebrew-iso8859-8
177 . [255 nil "|c" "Pd" "$$" "Ye" "|" "SE" "\"" "(c)"
178 "*x" "<<" "~" "--" "(R)" "'-" "^o" "+-" "^2" "^3"
179 "'" "u" ".P" "^." "'," "^1" "-:" ">>" "1/4" "1/2"
180 "3/4" nil nil nil nil nil nil nil nil nil
181 nil nil nil nil nil nil nil nil nil nil
182 nil nil nil nil nil nil nil nil nil nil
183 nil nil nil "=2" "A+" "B+" "G+" "D+" "H+" "W+"
184 "Z+" "X+" "Tj" "J+" "K%" "K+" "L+" "M%" "M+" "N%"
185 "N+" "S+" "E+" "P%" "P+" "Zj" "ZJ" "Q+" "R+" "Sh"
186 "T+" nil nil nil nil nil]
187 )
188 (latin-iso8859-9
189 . [255 "!I" "|c" "Pd" "$$" "Ye" "|" "SE" "\"" "(c)"
190 "_a" "<<" "~" "--" "(R)" "'-" "^o" "+-" "^2" "^3"
191 "'" "u" ".P" "^." "'," "^1" "_o" ">>" "1/4" "1/2"
192 "3/4" "?I" "`A" "A'" "A^" "~A" "\"A" "Ao" "AE" ",C"
193 "`E" "E'" "E^" "\"E" "`I" "I'" "I^" "\"I" "G(" "~N"
194 "`O" "O'" "O^" "~O" "\"O" "*x" "/O" "`U" "U'" "U^"
195 "\"U" "I^." ",S" "ss" "`a" "a'" "a^" "~a" "\"a" "ao"
c35ba278 196 "ae" ",c" "`e" "e'" "e<" "\"e" "e^." "i'" "i^" "i-"
0064ab85 197 "g(" "~n" "`o" "o'" "o^" "~o" "\"o" "-:" "/o" "`u"
c35ba278
EZ
198 "u'" "u^" "\"u" "i." ",s" "\"y"]
199 )
200 (latin-iso8859-14
bb8aea86
EZ
201 . [255 "B`" "b`" "Pd" "C`" "c`" "D`" "SE" "`W" "(c)"
202 "W'" "d`" "`Y" "--" "(R)" "\"Y" "F`" "f`" "G`" "g`"
203 "M`" "m`" ".P" "P`" "`w" "p`" "w'" "S`" "`y" "\"W"
204 "\"w" "s`" "`A" "A'" "A^" "~A" "\"A" "Ao" "AE" ",C"
c35ba278
EZ
205 "`E" "E'" "E^" "\"E" "`I" "I'" "I^" "\"I" "W^" "~N"
206 "`O" "O'" "O^" "~O" "\"O" "T`" "/O" "`U" "U'" "U^"
207 "\"U" "Y'" "Y^" "ss" "`a" "a'" "a^" "~a" "\"a" "ao"
208 "ae" ",c" "`e" "e'" "e^" "\"e" "`i" "i'" "i^" "\"i"
bb8aea86 209 "w^" "~n" "`o" "o'" "o^" "~o" "\"o" "t`" "/o" "`u"
c35ba278
EZ
210 "u'" "u^" "\"u" "y'" "y^" "\"y"]
211 )
212 (latin-iso8859-15
f3a3ea9a 213 . [255 "!I" "|c" "Pd" "E=" "Ye" "S<" "SE" "s<" "(c)"
bb8aea86 214 "_a" "<<" "~" "--" "(R)" "'-" "^o" "+-" "^2" "^3"
c35ba278
EZ
215 "Z<" "u" ".P" "^." "z<" "^1" "_o" ">>" "OE" "oe"
216 "\"Y" "?I" "`A" "A'" "A^" "~A" "\"A" "Ao" "AE" ",C"
f3a3ea9a 217 "`E" "E'" "E^" "\"E" "`I" "I'" "I^" "\"I" "-D" "~N"
c35ba278 218 "`O" "O'" "O^" "~O" "\"O" "*x" "/O" "`U" "U'" "U^"
bb8aea86 219 "\"U" "Y'" "|P" "ss" "`a" "a'" "a^" "~a" "\"a" "ao"
c35ba278 220 "ae" ",c" "`e" "e'" "e^" "\"e" "`i" "i'" "i^" "\"i"
f3a3ea9a 221 "-d" "~n" "`o" "o'" "o^" "~o" "\"o" "-:" "/o" "`u"
bb8aea86 222 "u'" "u^" "\"u" "y'" "|p" "\"y"]
0064ab85
EZ
223 )
224 )
225 "An alist of MULE ISO-8859 character sets and the strings that
226should be used to represent the characters from each set on a DOS
227terminal which does not have corresponding glyphs built into the
228installed codepage.")
229
230(defun IT-display-table-setup (codepage &optional table)
f53c8bb2
EZ
231 "Set up display table TABLE for a DOS terminal which supports
232glyphs built into the codepage CODEPAGE.
0064ab85
EZ
233
234If TABLE is nil or omitted, `standard-display-table' is used."
235 (let* ((surrogates IT-character-translations)
236 (disp-tab (or table standard-display-table))
237 (built-in-set (cp-charset-for-codepage codepage))
238 (offset (cp-offset-for-codepage codepage))
239 (cp-decoder
240 (symbol-value (intern-soft (format "%s-decode-table" codepage))))
241 (cp-decoder-len (length cp-decoder))
242 (c offset)
243 association chset)
244 ;; Undo the effects of previous call (where they may have used
245 ;; a different codepage) by reverting the display table for the
246 ;; built-in charset to its pristine shape.
a88d2801 247 (while (< c 256)
0064ab85
EZ
248 (aset disp-tab (make-char built-in-set c) nil)
249 (setq c (1+ c)))
250 (while surrogates
251 (setq association (car surrogates))
252 (setq chset (car association))
253 (let* ((vector (cdr association))
254 (veclen (length vector))
255 (i 0)
256 glyph)
257 (while (< i veclen)
258 (setq glyph (aref vector i))
259 (if (and glyph
260 (or (not (equal chset built-in-set))
261 (>= i cp-decoder-len)
262 (null (aref cp-decoder i))))
263 (aset disp-tab (make-char chset (+ i (logand offset 127)))
264 (vconcat
265 (if (numberp glyph)
266 (char-to-string glyph)
267 (if (> (length glyph) 1) (concat "{" glyph "}")
268 glyph)))))
269 (setq i (1+ i))))
f53c8bb2 270 (setq surrogates (cdr surrogates)))))
0064ab85 271
8a3d1f8b
EZ
272(defvar IT-unicode-translations
273 '(
274 (mule-unicode-0100-24ff ; charset
275 256 ; base
276 256 563 ; first, last
277 [ "A-" "a-" "A(" "a(" "A;" "a;" "C'" "c'" "C>" "c>" ; Latin Extended-A
278 "C." "c." "C<" "c<" "D<" "d<" "D/" "d/" "E-" "e-"
279 "E(" "e(" "E." "e." "E;" "e;" "E<" "e<" "G>" "g>"
280 "G(" "g(" "G." "g." "G," "g," "H>" "h>" "H/" "h/"
281 "I~" "i~" "I-" "i-" "I(" "i(" "I;" "i;" "I." "i."
282 "IJ" "ij" "J>" "j>" "K," "k," "kk" "L'" "l'" "L,"
283 "l," "L<" "l<" "L." "l." "L/" "l/" "N'" "n'" "N,"
284 "n," "N<" "n<" "'n" "NG" "ng" "O-" "o-" "O(" "o("
285 "O\"" "o\"" "OE" "oe" "R'" "r'" "R," "r," "R<" "r<"
286 "S'" "s'" "S>" "s>" "S," "s," "S<" "s<" "T," "t,"
287 "T<" "t<" "T/" "t/" "U~" "u~" "U-" "u-" "U(" "u("
288 "U0" "u0" "U\"" "u\"" "U;" "u;" "W>" "w>" "Y>" "y>"
289 "Y:" "Z'" "z'" "Z." "z." "Z<" "z<" "s1" ; 017f
290 "b/" "B2" "=B" "=b" "B6" "b6" "!C" "C2" "c2" "-D" ;Lat. Extended-B
291 "D2" "=D" "=d" "!d" "!E" "-E" "Eps" "F2" "f2" "G2"
292 "V0" "hv" "io" "-I" "K2" "k2" "-l" "la-" "!M" "2N"
293 "n_" "-O" "O9" "o9" "OI" "oi" "P2" "p2" "'R" "!S"
294 "!s" "Esh" "!esh" "t~" "T2" "t2" "T~" "U9" "u9" "Ups"
295 "V2" "Y2" "y2" "Z/" "z/" "ED" "!ED" "!ed" "ed;" "2/"
296 "5-" "_5-" "ts" "wn" "|_" "||" "|=" "!_" "DZ<" "Dz<"
297 "dz<" "LJ3" "Lj3" "lj3" "NJ3" "Nj3" "nj3" "A<" "a<" "I<"
298 "i<" "O<" "o<" "U<" "u<" "U:-" "u:-" "U:'" "u:'" "U:<"
299 "u:<" "U:!" "u:!" "e1" "A:-" "a:-" "A.-" "a.-" "AE-" "ae-"
300 "G/" "g/" "G<" "g<" "K<" "k<" "O;" "o;" "O1" "o1"
301 "EZ" "ez" "j<" "DZ3" "Dz3" "dz3" "G'" "g'" "Hv" "Wn"
302 "N`" "n`" "AA'" "aa'" "AE'" "ae'" "O/'" "o/'" "A!!" "a!!"
303 "A)" "a)" "E!!" "e!!" "E)" "e)" "I!!" "i!!" "I)" "i)"
304 "O!!" "o!!" "O)" "o)" "R!!" "r!!" "R)" "r)" "U!!" "u!!"
305 "U)" "u)" ",S" ",s" ",T" ",t" "'3" "'3_" "H<" "h<"
306 nil nil "8" "8_" "Z2" "z2" "A." "a." "E," "e,"
307 "O:-" "o:-" "O~-" "o~-" "O." "o." "O.-" "o.-" "Y-" "y-"] ; 0x233
308
309 )
310
311 (mule-unicode-0100-24ff ; charset
312 256 ; base
313 884 1123 ; first, last
314 [ "'" "," nil nil nil nil "j3" nil nil nil ; Greek
315 "?;" nil nil nil nil nil "'*" "'%" "A%" ".*"
316 "E%" "Y%" "I%" nil "O%" nil "U%" "W%" "i3" "A*"
317 "B*" "G*" "D*" "E*" "Z*" "H*" "Th*" "I*" "K*" "L*"
318 "M*" "N*" "C*" "O*" "P*" "R*" nil "S*" "T*" "U*"
319 "F*" "X*" "Q*" "W*" "J*" "V*" "a%" "e%" "y%" "i%"
320 "u3" "a*" "b*" "g*" "d*" "e*" "z*" "h*" "th*" "i*"
321 "k*" "l*" "m*" "n*" "c*" "o*" "p*" "r*" "*s" "s*"
322 "t*" "u*" "f*" "x*" "q*" "w*" "j*" "v*" "o%" "u%"
323 "w%" nil "b3" "th%" "U2*" "'U2*" "U:2*" "ph*" "pi*" "ka*"
324 nil nil "Sti" "sti" "Dig" "dig" "Kop" "kop" "Sam" "sam"
325 "She" "she" "Fei" "fei" "Khe" "khe" "Hor" "hor" "Gan" "gan"
326 "Shi" "shi" "Dei" "dei" "ka*" "rh*" "ls*" "yo*" nil nil
327 nil nil nil nil nil nil nil nil nil nil
328 "IE'" "E:" "D%" "G%" "IE" "DS" "II" "YI" "J%" "LJ" ; Cyrillic
329 "NJ" "Ts" "KJ" "`I=" "V%" "DZ" 65 "B=" 66 "G="
330 68 69 "Z%" 51 85 "J=" 75 "L=" 77 72
331 79 "P=" 80 67 84 89 "F=" 88 "C=" "C%"
332 "S%" "Sc" "=\"" "Y=" "%\"" "Ee" "JU" "JA" 97 "b="
333 98 "g=" 103 101 "z%" "z=" 117 "j=" 107 "l="
334 109 "n=" 111 "p=" 112 99 "t=" 121 "f=" 120
335 "c=" "c%" "s%" "sc" "='" "y=" "%'" "ee" "ju" "ja"
336 "ie'" "e:" "d%" "g%" "ie" "ds" "ii" "yi" "j%" "lj"
337 "nj" "ts" "kj" "v%" "`i=" "dz" "OM=" "om=" "Y3" "y3"] ; 0x463
338 )
339
340 (mule-unicode-0100-24ff ; charset
341 256 ; base
342 1488 1645 ; first, last
343 [ "A+" "B+" "G+" "D+" "H+" "W+" "Z+" "X+" "Tj" "J+" ; Hebrew
344 "K%" "K+" "L+" "M%" "M+" "N%" "N+" "S+" "E+" "P%"
345 "P+" "Zj" "ZJ" "Q+" "R+" "Sh" "T+" nil nil nil
346 nil nil "WW+" "WJ+" "JJ+" "'+" "\"+" nil nil nil
347 nil nil nil nil nil nil nil nil nil nil
348 nil nil nil nil nil nil nil nil nil nil
349 ",+" nil nil nil nil nil nil nil nil nil ; Arabic
350 nil nil nil nil nil ";+" nil nil nil "?+"
351 nil "H'" "aM" "aH" "wH" "ah" "yH" "a+" "b+" "tm"
352 "t+" "tk" "g+" "hk" "x+" "d+" "dk" "r+" "z+" "s+"
353 "sn" "c+" "dd" "tj" "zH" "e+" "i+" nil nil nil
354 nil nil "++" "f+" "q+" "k+" "l+" "m+" "n+" "h+"
355 "w+" "j+" "y+" ":+" "\"+" "=+" "/+" "'+" "1+" "3+"
356 "0+" nil nil nil nil nil nil nil nil nil
357 nil nil nil nil "0a" "1a" "2a" "3a" "4a" "5a"
358 "6a" "7a" "8a" "9a" "a%" "a." "a," "a*" ]
359 )
360
361 (mule-unicode-0100-24ff ; charset
362 256 ; base
363 7680 9450 ; first, last
364 [ "A-0" "a-0" "B." "b." "B-." "b-." "B_" "b_" "C,'" "c,'" ; Lat Ext Add
365 "D." "d." "D-." "d-." "D_" "d_" "D," "d," "D->" "d->"
366 "E-!" "e-!" "E-'" "e-'" "E->" "e->" "E-?" "e-?" "E,(" "e,("
367 "F." "f." "G-" "g-" "H." "h." "H-." "h-." "H:" "h:"
368 "H," "h," "H-(" "h-(" "I-?" "i-?" "I:'" "i:'" "K'" "k'"
369 "K-." "k-." "K_" "k_" "L-." "l-." "_L-." "_l-." "L_" "l_"
370 "L->" "l->" "M'" "m'" "M." "m." "M-." "m-." "N." "n."
371 "N-." "n-." "N_" "n_" "N->" "n->" "O?'" "o?'" "O?:" "o?:"
372 "O-!" "o-!" "O-'" "o-'" "P'" "p'" "P." "p." "R." "r."
373 "R-." "r-." "_R-." "_r-." "R_" "r_" "S." "s." "S-." "s-."
374 "S'." "s'." "S<." "s<." ".S-." ".s-." "T." "t." "T-." "t-."
375 "T_" "t_" "T->" "t->" "U_:" "u_:" "U-?" "u-?" "U->" "u->"
376 "U?'" "u?'" "U-:" "u-:" "V?" "v?" "V-." "v-." "W!" "w!"
377 "W'" "w'" "W:" "w:" "W." "w." "W-." "w-." "X." "x."
378 "X:" "x:" "Y." "y." "Z>" "z>" "Z-." "z-." "Z_" "z_"
379 "h_" "t:" "w0" "y0" "a))" "s1." nil nil nil nil
380 "A-." "a-." "A2" "a2" "A>'" "a>'" "A>!" "a>!" "A>2" "a>2"
381 "A>~" "a>~" ".A>" ".a>" "A('" "a('" "A(!" "a(!" "A(2" "a(2"
382 "A(~" "a(~" ".A(" ".a(" "E-." "e-." "E2" "e2" "E~" "e~"
383 "E>'" "e>'" "E>!" "e>!" "E>2" "e>2" "E>~" "e>~" ".E>" ".e>"
384 "I2" "i2" "I-." "i-." "O-." "o-." "O2" "o2" "O>'" "o>'"
385 "O>!" "o>!" "O>2" "o>2" "O>~" "o>~" ".O>" ".o>" "O9'" "o9'"
386 "O9!" "o9!" "O92" "o92" "O9~" "o9~" ".O9" ".o9" "U-." "u-."
387 "U2" "u2" "U9'" "u9'" "U9!" "u9!" "U92" "u92" "U9~" "u9~"
388 ".U9" ".u9" "Y!" "y!" "Y-." "y-." "Y2" "y2" "Y~" "y~"
389 nil nil nil nil nil nil "a*," "a*;" nil nil ; Greek Ext (0x1f00)
390 nil nil nil nil "A*," "A*;" nil nil nil nil
391 nil nil "e*," "e*;" nil nil nil nil nil nil
392 "E*," "E*;" nil nil nil nil nil nil "y*," "y*;"
393 nil nil nil nil nil nil "Y*," "Y*;" nil nil
394 nil nil nil nil "i*," "i*;" nil nil nil nil
395 nil nil "I*," "I*;" nil nil nil nil nil nil
396 "o*," "o*;" nil nil nil nil nil nil "O*," "O*;"
397 nil nil nil nil nil nil "u*," "u*;" nil nil
398 nil nil nil nil nil "U*;" nil nil nil nil
399 nil nil "w*," "w*;" nil nil nil nil nil nil
400 "W*," "W*;" nil nil nil nil nil nil "a*!" "a*'"
401 "e*!" "e*'" "y*!" "y*'" "i*!" "i*'" "o*!" "o*'" "u*!" "u*'"
402 "w*!" "w*'" nil nil nil nil nil nil nil nil
403 nil nil nil nil nil nil nil nil nil nil
404 nil nil nil nil nil nil nil nil nil nil
405 nil nil nil nil nil nil nil nil nil nil
406 nil nil nil nil nil nil nil nil nil nil
407 nil nil "a*(" "a*-" nil "a*j" nil nil "a*~" nil
408 "A*(" "A*-" "A*!" "A*'" "A*J" ")*" "J3" ",," "?*" "?:"
409 nil "y*j" nil nil "y*?" nil "E*!" "E*'" "Y*!" "Y*'"
410 "Y*J" ",!" ",'" "?," "i*(" "i*-" nil nil nil nil
411 "i*?" nil "I*(" "I*-" "I*!" "I*'" nil ";!" ";'" "?;"
412 "u*(" "u*-" nil nil "r*," "r*;" "u*?" nil "U*(" "U*-"
413 "U*!" "U*'" "R*;" "!:" ":'" "!*" nil nil nil "w*j"
414 nil nil "w*?" nil "O*!" "O*'" "W*!" "W*'" "W*J" "/*"
415 ";;" nil nil nil "1N" "1M" "3M" "4M" "6M" nil ; Gen Punct
416 nil "1T" "1H" nil nil nil "LRM" "RLM" "-1" nil
417 nil "--" "---" "===" "!2" "=2" "'6" "'9" ".9" "9'"
418 "``" "''" ":9" "9``" "/-" "/=" "sb" "3b" nil ".."
419 "..." ".-" "LSep" "PSep" "LR[" "RL[" "PDF" "LRO" "RLO" 255
420 "%o" "%oo" "'" "''" "\"'" "`" "``" "```" ".^" "<,"
421 ",>" ":X" "!!" "?!" "'-" nil nil nil nil "-b"
422 "/f" nil nil nil nil nil nil nil nil nil
423 nil nil nil nil nil nil nil nil nil nil
424 nil nil nil nil nil nil nil nil nil nil
425 nil nil nil nil nil nil nil nil nil nil
426 nil nil nil nil "^0" nil nil nil "^4" "^5"
427 "^6" "^7" "^8" "^9" "^+" "^-" "^=" "^(" "^)" "^n"
428 "_0" "_1" "_2" "_3" "_4" "_5" "_6" "_7" "_8" "_9"
429 "_+" "_-" "_=" "_(" "_)" nil nil nil nil nil
430 nil nil nil nil nil nil nil nil nil nil
431 nil nil nil nil nil "Ff" "Li" nil nil "Pt"
432 nil "W=" "NIS" nil "E=" nil nil nil nil nil
433 nil nil nil nil nil nil nil nil nil nil
434 nil nil nil nil nil nil nil nil nil nil
435 nil nil nil nil nil nil nil nil nil nil
436 nil nil nil nil nil nil nil nil nil nil
437 nil nil nil nil nil nil nil nil nil nil
438 nil nil nil nil nil nil nil nil nil nil
439 nil nil nil nil nil nil nil nil nil nil
440 nil nil nil nil nil nil nil nil "a/c" "a/s"
441 nil "oC" nil "c/o" "c/u" "=e" nil "oF" nil nil
442 nil nil "-h" "=h" nil nil nil nil nil nil
443 "N0" "PO" nil nil nil nil "Re" nil "Rx" nil
444 "SM" "TEL" "TM" nil nil nil "Om" nil nil nil
445 "oK" "AO" nil nil "Est" nil nil nil nil nil
446 nil "Aleph" "Bet" "Gimel" "Dalet" "=i=" nil nil nil nil
447 nil nil nil nil nil nil nil nil nil nil
448 nil nil nil nil nil nil nil nil nil nil
449 nil "1/3" "2/3" "1/5" "2/5" "3/5" "4/5" "1/6" "5/6" "1/8"
450 "3/8" "5/8" "7/8" "1/" ".I" "II" "III" "IV" ".V" "VI"
451 "VII" "VIII" "IX" "X" "XI" "XII" ".L" ".C" ".D" ".M"
452 ".i" "ii" "iii" "iv" ".v" "vi" "vii" "viii" "ix" ".x"
453 "xi" ".l" ".c" ".d" ".m" "CD" "DD" "CoD" "CI" nil
454 nil nil nil nil nil nil nil nil nil nil
455 nil "<-" "|^" "->" "|v" "<->" "v|^" "^\\" "/^" "\\v"
456 "v/" "<-/" "/->" "<~" "~>" "<<-" "|^^" "->>" "|vv" "<-<"
457 ">->" "<-|" "_|^" "|->" "-|v" "_v|^" "<-?" "?->" "<-o" "o->"
458 "<~>" "<-/>" nil nil nil nil nil nil nil nil
459 nil nil nil nil nil nil nil nil nil nil
460 nil nil nil nil nil nil nil nil nil nil
461 nil nil nil "<=/" "<=/>" "/=>" "<=" "||^" "=>" "||v"
462 "<=>" "v||^" "^\\\\" "//^" "\\\\v" "v//" "<-=" "=->" nil nil
463 nil nil "<.." ":^" "..>" ":v" nil nil "<::" "::^"
464 "::>" "::v" nil nil nil nil nil nil nil nil
465 nil nil nil nil nil nil nil nil nil nil
466 nil nil nil nil "FA" "C." "dP" "TE" "~TE" "/0"
467 "DE" "NB" "(-" "~(-" "e-" "-)" "~-)" "-e" "QED" "*P"
468 nil "+Z" "--" "-+" ".+" "./" ".\\" "*-" "Ob" "Sb"
469 "SQR" "CBR" nil "0(" "00" "-L" "-V" nil nil ".|"
470 "~.|" "||" "/||" "AND" "OR" "(U" ")U" "In" "DI" nil
471 "Io" nil nil nil nil nil ".:" ":." ":R" "::"
472 ".-." "-:" ":-:" ":~:" "?~" "~?" "??" nil nil "/~"
473 "-~" "~-" "/~-" "~=" "~/=" "/~=" "~~" "/~~" nil nil
474 "=?" ")(" "v^" "^_" ".=" "=;" ".=." nil ":=" "=:"
475 nil "=o" "=)" "=^" "=v" "*=" "=<>" "=df" nil "?="
476 "!=" "-=" "!-=" "==" "=<" ">=" nil nil nil nil
477 "<<" ">>" "()" "/)(" "!<" "!>" nil nil nil nil
478 nil nil nil nil nil nil "<'" "`>" "=<'" "`>="
479 "~<'" "`>~" "/<'" "/`>" "(C" ")C" "/(C" "/)C" "(_" ")_"
480 "/(_" "/)_" nil nil nil nil nil nil nil nil
481 nil nil nil "0+" "0-" "0x" "0/" "0." "0o" "0*"
482 "0=" "0_" nil nil nil nil "|T" "T|" "-T" "_T"
483 nil nil nil nil nil nil nil nil nil nil
484 nil nil nil nil nil nil nil nil nil "-,-"
485 nil "XOR" "NAND" "NOR" nil nil nil nil nil nil
486 nil nil nil nil nil nil nil nil nil nil
487 nil nil nil nil nil nil nil nil "<." ".>"
488 "<<<" ">>>" nil nil nil nil nil nil nil nil
489 nil nil nil nil nil nil nil nil nil nil
490 nil nil ":3" "..." nil nil nil nil nil nil
491 nil nil nil nil nil nil nil nil nil nil
492 nil nil "Eh" nil nil nil nil nil "<7" ">7"
493 "7<" "7>" nil nil nil nil "~I" nil "(A" nil
494 nil "TR" nil "=||" "88" nil nil nil nil nil
495 nil nil "Iu" "Il" nil nil "-^-" "-`-" "D->" nil
496 nil "</" "/>" "<-D" nil nil nil nil nil nil
497 nil nil nil nil nil nil nil nil nil nil
498 nil nil nil nil nil nil nil nil nil nil
499 nil nil nil nil nil nil nil nil nil nil
500 nil nil nil nil nil nil nil nil nil nil
501 nil nil nil nil nil nil nil nil nil nil
502 nil nil nil nil nil nil nil nil nil nil
503 nil nil nil nil nil nil nil nil nil nil
504 nil nil nil nil nil nil nil nil nil nil
505 nil nil nil nil nil nil nil nil nil nil
506 nil nil nil nil nil nil nil nil nil nil
507 nil nil nil nil nil nil nil nil nil nil
508 nil nil nil nil nil nil nil nil nil nil
509 nil nil nil nil nil nil nil nil nil nil
510 nil nil nil nil nil nil nil nil nil nil
511 nil nil nil nil nil nil nil nil nil nil
512 nil nil nil nil nil nil nil nil nil nil
513 nil nil nil nil nil nil nil nil nil nil
514 nil nil nil nil nil nil nil nil nil nil
515 nil nil nil nil nil nil nil nil nil nil
516 nil nil nil nil nil nil nil nil nil nil
517 nil nil nil nil nil nil "NUL" "SOH" "STX" "ETX"
518 "EOT" "ENQ" "ACK" "BEL" "BS" "HT" "LF" "VT" "FF" "CR"
519 "SS" "SI" "DLE" "DC1" "DC2" "DC3" "DC4" "NAK" "SYN" "ETB"
520 "CAN" "EM" "SUB" "ESC" "FS" "GS" "RS" "US" "SP" "DEL"
521 "b/" ",_," "NL" nil "?^" nil nil nil nil nil
522 nil nil nil nil nil nil nil nil nil nil
523 nil nil nil nil nil nil nil nil nil nil
524 nil nil nil nil nil nil nil nil nil nil
525 nil nil nil nil nil nil nil nil nil nil
526 nil nil nil nil nil nil nil nil nil nil
527 nil nil "1-o" "2-o" "3-o" "4-o" "5-o" "6-o" "7-o" "8-o"
528 "9-o" "10-o" "11-o" "12-o" "13-o" "14-o" "15-o" "16-o" "17-o" "18-o"
529 "19-o" "20-o" "(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)"
530 "(9)" "(10)" "(11)" "(12)" "(13)" "(14)" "(15)" "(16)" "(17)" "(18)"
531 "(19)" "(20)" "1." "2." "3." "4." "5." "6." "7." "8."
532 "9." "10." "11." "12." "13." "14." "15." "16." "17." "18."
533 "19." "20." "(a)" "(b)" "(c)" "(d)" "(e)" "(f)" "(g)" "(h)"
534 "(i)" "(j)" "(k)" "(l)" "(m)" "(n)" "(o)" "(p)" "(q)" "(r)"
535 "(s)" "(t)" "(u)" "(v)" "(w)" "(x)" "(y)" "(z)" "A-o" "B-o"
536 "C-o" "D-o" "E-o" "F-o" "G-o" "H-o" "I-o" "J-o" "K-o" "L-o"
537 "M-o" "N-o" "O-o" "P-o" "Q-o" "R-o" "S-o" "T-o" "U-o" "V-o"
538 "W-o" "X-o" "Y-o" "Z-o" "a-o" "b-o" "c-o" "d-o" "e-o" "f-o"
539 "g-o" "h-o" "i-o" "j-o" "k-o" "l-o" "m-o" "n-o" "o-o" "p-o"
540 "q-o" "r-o" "s-o" "t-o" "u-o" "v-o" "w-o" "x-o" "y-o" "z-o"
541 "0-o" ]
542 )
543 )
544
545 "A list of mule-unicode-* character sets and the strings that
546should be used to represent the characters from each set on a DOS
547terminal which does not have corresponding glyphs built into the
548installed codepage.")
549
550(defun IT-setup-unicode-display (&optional table)
551 "Set up display table TABLE for displaying mule-unicode-* characters
552on a DOS terminal. If TABLE is nil or omitted, `standard-display-table'
553is used."
554 (interactive)
555 (let ((disp-tab (or table standard-display-table))
556 (tail IT-unicode-translations)
557 translation)
558 (while tail
559 (setq translation (car tail) tail (cdr tail))
560 (let* ((chset (car translation))
561 (base (nth 1 translation))
562 (first (nth 2 translation))
563 (last (nth 3 translation))
564 (table (nth 4 translation))
565 (i 0)
566 (this (- first base))
567 glyph)
568 (while (<= i (- last first))
569 (setq glyph (aref table i))
570 (if glyph
571 (aset disp-tab (make-char chset
572 (+ (/ this 96) 32)
573 (+ (% this 96) 32))
574 (vconcat
575 (if (numberp glyph)
576 (char-to-string glyph)
577 (if (> (length glyph) 1) (concat "{" glyph "}")
578 glyph)))))
579 (setq i (1+ i) this (1+ this)))))))
580
08baac3d
EZ
581(defun dos-cpNNN-setup (codepage)
582 "Set up the MULE environment using the DOS codepage CODEPAGE.
0064ab85 583
08baac3d
EZ
584This function creates the coding system cpNNN (where NNN is the value
585of the argument CODEPAGE), and then uses this coding system to set up
586display tables, and the language environment options as appropriate."
587 (let* ((cp (format "cp%s" codepage))
0064ab85
EZ
588 (charset (cp-charset-for-codepage cp))
589 (offset (cp-offset-for-codepage cp)))
590 (cp-make-coding-systems-for-codepage cp charset offset)
591 ;; This is done by set-language-environment.
592 ;;(setq nonascii-translation-table
593 ;; (symbol-value (intern (concat cp "-nonascii-translation-table"))))
594 (set-language-environment (cp-language-for-codepage cp))
595 (set-default-coding-systems (intern (concat cp "-dos")))
4de8f97e 596 (set-selection-coding-system (intern (concat cp "-dos")))
0064ab85
EZ
597 (set-terminal-coding-system
598 (setq default-terminal-coding-system (intern (concat cp
599 "-unix"))))
600 (IT-display-table-setup cp)
3e9c24f6 601 (prefer-coding-system (intern (concat cp "-dos")))
e1b674a1
EZ
602 (if default-enable-multibyte-characters
603 ;; We want this in multibyte version only, since unibyte version
604 ;; should not convert non-ASCII characters at all.
605 (setq unibyte-display-via-language-environment t)
606 ;; Let the unibyte version behave as Emacs 19 did. In particular,
607 ;; let it use and display native codepage-specific glyphs for
608 ;; non-ASCII characters. For this to work correctly, we need to
609 ;; establish the correspondence between lower-case letters and their
610 ;; upper-case brethren, as appropriate for the codepage in use. The
611 ;; code below makes this happen.
612 ;; (In the multibyte mode, the appropriate tables are prepared
613 ;; elsewhere, since multibyte Emacs uses normal MULE character sets,
614 ;; which are supported on all platforms.)
615 (let* ((i 128)
616 (modify (function
617 (lambda (ch sy)
618 (modify-syntax-entry ch sy text-mode-syntax-table)
619 (if (boundp 'tex-mode-syntax-table)
620 (modify-syntax-entry ch sy tex-mode-syntax-table))
621 (modify-syntax-entry ch sy (standard-syntax-table))
622 )))
623 (table (standard-case-table))
624 ;; The following are strings of letters, first lower then
625 ;; upper case. This will look funny on terminals which
626 ;; display other code pages. In particular, what is
627 ;; displayed as blanks or triangles are not what they
14185565 628 ;; look like at all! (Use `C-x =' to see what they
e1b674a1
EZ
629 ;; really are.)
630 (chars
631 (cond
08baac3d 632 ((= codepage 850)
e1b674a1 633