aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2005-04-12 10:27:29 +0000
committerYAMAMOTO Mitsuharu2005-04-12 10:27:29 +0000
commit92a607bd5cc831da930acfa4c02f2a5705105100 (patch)
tree0ad9b677272f1f8f0ef9eee99eea9944d116325e
parent9c5501d9ee5d122b69777ef52927fd54dbfab43e (diff)
downloademacs-92a607bd5cc831da930acfa4c02f2a5705105100.tar.gz
emacs-92a607bd5cc831da930acfa4c02f2a5705105100.zip
(kTextEncodingMacRoman, kTextEncodingISOLatin1)
(kTextEncodingISOLatin2): Remove constants. (mac-script-code-coding-systems): New constant. (mac-handle-language-change): New function. (special-event-map): Bind it to `language-change' event. (mac-centraleurroman, mac-cyrillic): New coding systems. (mac-font-encoder-list, ccl-encode-mac-centraleurroman-font) (ccl-encode-mac-cyrillic-font): Rename mac-centraleurroman-encoder and mac-cyrillic-encoder to encode-mac-centraleurroman and encode-mac-cyrillic, respectively.
-rw-r--r--lisp/term/mac-win.el124
1 files changed, 62 insertions, 62 deletions
diff --git a/lisp/term/mac-win.el b/lisp/term/mac-win.el
index ae2003fcee2..ca2a5707af9 100644
--- a/lisp/term/mac-win.el
+++ b/lisp/term/mac-win.el
@@ -1085,13 +1085,29 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
1085(put 'escape 'ascii-character ?\e) 1085(put 'escape 'ascii-character ?\e)
1086 1086
1087 1087
1088;;;; Keysyms 1088;;;; Keyboard layout/language change events
1089 1089(defconst mac-script-code-coding-systems
1090;; Define constant values to be set to mac-keyboard-text-encoding 1090 '((0 . mac-roman) ; smRoman
1091(defconst kTextEncodingMacRoman 0) 1091 (1 . japanese-shift-jis) ; smJapanese
1092(defconst kTextEncodingISOLatin1 513 "0x201") 1092 (2 . chinese-big5) ; smTradChinese
1093(defconst kTextEncodingISOLatin2 514 "0x202") 1093 (3 . korean-iso-8bit) ; smKorean
1094 1094 (7 . mac-cyrillic) ; smCyrillic
1095 (25 . chinese-iso-8bit) ; smSimpChinese
1096 (29 . mac-centraleurroman) ; smCentralEuroRoman
1097 )
1098 "Alist of Mac script codes vs Emacs coding systems.")
1099
1100;;;; Keyboard layout/language change events
1101(defun mac-handle-language-change (event)
1102 (interactive "e")
1103 (let ((coding-system
1104 (cdr (assq (car (cadr event)) mac-script-code-coding-systems))))
1105 (set-keyboard-coding-system (or coding-system 'mac-roman))
1106 ;; MacJapanese maps reverse solidus to ?\x80.
1107 (if (eq coding-system 'japanese-shift-jis)
1108 (define-key key-translation-map [?\x80] "\\"))))
1109
1110(define-key special-event-map [language-change] 'mac-handle-language-change)
1095 1111
1096;;;; Selections and cut buffers 1112;;;; Selections and cut buffers
1097 1113
@@ -1139,21 +1155,14 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
1139 1155
1140(setq frame-creation-function 'x-create-frame-with-faces) 1156(setq frame-creation-function 'x-create-frame-with-faces)
1141 1157
1142(define-ccl-program ccl-encode-mac-roman-font 1158(cp-make-coding-system
1143 `(0 1159 mac-centraleurroman
1144 (if (r0 != ,(charset-id 'ascii)) 1160 (apply
1145 (if (r0 <= ?\x8f) 1161 'vector
1146 (translate-character mac-roman-encoder r0 r1) 1162 (mapcar
1147 ((r1 <<= 7) 1163 (lambda (c) (decode-char 'ucs c))
1148 (r1 |= r2) 1164 ;; mac-centraleurroman (128..255) -> UCS mapping
1149 (translate-character mac-roman-encoder r0 r1))))) 1165 [ #x00C4 ;; 128:LATIN CAPITAL LETTER A WITH DIAERESIS
1150 "CCL program for Mac Roman font")
1151
1152(let
1153 ((encoding-vector (make-vector 256 nil))
1154 (i 0)
1155 (vec ;; mac-centraleurroman (128..255) -> UCS mapping
1156 [ #x00C4 ;; 128:LATIN CAPITAL LETTER A WITH DIAERESIS
1157 #x0100 ;; 129:LATIN CAPITAL LETTER A WITH MACRON 1166 #x0100 ;; 129:LATIN CAPITAL LETTER A WITH MACRON
1158 #x0101 ;; 130:LATIN SMALL LETTER A WITH MACRON 1167 #x0101 ;; 130:LATIN SMALL LETTER A WITH MACRON
1159 #x00C9 ;; 131:LATIN CAPITAL LETTER E WITH ACUTE 1168 #x00C9 ;; 131:LATIN CAPITAL LETTER E WITH ACUTE
@@ -1281,26 +1290,18 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
1281 #x017C ;; 253:LATIN SMALL LETTER Z WITH DOT ABOVE 1290 #x017C ;; 253:LATIN SMALL LETTER Z WITH DOT ABOVE
1282 #x0122 ;; 254:LATIN CAPITAL LETTER G WITH CEDILLA 1291 #x0122 ;; 254:LATIN CAPITAL LETTER G WITH CEDILLA
1283 #x02C7 ;; 255:CARON 1292 #x02C7 ;; 255:CARON
1284 ]) 1293 ]))
1285 translation-table) 1294 "Mac Central European Roman Encoding (MIME:x-mac-centraleurroman).")
1286 (while (< i 128) 1295(coding-system-put 'mac-centraleurroman 'mime-charset 'x-mac-centraleurroman)
1287 (aset encoding-vector i i) 1296
1288 (setq i (1+ i))) 1297(cp-make-coding-system
1289 (while (< i 256) 1298 mac-cyrillic
1290 (aset encoding-vector i 1299 (apply
1291 (decode-char 'ucs (aref vec (- i 128)))) 1300 'vector
1292 (setq i (1+ i))) 1301 (mapcar
1293 (setq translation-table 1302 (lambda (c) (decode-char 'ucs c))
1294 (make-translation-table-from-vector encoding-vector)) 1303 ;; mac-cyrillic (128..255) -> UCS mapping
1295;; (define-translation-table 'mac-centraleurroman-decoder translation-table) 1304 [ #x0410 ;; 128:CYRILLIC CAPITAL LETTER A
1296 (define-translation-table 'mac-centraleurroman-encoder
1297 (char-table-extra-slot translation-table 0)))
1298
1299(let
1300 ((encoding-vector (make-vector 256 nil))
1301 (i 0)
1302 (vec ;; mac-cyrillic (128..255) -> UCS mapping
1303 [ #x0410 ;; 128:CYRILLIC CAPITAL LETTER A
1304 #x0411 ;; 129:CYRILLIC CAPITAL LETTER BE 1305 #x0411 ;; 129:CYRILLIC CAPITAL LETTER BE
1305 #x0412 ;; 130:CYRILLIC CAPITAL LETTER VE 1306 #x0412 ;; 130:CYRILLIC CAPITAL LETTER VE
1306 #x0413 ;; 131:CYRILLIC CAPITAL LETTER GHE 1307 #x0413 ;; 131:CYRILLIC CAPITAL LETTER GHE
@@ -1428,27 +1429,16 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
1428 #x044D ;; 253:CYRILLIC SMALL LETTER E 1429 #x044D ;; 253:CYRILLIC SMALL LETTER E
1429 #x044E ;; 254:CYRILLIC SMALL LETTER YU 1430 #x044E ;; 254:CYRILLIC SMALL LETTER YU
1430 #x20AC ;; 255:EURO SIGN 1431 #x20AC ;; 255:EURO SIGN
1431 ]) 1432 ]))
1432 translation-table) 1433 "Mac Cyrillic Encoding (MIME:x-mac-cyrillic).")
1433 (while (< i 128) 1434(coding-system-put 'mac-cyrillic 'mime-charset 'x-mac-cyrillic)
1434 (aset encoding-vector i i)
1435 (setq i (1+ i)))
1436 (while (< i 256)
1437 (aset encoding-vector i
1438 (decode-char 'ucs (aref vec (- i 128))))
1439 (setq i (1+ i)))
1440 (setq translation-table
1441 (make-translation-table-from-vector encoding-vector))
1442;; (define-translation-table 'mac-cyrillic-decoder translation-table)
1443 (define-translation-table 'mac-cyrillic-encoder
1444 (char-table-extra-slot translation-table 0)))
1445 1435
1446(defvar mac-font-encoder-list 1436(defvar mac-font-encoder-list
1447 '(("mac-roman" mac-roman-encoder 1437 '(("mac-roman" mac-roman-encoder
1448 ccl-encode-mac-roman-font "%s") 1438 ccl-encode-mac-roman-font "%s")
1449 ("mac-centraleurroman" mac-centraleurroman-encoder 1439 ("mac-centraleurroman" encode-mac-centraleurroman
1450 ccl-encode-mac-centraleurroman-font "%s ce") 1440 ccl-encode-mac-centraleurroman-font "%s ce")
1451 ("mac-cyrillic" mac-cyrillic-encoder 1441 ("mac-cyrillic" encode-mac-cyrillic
1452 ccl-encode-mac-cyrillic-font "%s cy"))) 1442 ccl-encode-mac-cyrillic-font "%s cy")))
1453 1443
1454(let ((encoder-list 1444(let ((encoder-list
@@ -1468,24 +1458,34 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
1468 (if mac-encoded 1458 (if mac-encoded
1469 (aset table c mac-encoded)))))))) 1459 (aset table c mac-encoded))))))))
1470 1460
1461(define-ccl-program ccl-encode-mac-roman-font
1462 `(0
1463 (if (r0 != ,(charset-id 'ascii))
1464 (if (r0 <= ?\x8f)
1465 (translate-character mac-roman-encoder r0 r1)
1466 ((r1 <<= 7)
1467 (r1 |= r2)
1468 (translate-character mac-roman-encoder r0 r1)))))
1469 "CCL program for Mac Roman font")
1470
1471(define-ccl-program ccl-encode-mac-centraleurroman-font 1471(define-ccl-program ccl-encode-mac-centraleurroman-font
1472 `(0 1472 `(0
1473 (if (r0 != ,(charset-id 'ascii)) 1473 (if (r0 != ,(charset-id 'ascii))
1474 (if (r0 <= ?\x8f) 1474 (if (r0 <= ?\x8f)
1475 (translate-character mac-centraleurroman-encoder r0 r1) 1475 (translate-character encode-mac-centraleurroman r0 r1)
1476 ((r1 <<= 7) 1476 ((r1 <<= 7)
1477 (r1 |= r2) 1477 (r1 |= r2)
1478 (translate-character mac-centraleurroman-encoder r0 r1))))) 1478 (translate-character encode-mac-centraleurroman r0 r1)))))
1479 "CCL program for Mac Central European Roman font") 1479 "CCL program for Mac Central European Roman font")
1480 1480
1481(define-ccl-program ccl-encode-mac-cyrillic-font 1481(define-ccl-program ccl-encode-mac-cyrillic-font
1482 `(0 1482 `(0
1483 (if (r0 != ,(charset-id 'ascii)) 1483 (if (r0 != ,(charset-id 'ascii))
1484 (if (r0 <= ?\x8f) 1484 (if (r0 <= ?\x8f)
1485 (translate-character mac-cyrillic-encoder r0 r1) 1485 (translate-character encode-mac-cyrillic r0 r1)
1486 ((r1 <<= 7) 1486 ((r1 <<= 7)
1487 (r1 |= r2) 1487 (r1 |= r2)
1488 (translate-character mac-cyrillic-encoder r0 r1))))) 1488 (translate-character encode-mac-cyrillic r0 r1)))))
1489 "CCL program for Mac Cyrillic font") 1489 "CCL program for Mac Cyrillic font")
1490 1490
1491 1491