Commit e1915ab3 authored by Kenichi Handa's avatar Kenichi Handa

Call define-coding-system instead of make-coding-system. All CCL program deleted.

parent c1841772
...@@ -33,47 +33,50 @@ ...@@ -33,47 +33,50 @@
;;; Chinese (general) ;;; Chinese (general)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(make-coding-system (define-coding-system 'iso-2022-cn
'iso-2022-cn 2 ?C
"ISO 2022 based 7bit encoding for Chinese GB and CNS (MIME:ISO-2022-CN)." "ISO 2022 based 7bit encoding for Chinese GB and CNS (MIME:ISO-2022-CN)."
'(ascii :coding-type 'iso-2022
(nil chinese-gb2312 chinese-cns11643-1) :mnemonic ?C
(nil chinese-cns11643-2) :charset-list '(ascii chinese-gb2312 chinese-cns11643-1 chinese-cns11643-2)
nil :designation [ascii
nil ascii-eol ascii-cntl seven locking-shift single-shift nil nil nil (nil chinese-gb2312 chinese-cns11643-1)
init-bol) (nil chinese-cns11643-2)
'((safe-charsets ascii chinese-gb2312 chinese-cns11643-1 chinese-cns11643-2) nil]
(mime-charset . iso-2022-cn))) :flags '(ascii-at-eol ascii-at-cntl 7-bit
designation locking-shift single-shift init-at-bol)
:plist '(mime-charset . iso-2022-cn))
(define-coding-system-alias 'chinese-iso-7bit 'iso-2022-cn) (define-coding-system-alias 'chinese-iso-7bit 'iso-2022-cn)
(make-coding-system (define-coding-system 'iso-2022-cn-ext
'iso-2022-cn-ext 2 ?C "ISO 2022 based 7bit encoding for Chinese GB and CNS (MIME:ISO-2022-CN-EXT)."
"ISO 2022 based 7bit encoding for Chinese GB and CNS (MIME:ISO-2022-CN-EXT)." :coding-type 'iso-2022
'(ascii :mnemonic ?C
(nil chinese-gb2312 chinese-cns11643-1) :charset-list '(ascii
(nil chinese-cns11643-2) chinese-gb2312 chinese-cns11643-1
(nil chinese-cns11643-3 chinese-cns11643-4 chinese-cns11643-5 chinese-cns11643-2 chinese-cns11643-3 chinese-cns11643-4
chinese-cns11643-6 chinese-cns11643-7) chinese-cns11643-5 chinese-cns11643-6 chinese-cns11643-7)
nil ascii-eol ascii-cntl seven locking-shift single-shift nil nil nil :designation '[ascii
init-bol) (nil chinese-gb2312 chinese-cns11643-1)
'((safe-charsets ascii chinese-gb2312 chinese-cns11643-1 chinese-cns11643-2 (nil chinese-cns11643-2)
chinese-cns11643-3 chinese-cns11643-4 chinese-cns11643-5 (nil chinese-cns11643-3 chinese-cns11643-4 chinese-cns11643-5
chinese-cns11643-6 chinese-cns11643-7) chinese-cns11643-6 chinese-cns11643-7)]
(mime-charset . iso-2022-cn-ext))) :flags '(ascii-at-eol ascii-at-cntl 7-bit
designation locking-shift single-shift init-at-bol)
:plist '(mime-charset iso-2022-cn-ext))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Chinese GB2312 (simplified) ;;; Chinese GB2312 (simplified)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(make-coding-system (define-coding-system 'chinese-iso-8bit
'chinese-iso-8bit 2 ?c "ISO 2022 based EUC encoding for Chinese GB2312 (MIME:CN-GB)."
"ISO 2022 based EUC encoding for Chinese GB2312 (MIME:GB2312)." :coding-type 'iso-2022
'(ascii chinese-gb2312 nil nil :mnemonic ?c
nil ascii-eol ascii-cntl nil nil nil nil) :charset-list '(ascii chinese-gb2312)
'((safe-charsets ascii chinese-gb2312) :designation [ascii chinese-gb2312 nil nil]
(mime-charset . gb2312))) :plist '(mime-charset cn-gb))
(define-coding-system-alias 'cn-gb-2312 'chinese-iso-8bit) (define-coding-system-alias 'cn-gb-2312 'chinese-iso-8bit)
(define-coding-system-alias 'euc-china 'chinese-iso-8bit) (define-coding-system-alias 'euc-china 'chinese-iso-8bit)
...@@ -81,14 +84,14 @@ ...@@ -81,14 +84,14 @@
(define-coding-system-alias 'cn-gb 'chinese-iso-8bit) (define-coding-system-alias 'cn-gb 'chinese-iso-8bit)
(define-coding-system-alias 'gb2312 'chinese-iso-8bit) (define-coding-system-alias 'gb2312 'chinese-iso-8bit)
(make-coding-system (define-coding-system 'chinese-hz
'chinese-hz 0 ?z
"Hz/ZW 7-bit encoding for Chinese GB2312 (MIME:HZ-GB-2312)." "Hz/ZW 7-bit encoding for Chinese GB2312 (MIME:HZ-GB-2312)."
nil :coding-type 'utf-8
'((safe-charsets ascii chinese-gb2312) :mnemonic ?z
(mime-charset . hz-gb-2312) :charset-list '(ascii chinese-gb2312)
(post-read-conversion . post-read-decode-hz) :plist '(mime-charset hz-gb-2312)
(pre-write-conversion . pre-write-encode-hz))) :post-read-conversion 'post-read-decode-hz
:pre-write-conversion 'pre-write-encode-hz)
(define-coding-system-alias 'hz-gb-2312 'chinese-hz) (define-coding-system-alias 'hz-gb-2312 'chinese-hz)
(define-coding-system-alias 'hz 'chinese-hz) (define-coding-system-alias 'hz 'chinese-hz)
...@@ -125,36 +128,16 @@ ...@@ -125,36 +128,16 @@
;; Chinese BIG5 (traditional) ;; Chinese BIG5 (traditional)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(make-coding-system (define-coding-system 'chinese-big5
'chinese-big5 3 ?B "BIG5 8-bit encoding for Chinese (MIME:Big5)"
"BIG5 8-bit encoding for Chinese (MIME:Big5)." :coding-type 'big5
nil :mnemonic ?B
'((safe-charsets ascii chinese-big5-1 chinese-big5-2) :charset-list '(ascii big5)
(mime-charset . big5) :plist '(mime-charset big5))
(charset-origin-alist (chinese-big5-1 "BIG5" encode-big5-char)
(chinese-big5-2 "BIG5" encode-big5-char))))
(define-coding-system-alias 'big5 'chinese-big5) (define-coding-system-alias 'big5 'chinese-big5)
(define-coding-system-alias 'cn-big5 'chinese-big5) (define-coding-system-alias 'cn-big5 'chinese-big5)
;; Big5 font requires special encoding.
(define-ccl-program ccl-encode-big5-font
`(0
;; In: R0:chinese-big5-1 or chinese-big5-2
;; R1:position code 1
;; R2:position code 2
;; Out: R1:font code point 1
;; R2:font code point 2
((r2 = ((((r1 - ?\x21) * 94) + r2) - ?\x21))
(if (r0 == ,(charset-id 'chinese-big5-2)) (r2 += 6280))
(r1 = ((r2 / 157) + ?\xA1))
(r2 %= 157)
(if (r2 < ?\x3F) (r2 += ?\x40) (r2 += ?\x62))))
"CCL program to encode a Big5 code to code point of Big5 font.")
(setq font-ccl-encoder-alist
(cons (cons "big5" ccl-encode-big5-font) font-ccl-encoder-alist))
(set-language-info-alist (set-language-info-alist
"Chinese-BIG5" '((charset chinese-big5-1 chinese-big5-2) "Chinese-BIG5" '((charset chinese-big5-1 chinese-big5-2)
(coding-system chinese-big5 chinese-iso-7bit) (coding-system chinese-big5 chinese-iso-7bit)
...@@ -169,144 +152,26 @@ ...@@ -169,144 +152,26 @@
;; Chinese CNS11643 (traditional) ;; Chinese CNS11643 (traditional)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar big5-to-cns (make-translation-table) (define-coding-system 'euc-tw
"Translation table for encoding to `euc-tw'.") "ISO 2022 based EUC encoding for Chinese CNS11643."
;; Could have been done by china-util loaded before. :coding-type 'iso-2022
(unless (get 'big5-to-cns 'translation-table) :mnemonic ?Z
(define-translation-table 'big5-to-cns big5-to-cns)) :charset-list '(ascii
chinese-cns11643-1
(define-ccl-program ccl-decode-euc-tw chinese-cns11643-2
;; CNS plane 1 needs either two or four bytes in EUC-TW encoding; chinese-cns11643-3
;; CNS planes 2 to 7 always need four bytes. In internal encoding of chinese-cns11643-4
;; Emacs, CNS planes 1 and 2 need three bytes, and planes 3 to 7 need chinese-cns11643-5
;; four bytes. Thus a buffer magnification value of 2 (for both chinese-cns11643-6
;; encoding and decoding) is sufficient. chinese-cns11643-7)
`(2 :designation [ascii chinese-cns11643-1 (chinese-cns11643-1
;; we don't have enough registers to hold all charset-ids chinese-cns11643-2
((r4 = ,(charset-id 'chinese-cns11643-1)) chinese-cns11643-3
(r5 = ,(charset-id 'chinese-cns11643-2)) chinese-cns11643-4
(r6 = ,(charset-id 'chinese-cns11643-3)) chinese-cns11643-5
(loop chinese-cns11643-6
(read-if (r0 < #x80) chinese-cns11643-7) nil]
;; ASCII :plist '(mime-charset euc-tw))
(write-repeat r0)
;; not ASCII
(if (r0 == #x8E)
;; single shift
(read-if (r1 < #xA1)
;; invalid byte
((write r0)
(write-repeat r1))
(if (r1 > #xA7)
;; invalid plane
((write r0)
(write-repeat r1))
;; OK, we have a plane
(read-if (r2 < #xA1)
;; invalid first byte
((write r0 r1)
(write-repeat r2))
(read-if (r3 < #xA1)
;; invalid second byte
((write r0 r1 r2)
(write-repeat r3))
;; CNS 1-7, finally
((branch (r1 - #xA1)
(r1 = r4)
(r1 = r5)
(r1 = r6)
(r1 = ,(charset-id 'chinese-cns11643-4))
(r1 = ,(charset-id 'chinese-cns11643-5))
(r1 = ,(charset-id 'chinese-cns11643-6))
(r1 = ,(charset-id 'chinese-cns11643-7)))
(r2 = ((((r2 - #x80) << 7) + r3) - #x80))
(write-multibyte-character r1 r2)
(repeat))))))
;; standard EUC
(if (r0 < #xA1)
;; invalid first byte
(write-repeat r0)
(read-if (r1 < #xA1)
;; invalid second byte
((write r0)
(write-repeat r1))
;; CNS 1, finally
((r1 = ((((r0 - #x80) << 7) + r1) - #x80))
(write-multibyte-character r4 r1)
(repeat)))))))))
"CCL program to decode EUC-TW encoding."
)
(define-ccl-program ccl-encode-euc-tw
`(2
;; we don't have enough registers to hold all charset-ids
((r2 = ,(charset-id 'ascii))
(r3 = ,(charset-id 'chinese-big5-1))
(r4 = ,(charset-id 'chinese-big5-2))
(r5 = ,(charset-id 'chinese-cns11643-1))
(r6 = ,(charset-id 'chinese-cns11643-2))
(loop
(read-multibyte-character r0 r1)
(if (r0 == r2)
(write-repeat r1)
(;; Big 5 encoded characters are first translated to CNS
(if (r0 == r3)
(translate-character big5-to-cns r0 r1)
(if (r0 == r4)
(translate-character big5-to-cns r0 r1)))
(if (r0 == r5)
(r0 = #xA1)
(if (r0 == r6)
(r0 = #xA2)
(if (r0 == ,(charset-id 'chinese-cns11643-3))
(r0 = #xA3)
(if (r0 == ,(charset-id 'chinese-cns11643-4))
(r0 = #xA4)
(if (r0 == ,(charset-id 'chinese-cns11643-5))
(r0 = #xA5)
(if (r0 == ,(charset-id 'chinese-cns11643-6))
(r0 = #xA6)
(if (r0 == ,(charset-id 'chinese-cns11643-7))
(r0 = #xA7)
;; not CNS. We use a dummy character which
;; can't occur in EUC-TW encoding to indicate
;; this.
(write-repeat #xFF))))))))))
(if (r0 != #xA1)
;; single shift and CNS plane
((write #x8E)
(write r0)))
(write ((r1 >> 7) + #x80))
(write ((r1 % #x80) + #x80))
(repeat))))
"CCL program to encode EUC-TW encoding."
)
(defun euc-tw-pre-write-conversion (beg end)
"Semi-dummy pre-write function effectively to autoload china-util."
;; Ensure translation table is loaded.
(require 'china-util)
;; Don't do this again.
(coding-system-put 'euc-tw 'pre-write-conversion nil)
nil)
(make-coding-system
'euc-tw 4 ?Z
"ISO 2022 based EUC encoding for Chinese CNS11643.
Big5 encoding is accepted for input also (which is then converted to CNS)."
'(ccl-decode-euc-tw . ccl-encode-euc-tw)
'((safe-charsets ascii
chinese-big5-1
chinese-big5-2
chinese-cns11643-1
chinese-cns11643-2
chinese-cns11643-3
chinese-cns11643-4
chinese-cns11643-5
chinese-cns11643-6
chinese-cns11643-7)
(valid-codes (0 . 255))
(pre-write-conversion . euc-tw-pre-write-conversion)))
(define-coding-system-alias 'euc-taiwan 'euc-tw) (define-coding-system-alias 'euc-taiwan 'euc-tw)
......
...@@ -34,22 +34,21 @@ ...@@ -34,22 +34,21 @@
;; ISO-8859-5 staff ;; ISO-8859-5 staff
(make-coding-system (define-coding-system 'cyrillic-iso-8bit
'cyrillic-iso-8bit 2 ?5 "ISO 2022 based 8-bit encoding for Cyrillic script (MIME:ISO-8859-5)."
"ISO 2022 based 8-bit encoding for Cyrillic script (MIME:ISO-8859-5)." :coding-type 'charset
'(ascii cyrillic-iso8859-5 nil nil :mnemonic ?5
nil nil nil nil nil nil nil) :charset-list '(iso-8859-5)
'((safe-charsets ascii cyrillic-iso8859-5) :plist '(mime-charset iso-8859-5))
(mime-charset . iso-8859-5)))
(define-coding-system-alias 'iso-8859-5 'cyrillic-iso-8bit) (define-coding-system-alias 'iso-8859-5 'cyrillic-iso-8bit)
(set-language-info-alist (set-language-info-alist
"Cyrillic-ISO" '((charset cyrillic-iso8859-5) "Cyrillic-ISO" '((charset iso-8859-5)
(coding-system cyrillic-iso-8bit) (coding-system cyrillic-iso-8bit)
(coding-priority cyrillic-iso-8bit) (coding-priority cyrillic-iso-8bit)
(nonascii-translation . iso-8859-5)
(input-method . "cyrillic-yawerty") (input-method . "cyrillic-yawerty")
(nonascii-translation . cyrillic-iso8859-5)
(unibyte-display . cyrillic-iso-8bit) (unibyte-display . cyrillic-iso-8bit)
(features cyril-util) (features cyril-util)
(sample-text . "Russian (,L@caaZXY(B) ,L7T`PRabRcYbU(B!") (sample-text . "Russian (,L@caaZXY(B) ,L7T`PRabRcYbU(B!")
...@@ -58,91 +57,24 @@ ...@@ -58,91 +57,24 @@
;; KOI-8 staff ;; KOI-8 staff
(defvar cyrillic-koi8-r-decode-table (define-coding-system 'cyrillic-koi8
[ "KOI8 8-bit encoding for Cyrillic (MIME: KOI8-R)."
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 :coding-type 'charset
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ;; We used to use ?K. It is true that ?K is more strictly correct,
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 ;; but it is also used for Korean. So people who use koi8 for
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 ;; languages other than Russian will have to forgive us.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 :mnemonic ?R
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 :charset-list '(koi8)
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 :plist '(mime-charset koi8-r))
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
160 161 162 ?,Lq(B 164 165 166 167 168 169 170 171 172 173 174 175
176 177 178 ?,L!(B 180 181 182 183 184 185 186 187 188 189 190 191
?,Ln(B ?,LP(B ?,LQ(B ?,Lf(B ?,LT(B ?,LU(B ?,Ld(B ?,LS(B ?,Le(B ?,LX(B ?,LY(B ?,LZ(B ?,L[(B ?,L\(B ?,L](B ?,L^(B
?,L_(B ?,Lo(B ?,L`(B ?,La(B ?,Lb(B ?,Lc(B ?,LV(B ?,LR(B ?,Ll(B ?,Lk(B ?,LW(B ?,Lh(B ?,Lm(B ?,Li(B ?,Lg(B ?,Lj(B
?,LN(B ?,L0(B ?,L1(B ?,LF(B ?,L4(B ?,L5(B ?,LD(B ?,L3(B ?,LE(B ?,L8(B ?,L9(B ?,L:(B ?,L;(B ?,L<(B ?,L=(B ?,L>(B
?,L?(B ?,LO(B ?,L@(B ?,LA(B ?,LB(B ?,LC(B ?,L6(B ?,L2(B ?,LL(B ?,LK(B ?,L7(B ?,LH(B ?,LM(B ?,LI(B ?,LG(B ?,LJ(B ]
"Cyrillic KOI8-R decoding table.")
(let ((table (make-translation-table-from-vector
cyrillic-koi8-r-decode-table)))
(define-translation-table 'cyrillic-koi8-r-nonascii-translation-table table)
(define-translation-table 'cyrillic-koi8-r-encode-table
(char-table-extra-slot table 0)))
(define-ccl-program ccl-decode-koi8
`(3
((loop
(r0 = 0)
(read r1)
(if (r1 < 128)
(write-repeat r1)
((translate-character cyrillic-koi8-r-nonascii-translation-table r0 r1)
(write-multibyte-character r0 r1)
(repeat))))))
"CCL program to decode KOI8.")
(define-ccl-program ccl-encode-koi8
`(1
((loop
(read-multibyte-character r0 r1)
(if (r0 == ,(charset-id 'cyrillic-iso8859-5))
(translate-character cyrillic-koi8-r-encode-table r0 r1))
(write-repeat r1))))
"CCL program to encode KOI8.")
(make-coding-system
'cyrillic-koi8 4
;; We used to use ?K. It is true that ?K is more strictly correct,
;; but it is also used for Korean.
;; So people who use koi8 for languages other than Russian
;; will have to forgive us.
?R
"KOI8 8-bit encoding for Cyrillic (MIME: KOI8-R)."
'(ccl-decode-koi8 . ccl-encode-koi8)
`((safe-chars . ,(let ((table (make-char-table 'safe-chars))
(i 0))
(while (< i 256)
(aset table (aref cyrillic-koi8-r-decode-table i) t)
(setq i (1+ i)))
table))
(mime-charset . koi8-r)
(valid-codes (0 . 127) 163 179 (192 . 255))
(charset-origin-alist (cyrillic-iso8859-5 "KOI8-R"
cyrillic-encode-koi8-r-char))))
(define-coding-system-alias 'koi8-r 'cyrillic-koi8) (define-coding-system-alias 'koi8-r 'cyrillic-koi8)
(define-coding-system-alias 'koi8 'cyrillic-koi8) (define-coding-system-alias 'koi8 'cyrillic-koi8)
(define-ccl-program ccl-encode-koi8-font
`(0
((translate-character cyrillic-koi8-r-encode-table r0 r1)))
"CCL program to encode Cyrillic chars to KOI font.")
(setq font-ccl-encoder-alist
(cons '("koi8" . ccl-encode-koi8-font) font-ccl-encoder-alist))
(set-language-info-alist (set-language-info-alist
"Cyrillic-KOI8" `((charset cyrillic-iso8859-5) "Cyrillic-KOI8" `((charset koi8)
(nonascii-translation
. ,(get 'cyrillic-koi8-r-nonascii-translation-table
'translation-table))
(coding-system cyrillic-koi8) (coding-system cyrillic-koi8)
(coding-priority cyrillic-koi8) (coding-priority cyrillic-koi8)
(nonascii-translation . koi8)
(input-method . "cyrillic-jcuken") (input-method . "cyrillic-jcuken")
(features cyril-util) (features cyril-util)
(unibyte-display . cyrillic-koi8) (unibyte-display . cyrillic-koi8)
...@@ -152,89 +84,19 @@ ...@@ -152,89 +84,19 @@
;;; ALTERNATIVNYJ staff ;;; ALTERNATIVNYJ staff
(defvar cyrillic-alternativnyj-decode-table (define-coding-system 'cyrillic-alternativnyj
[ "ALTERNATIVNYJ 8-bit encoding for Cyrillic."
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 :coding-type 'charset
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 :mnemonic ?A
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 :charset-list '(alternativnyj))
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
?,L0(B ?,L1(B ?,L2(B ?,L3(B ?,L4(B ?,L5(B ?,L6(B ?,L7(B ?,L8(B ?,L9(B ?,L:(B ?,L;(B ?,L<(B ?,L=(B ?,L>(B ?,L?(B
?,L@(B ?,LA(B ?,LB(B ?,LC(B ?,LD(B ?,LE(B ?,LF(B ?,LG(B ?,LH(B ?,LI(B ?,LJ(B ?,LK(B ?,LL(B ?,LM(B ?,LN(B ?,LO(B
?,LP(B ?,LQ(B ?,LR(B ?,LS(B ?,LT(B ?,LU(B ?,LV(B ?,LW(B ?,LX(B ?,LY(B ?,LZ(B ?,L[(B ?,L\(B ?,L](B ?,L^(B ?,L_(B
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
?,L`(B ?,La(B ?,Lb(B ?,Lc(B ?,Ld(B ?,Le(B ?,Lf(B ?,Lg(B ?,Lh(B ?,Li(B ?,Lj(B ?,Lk(B ?,Ll(B ?,Lm(B ?,Ln(B ?,Lo(B
?,L!(B ?,Lq(B 242 243 244 245 246 247 248 249 250 251 252 253 254 ?,Lp(B]
"Cyrillic ALTERNATIVNYJ decoding table.")
(let ((table (make-translation-table-from-vector
cyrillic-alternativnyj-decode-table)))
(define-translation-table 'cyrillic-alternativnyj-nonascii-translation-table
table)
(define-translation-table 'cyrillic-alternativnyj-encode-table
(char-table-extra-slot table 0)))
(define-ccl-program ccl-decode-alternativnyj
`(3
((loop
(r0 = 0)
(read r1)
(if (r1 < 128)
(write-repeat r1)
((translate-character cyrillic-alternativnyj-nonascii-translation-table
r0 r1)
(write-multibyte-character r0 r1)
(repeat))))))
"CCL program to decode Alternativnyj.")
(define-ccl-program ccl-encode-alternativnyj
`(1
((loop
(read-multibyte-character r0 r1)
(translate-character cyrillic-alternativnyj-encode-table r0 r1)
(write-repeat r1))))
"CCL program to encode Alternativnyj.")
(make-coding-system
'cyrillic-alternativnyj 4 ?A
"ALTERNATIVNYJ 8-bit encoding for Cyrillic."
'(ccl-decode-alternativnyj . ccl-encode-alternativnyj)
`((safe-chars . ,(let ((table (make-char-table 'safe-chars))
(i 0))
(while (< i 256)
(aset table (aref cyrillic-alternativnyj-decode-table i)
t)
(setq i (1+ i)))
table))
(valid-codes (0 . 175) (224 . 241) 255)
(charset-origin-alist (cyrillic-iso8859-5 "ALTERNATIVNYJ"
cyrillic-encode-koi8-r-char))))
(define-coding-system-alias 'alternativnyj 'cyrillic-alternativnyj) (define-coding-system-alias 'alternativnyj 'cyrillic-alternativnyj)
(define-ccl-program ccl-encode-alternativnyj-font
'(0
((translate-character cyrillic-alternativnyj-encode-table r0 r1)))
"CCL program to encode Cyrillic chars to Alternativnyj font.")
(setq font-ccl-encoder-alist
(cons '("alternativnyj" . ccl-encode-alternativnyj-font)
font-ccl-encoder-alist))
(set-language-info-alist (set-language-info-alist
"Cyrillic-ALT" `((charset cyrillic-iso8859-5) "Cyrillic-ALT" `((charset alternativnyj)
(nonascii-translation
. ,(get 'cyrillic-alternativnyj-nonascii-translation-table
'translation-table))
(coding-system cyrillic-alternativnyj) (coding-system cyrillic-alternativnyj)
(coding-priority cyrillic-alternativnyj) (coding-priority cyrillic-alternativnyj)
(nonascii-translation . alternativnyj)
(input-method . "cyrillic-jcuken") (input-method . "cyrillic-jcuken")
(features cyril-util) (features cyril-util)
(unibyte-display . cyrillic-alternativnyj) (unibyte-display . cyrillic-alternativnyj)
......
...@@ -32,22 +32,11 @@ ...@@ -32,22 +32,11 @@
;; Latin-1 (ISO-8859-1) ;; Latin-1 (ISO-8859-1)
(make-coding-system
'iso-latin-1 2 ?1
"ISO 2022 based 8-bit encoding for Latin-1 (MIME:ISO-8859-1)."
'(ascii latin-iso8859-1 nil nil
nil nil nil nil nil nil nil nil nil nil nil nil t)
'((safe-charsets ascii latin-iso8859-1)
(mime-charset . iso-8859-1)))
(define-coding-system-alias 'iso-8859-1 'iso-latin-1)
(define-coding-system-alias 'latin-1 'iso-latin-1)