comparison lisp/mule/japanese.el @ 5118:e0db3c197671 ben-lisp-object

merge up to latest default branch, doesn't compile yet
author Ben Wing <ben@xemacs.org>
date Sat, 26 Dec 2009 21:18:49 -0600
parents 1d74a1d115ee
children 311f6817efc2 308d34e9f07d
comparison
equal deleted inserted replaced
5117:3742ea8250b5 5118:e0db3c197671
31 ;; For Japanese, character sets JISX0201, JISX0208, JISX0212 are 31 ;; For Japanese, character sets JISX0201, JISX0208, JISX0212 are
32 ;; supported. 32 ;; supported.
33 33
34 ;;; Code: 34 ;;; Code:
35 35
36 ; (make-charset 'katakana-jisx0201
37 ; "Katakana Part of JISX0201.1976"
38 ; '(dimension
39 ; 1
40 ; registry "JISX0201"
41 ; chars 94
42 ; columns 1
43 ; direction l2r
44 ; final ?I
45 ; graphic 1
46 ; short-name "JISX0201 Katakana"
47 ; long-name "Japanese Katakana (JISX0201.1976)"
48 ; ))
49
50 ; (make-charset 'latin-jisx0201
51 ; "Roman Part of JISX0201.1976"
52 ; '(dimension
53 ; 1
54 ; registry "JISX0201"
55 ; chars 94
56 ; columns 1
57 ; direction l2r
58 ; final ?J
59 ; graphic 0
60 ; short-name "JISX0201 Roman"
61 ; long-name "Japanese Roman (JISX0201.1976)"
62 ; ))
63
64 ; (make-charset 'japanese-jisx0208-1978
65 ; "JISX0208.1978 Japanese Kanji (so called \"old JIS\"): ISO-IR-42"
66 ; '(dimension
67 ; 2
68 ; registry "JISX0208.1990"
69 ; registry "JISX0208.1978"
70 ; chars 94
71 ; columns 2
72 ; direction l2r
73 ; final ?@
74 ; graphic 0
75 ; short-name "JISX0208.1978"
76 ; long-name "JISX0208.1978 (Japanese): ISO-IR-42"
77 ; ))
78
79 ; (make-charset 'japanese-jisx0208
80 ; "JISX0208.1983/1990 Japanese Kanji: ISO-IR-87"
81 ; '(dimension
82 ; 2
83 ; chars 94
84 ; columns 2
85 ; direction l2r
86 ; final ?B
87 ; graphic 0
88 ; short-name "JISX0208"
89 ; long-name "JISX0208.1983/1990 (Japanese): ISO-IR-87"
90 ; ))
91
92 ; (make-charset 'japanese-jisx0212
93 ; "JISX0212 Japanese supplement: ISO-IR-159"
94 ; '(dimension
95 ; 2
96 ; registry "JISX0212"
97 ; chars 94
98 ; columns 2
99 ; direction l2r
100 ; final ?D
101 ; graphic 0
102 ; short-name "JISX0212"
103 ; long-name "JISX0212 (Japanese): ISO-IR-159"
104 ; ))
105
106 (make-charset 'japanese-jisx0213-1 "JISX0213 Plane 1 (Japanese)" 36 (make-charset 'japanese-jisx0213-1 "JISX0213 Plane 1 (Japanese)"
107 '(dimension 37 '(dimension
108 2 38 2
109 registry "JISX0213.2000-1" 39 registries ["JISX0213.2000-1"]
110 chars 94 40 chars 94
111 columns 2 41 columns 2
112 direction l2r 42 direction l2r
113 final ?O 43 final ?O
114 graphic 0 44 graphic 0
118 48
119 ;; JISX0213 Plane 2 49 ;; JISX0213 Plane 2
120 (make-charset 'japanese-jisx0213-2 "JISX0213 Plane 2 (Japanese)" 50 (make-charset 'japanese-jisx0213-2 "JISX0213 Plane 2 (Japanese)"
121 '(dimension 51 '(dimension
122 2 52 2
123 registry "JISX0213.2000-2" 53 registries ["JISX0213.2000-2"]
124 chars 94 54 chars 94
125 columns 2 55 columns 2
126 direction l2r 56 direction l2r
127 final ?P 57 final ?P
128 graphic 0 58 graphic 0
129 short-name "JISX0213-2" 59 short-name "JISX0213-2"
130 long-name "JISX0213-2" 60 long-name "JISX0213-2"
131 )) 61 ))
132 62
133 ;;; Syntax of Japanese characters. 63 ;;; Syntax of Japanese characters.
134 (modify-syntax-entry 'katakana-jisx0201 "w")
135 (modify-syntax-entry 'japanese-jisx0212 "w")
136
137 (modify-syntax-entry 'japanese-jisx0208 "w")
138 (loop for row in '(33 34 40) 64 (loop for row in '(33 34 40)
139 do (modify-syntax-entry `[japanese-jisx0208 ,row] "_")) 65 do (modify-syntax-entry `[japanese-jisx0208 ,row] "_"))
140 (loop for char in '(?$B!<(B ?$B!+(B ?$B!,(B ?$B!3(B ?$B!4(B ?$B!5(B ?$B!6(B ?$B!7(B ?$B!8(B ?$B!9(B ?$B!:(B ?$B!;(B) 66 (loop for char in '(?$B!<(B ?$B!+(B ?$B!,(B ?$B!3(B ?$B!4(B ?$B!5(B ?$B!6(B ?$B!7(B ?$B!8(B ?$B!9(B ?$B!:(B ?$B!;(B)
141 do (modify-syntax-entry char "w")) 67 do (modify-syntax-entry char "w"))
142 (modify-syntax-entry ?\$B!J(B "($B!K(B") 68 (modify-syntax-entry ?\$B!J(B "($B!K(B")
267 '(charset-g0 ascii 193 '(charset-g0 ascii
268 short t 194 short t
269 seven t 195 seven t
270 input-charset-conversion ((latin-jisx0201 ascii) 196 input-charset-conversion ((latin-jisx0201 ascii)
271 (japanese-jisx0208-1978 japanese-jisx0208)) 197 (japanese-jisx0208-1978 japanese-jisx0208))
198 safe-charsets (ascii japanese-jisx0208-1978 japanese-jisx0208
199 latin-jisx0201 japanese-jisx0212 katakana-jisx0201)
272 mnemonic "MULE/7bit" 200 mnemonic "MULE/7bit"
273 documentation 201 documentation
274 "Coding system used for communication with mail and news in Japan." 202 "Coding system used for communication with mail and news in Japan."
275 )) 203 ))
276 204
282 short t 210 short t
283 seven t 211 seven t
284 lock-shift t 212 lock-shift t
285 input-charset-conversion ((latin-jisx0201 ascii) 213 input-charset-conversion ((latin-jisx0201 ascii)
286 (japanese-jisx0208-1978 japanese-jisx0208)) 214 (japanese-jisx0208-1978 japanese-jisx0208))
215 safe-charsets (latin-jisx0201 ascii japanese-jisx0208-1978 japanese-jisx0208)
287 mnemonic "JIS7" 216 mnemonic "JIS7"
288 documentation 217 documentation
289 "Old JIS 7-bit encoding; mostly superseded by ISO-2022-JP. 218 "Old JIS 7-bit encoding; mostly superseded by ISO-2022-JP.
290 Uses locking-shift (SI/SO) to select half-width katakana." 219 Uses locking-shift (SI/SO) to select half-width katakana."
291 )) 220 ))
296 '(charset-g0 ascii 225 '(charset-g0 ascii
297 charset-g1 katakana-jisx0201 226 charset-g1 katakana-jisx0201
298 short t 227 short t
299 input-charset-conversion ((latin-jisx0201 ascii) 228 input-charset-conversion ((latin-jisx0201 ascii)
300 (japanese-jisx0208-1978 japanese-jisx0208)) 229 (japanese-jisx0208-1978 japanese-jisx0208))
230 safe-charsets (latin-jisx0201 ascii japanese-jisx0208-1978
231 japanese-jisx0208)
301 mnemonic "JIS8" 232 mnemonic "JIS8"
302 documentation 233 documentation
303 "Old JIS 8-bit encoding; mostly superseded by ISO-2022-JP. 234 "Old JIS 8-bit encoding; mostly superseded by ISO-2022-JP.
304 Uses high bytes for half-width katakana." 235 Uses high bytes for half-width katakana."
305 )) 236 ))
333 (make-coding-system 264 (make-coding-system
334 'shift-jis 'shift-jis 265 'shift-jis 'shift-jis
335 "Shift-JIS" 266 "Shift-JIS"
336 '(mnemonic "Ja/SJIS" 267 '(mnemonic "Ja/SJIS"
337 documentation "The standard Japanese encoding in MS Windows." 268 documentation "The standard Japanese encoding in MS Windows."
269 safe-charsets (ascii japanese-jisx0208 japanese-jisx0208-1978
270 latin-jisx0201 katakana-jisx0201)
338 )) 271 ))
339 272
340 ;; A former name? 273 ;; A former name?
341 (define-coding-system-alias 'shift_jis 'shift-jis) 274 (define-coding-system-alias 'shift_jis 'shift-jis)
342 275
358 '(charset-g0 ascii 291 '(charset-g0 ascii
359 short t 292 short t
360 seven t 293 seven t
361 output-charset-conversion ((ascii latin-jisx0201) 294 output-charset-conversion ((ascii latin-jisx0201)
362 (japanese-jisx0208 japanese-jisx0208-1978)) 295 (japanese-jisx0208 japanese-jisx0208-1978))
296 safe-charsets (ascii latin-jisx0201 japanese-jisx0208
297 japanese-jisx0208-1978)
363 documentation 298 documentation
364 "This is a coding system used for old JIS terminals. It's an ISO 299 "This is a coding system used for old JIS terminals. It's an ISO
365 2022 based 7-bit encoding for Japanese JISX0208-1978 and JISX0201-Roman." 300 2022 based 7-bit encoding for Japanese JISX0208-1978 and JISX0201-Roman."
366 mnemonic "Ja-78/7bit" 301 mnemonic "Ja-78/7bit"
367 )) 302 ))
386 "Japanese EUC" 321 "Japanese EUC"
387 '(charset-g0 ascii 322 '(charset-g0 ascii
388 charset-g1 japanese-jisx0208 323 charset-g1 japanese-jisx0208
389 charset-g2 katakana-jisx0201 324 charset-g2 katakana-jisx0201
390 charset-g3 japanese-jisx0212 325 charset-g3 japanese-jisx0212
326 safe-charsets (ascii japanese-jisx0208 katakana-jisx0201 japanese-jisx0212)
391 short t 327 short t
392 mnemonic "Ja/EUC" 328 mnemonic "Ja/EUC"
393 documentation 329 documentation
394 "Japanese EUC (Extended Unix Code), the standard Japanese encoding in Unix. 330 "Japanese EUC (Extended Unix Code), the standard Japanese encoding in Unix.
395 Equivalent MIME encoding: EUC-JP. 331 Equivalent MIME encoding: EUC-JP.
496 "Jp_JP" 432 "Jp_JP"
497 "japanese" 433 "japanese"
498 "japan" 434 "japan"
499 "ja" 435 "ja"
500 ) 436 )
501
502 (native-coding-system
503 ;; first, see if an explicit encoding was given.
504 (lambda (locale)
505 (let ((case-fold-search t))
506 (cond
507 ;; many unix versions
508 ((string-match "\\.euc" locale) 'euc-jp)
509 ((string-match "\\.sjis" locale) 'shift-jis)
510
511 ;; X11R6 (CJKV p. 471)
512 ((string-match "\\.jis7" locale) 'jis7)
513 ((string-match "\\.jis8" locale) 'jis8)
514 ((string-match "\\.mscode" locale) 'shift-jis)
515 ((string-match "\\.pjis" locale) 'iso-2022-jp)
516 ((string-match "\\.ujis" locale) 'euc-jp)
517
518 ;; other names in X11R6 locale.alias
519 ((string-match "\\.ajec" locale) 'euc-jp)
520 ((string-match "-euc" locale) 'euc-jp)
521 ((string-match "\\.iso-2022-jp" locale) 'iso-2022-jp)
522 ((string-match "\\.jis" locale) 'jis7) ;; or just jis?
523 )))
524
525 ;; aix (CJKV p. 465)
526 (lambda (locale)
527 (when (eq system-type 'aix)
528 (cond
529 ((string-match "^Ja_JP" locale) 'shift-jis)
530 ((string-match "^ja_JP" locale) 'euc-jp))))
531
532 ;; other X11R6 locale.alias
533 (lambda (locale)
534 (cond
535 ((string-match "^Jp_JP" locale) 'euc-jp)
536 ((and (eq system-type 'hpux) (eq locale "japanese"))
537 'shift-jis)))
538
539 ;; fallback
540 euc-jp)
541
542 ;; (input-method . "japanese") 437 ;; (input-method . "japanese")
543 (features japan-util) 438 (features japan-util)
544 (sample-text . "Japanese ($BF|K\8l(B) $B$3$s$K$A$O(B, (I:]FAJ(B") 439 (sample-text . "Japanese ($BF|K\8l(B) $B$3$s$K$A$O(B, (I:]FAJ(B")
545 (documentation . t))) 440 (documentation . t)))
546 441
442 ;; Set the native-coding-system separately so the lambdas get compiled. (Not
443 ;; a huge speed improvement, but this code is called at startup, and every
444 ;; little helps there.)
445 (set-language-info "Japanese"
446 'native-coding-system
447 (list
448 ;; first, see if an explicit encoding was given.
449 (lambda (locale)
450 (let ((case-fold-search t))
451 (cond
452 ;; many unix versions
453 ((string-match "\\.euc" locale) 'euc-jp)
454 ((string-match "\\.sjis" locale) 'shift-jis)
455
456 ;; X11R6 (CJKV p. 471)
457 ((string-match "\\.jis7" locale) 'jis7)
458 ((string-match "\\.jis8" locale) 'jis8)
459 ((string-match "\\.mscode" locale) 'shift-jis)
460 ((string-match "\\.pjis" locale) 'iso-2022-jp)
461 ((string-match "\\.ujis" locale) 'euc-jp)
462
463 ;; other names in X11R6 locale.alias
464 ((string-match "\\.ajec" locale) 'euc-jp)
465 ((string-match "-euc" locale) 'euc-jp)
466 ((string-match "\\.iso-2022-jp" locale) 'iso-2022-jp)
467 ((string-match "\\.jis" locale) 'jis7) ;; or just jis?
468 )))
469
470 ;; aix (CJKV p. 465)
471 (lambda (locale)
472 (when (eq system-type 'aix)
473 (cond
474 ((string-match "^Ja_JP" locale) 'shift-jis)
475 ((string-match "^ja_JP" locale) 'euc-jp))))
476
477 ;; other X11R6 locale.alias
478 (lambda (locale)
479 (cond
480 ((string-match "^Jp_JP" locale) 'euc-jp)
481 ((and (eq system-type 'hpux) (eq locale "japanese"))
482 'shift-jis)))
483
484 ;; fallback
485 'euc-jp))
486
547 ;;; japanese.el ends here 487 ;;; japanese.el ends here