1 ;;; egg-com.el --- Communication Routines in Egg Input
2 ;;; Method Architecture
4 ;; Copyright (C) 1997, 1998 Mule Project, Powered by Electrotechnical
6 ;; Project Leader: Satoru Tomura <tomura@etl.go.jp>
8 ;; Author: Hisashi Miyashita <himi@bird.scphys.kyoto-u.ac.jp>
9 ;; NIIBE Yutaka <gniibe@mri.co.jp>
10 ;; KATAYAMA Yoshio <kate@pfu.co.jp> ; Korean, Chinese support.
11 ;; Maintainer: NIIBE Yutaka <gniibe@mri.co.jp>
13 ;; This file will be part of GNU Emacs (in future).
15 ;; EGG is free software; you can redistribute it and/or modify
16 ;; it under the terms of the GNU General Public License as published by
17 ;; the Free Software Foundation; either version 2, or (at your option)
20 ;; EGG is distributed in the hope that it will be useful,
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;; GNU General Public License for more details.
25 ;; You should have received a copy of the GNU General Public License
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the
27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
28 ;; Boston, MA 02111-1307, USA.
34 (defvar egg-fixed-euc 'fixed-euc-jp)
35 (make-variable-buffer-local 'egg-fixed-euc)
37 (defvar egg-mb-euc 'euc-japan)
38 (make-variable-buffer-local 'egg-mb-euc)
41 (define-ccl-program ccl-decode-fixed-euc-jp
43 ((r2 = ,(charset-id 'japanese-jisx0208))
44 (r3 = ,(charset-id 'japanese-jisx0212))
45 (r4 = ,(charset-id 'katakana-jisx0201))
52 (write-read-repeat r0))
54 (write-read-repeat r0))
58 (write-read-repeat r0))
61 (write-read-repeat r0)))))))))
63 (define-ccl-program ccl-encode-fixed-euc
68 ; (write-read-repeat r0))
69 (if (r0 == ,(charset-id 'latin-jisx0201)) ; Unify
74 (write-read-repeat r0)))
75 (r6 = (r0 == ,(charset-id 'japanese-jisx0208)))
76 (r6 |= (r0 == ,(charset-id 'japanese-jisx0208-1978)))
77 (r6 |= (r0 == ,(charset-id 'chinese-gb2312)))
78 (r6 |= (r0 == ,(charset-id 'korean-ksc5601)))
83 (write-read-repeat r0)))
84 (r6 = (r0 == ,(charset-id 'katakana-jisx0201)))
85 (r6 |= (r0 == ,(charset-id 'chinese-sisheng)))
89 (write-read-repeat r0)))
90 (if (r0 == ,(charset-id 'japanese-jisx0212)) ;G3
95 (write-read-repeat r0)))
100 (make-coding-system 'fixed-euc-jp 4 ?W "Coding System for fixed EUC Japanese"
101 (cons ccl-decode-fixed-euc-jp ccl-encode-fixed-euc))
106 (define-ccl-program ccl-decode-fixed-euc-kr
108 ((r2 = ,(charset-id 'korean-ksc5601))
116 (write-read-repeat r0)))))
118 (define-ccl-program ccl-encode-fixed-euc-kr
123 ; (write-read-repeat r0))
126 (write-read-repeat r0)))
127 (if (r0 == ,(charset-id 'korean-ksc5601))
133 (write-read-repeat r0)))
138 (make-coding-system 'fixed-euc-kr 4 ?W "Coding System for fixed EUC Korean"
139 (cons ccl-decode-fixed-euc-kr ccl-encode-fixed-euc-kr))
142 (defvar egg-zhuyin nil)
144 (defconst yincode-pinyin-shengmu
145 '(("" . 0) ("B" . 1) ("C" . 2) ("Ch" . 3) ("D" . 4)
146 ("F" . 5) ("G" . 6) ("H" . 7) ("J" . 8) ("K" . 9)
147 ("L" . 10) ("M" . 11) ("N" . 12) ("P" . 13) ("Q" . 14)
148 ("R" . 15) ("S" . 16) ("Sh" . 17) ("T" . 18) ("W" . 19)
149 ("X" . 20) ("Y" . 21) ("Z" . 22) ("Zh" . 23)))
151 (defconst yincode-pinyin-yunmu
152 '(("
\9a À" 0 0) ("
\9a À" 0 1) ("
\9a À" 0 3) ("
\9a À" 0 5) ("
\9a À" 0 7)
153 ("a
\9a À" 1 0) ("
\9a ¡
\9a À" 1 1) ("
\9a ¢
\9a À" 1 3) ("
\9a £
\9a À" 1 5) ("
\9a ¤
\9a À" 1 7)
154 ("ai
\9a À" 2 0) ("
\9a ¡i
\9a À" 2 1) ("
\9a ¢i
\9a À" 2 3) ("
\9a £i
\9a À" 2 5) ("
\9a ¤i
\9a À" 2 7)
155 ("an
\9a À" 3 0) ("
\9a ¡n
\9a À" 3 1) ("
\9a ¢n
\9a À" 3 3) ("
\9a £n
\9a À" 3 5) ("
\9a ¤n
\9a À" 3 7)
156 ("ang
\9a À" 4 0) ("
\9a ¡ng
\9a À" 4 1) ("
\9a ¢ng
\9a À" 4 3) ("
\9a £ng
\9a À" 4 5) ("
\9a ¤ng
\9a À" 4 7)
157 ("ao
\9a À" 5 0) ("
\9a ¡o
\9a À" 5 1) ("
\9a ¢o
\9a À" 5 3) ("
\9a £o
\9a À" 5 5) ("
\9a ¤o
\9a À" 5 7)
158 ("e
\9a À" 6 0) ("
\9a ¥
\9a À" 6 1) ("
\9a ¦
\9a À" 6 3) ("
\9a §
\9a À" 6 5) ("
\9a ¨
\9a À" 6 7)
159 ("ei
\9a À" 7 0) ("
\9a ¥i
\9a À" 7 1) ("
\9a ¦i
\9a À" 7 3) ("
\9a §i
\9a À" 7 5) ("
\9a ¨i
\9a À" 7 7)
160 ("en
\9a À" 8 0) ("
\9a ¥n
\9a À" 8 1) ("
\9a ¦n
\9a À" 8 3) ("
\9a §n
\9a À" 8 5) ("
\9a ¨n
\9a À" 8 7)
161 ("eng
\9a À" 9 0) ("
\9a ¥ng
\9a À" 9 1) ("
\9a ¦ng
\9a À" 9 3) ("
\9a §ng
\9a À" 9 5) ("
\9a ¨ng
\9a À" 9 7)
162 ("er
\9a À" 10 0) ("
\9a ¥r
\9a À" 10 1) ("
\9a ¦r
\9a À" 10 3) ("
\9a §r
\9a À" 10 5) ("
\9a ¨r
\9a À" 10 7)
163 ("i
\9a À" 11 0) ("
\9a ©
\9a À" 11 1) ("
\9a ª
\9a À" 11 3) ("
\9a «
\9a À" 11 5) ("
\9a ¬
\9a À" 11 7)
164 ("ia
\9a À" 12 0) ("i
\9a ¡
\9a À" 12 1) ("i
\9a ¢
\9a À" 12 3) ("i
\9a £
\9a À" 12 5) ("i
\9a ¤
\9a À" 12 7)
165 ("ian
\9a À" 13 0) ("i
\9a ¡n
\9a À" 13 1) ("i
\9a ¢n
\9a À" 13 3) ("i
\9a £n
\9a À" 13 5) ("i
\9a ¤n
\9a À" 13 7)
166 ("iang
\9a À" 14 0) ("i
\9a ¡ng
\9a À" 14 1) ("i
\9a ¢ng
\9a À" 14 3) ("i
\9a £ng
\9a À" 14 5) ("i
\9a ¤ng
\9a À" 14 7)
167 ("iao
\9a À" 15 0) ("i
\9a ¡o
\9a À" 15 1) ("i
\9a ¢o
\9a À" 15 3) ("i
\9a £o
\9a À" 15 5) ("i
\9a ¤o
\9a À" 15 7)
168 ("ie
\9a À" 16 0) ("i
\9a ¥
\9a À" 16 1) ("i
\9a ¦
\9a À" 16 3) ("i
\9a §
\9a À" 16 5) ("i
\9a ¨
\9a À" 16 7)
169 ("in
\9a À" 17 0) ("
\9a ©n
\9a À" 17 1) ("
\9a ªn
\9a À" 17 3) ("
\9a «n
\9a À" 17 5) ("
\9a ¬n
\9a À" 17 7)
170 ("ing
\9a À" 18 0) ("
\9a ©ng
\9a À" 18 1) ("
\9a ªng
\9a À" 18 3) ("
\9a «ng
\9a À" 18 5) ("
\9a ¬ng
\9a À" 18 7)
171 ("iong
\9a À" 19 0) ("i
\9a ng
\9a À" 19 1) ("i
\9a ®ng
\9a À" 19 3) ("i
\9a ¯ng
\9a À" 19 5) ("i
\9a °ng
\9a À" 19 7)
172 ("iu
\9a À" 20 0) ("i
\9a ±
\9a À" 20 1) ("i
\9a ²
\9a À" 20 3) ("i
\9a ³
\9a À" 20 5) ("i
\9a ´
\9a À" 20 7)
173 ("m
\9a À" 21 0) ("m
\9a À" 21 1) ("m
\9a À" 21 3) ("m
\9a À" 21 5) ("m
\9a À" 21 7)
174 ("n
\9a À" 22 0) ("n
\9a À" 22 1) ("
\9a ½
\9a À" 22 3) ("
\9a ¾
\9a À" 22 5) ("
\9a ¿
\9a À" 22 7)
175 ("ng
\9a À" 23 0) ("ng
\9a À" 23 1) ("ng
\9a À" 23 3) ("ng
\9a À" 23 5) ("ng
\9a À" 23 7)
176 ("o
\9a À" 24 0) ("
\9a
\9a À" 24 1) ("
\9a ®
\9a À" 24 3) ("
\9a ¯
\9a À" 24 5) ("
\9a °
\9a À" 24 7)
177 ("ong
\9a À" 25 0) ("
\9a ng
\9a À" 25 1) ("
\9a ®ng
\9a À" 25 3) ("
\9a ¯ng
\9a À" 25 5) ("
\9a °ng
\9a À" 25 7)
178 ("ou
\9a À" 26 0) ("
\9a u
\9a À" 26 1) ("
\9a ®u
\9a À" 26 3) ("
\9a ¯u
\9a À" 26 5) ("
\9a °u
\9a À" 26 7)
179 ("u
\9a À" 27 0) ("
\9a ±
\9a À" 27 1) ("
\9a ²
\9a À" 27 3) ("
\9a ³
\9a À" 27 5) ("
\9a ´
\9a À" 27 7)
180 ("ua
\9a À" 28 0) ("u
\9a ¡
\9a À" 28 1) ("u
\9a ¢
\9a À" 28 3) ("u
\9a £
\9a À" 28 5) ("u
\9a ¤
\9a À" 28 7)
181 ("uai
\9a À" 29 0) ("u
\9a ¡i
\9a À" 29 1) ("u
\9a ¢i
\9a À" 29 3) ("u
\9a £i
\9a À" 29 5) ("u
\9a ¤i
\9a À" 29 7)
182 ("uan
\9a À" 30 0) ("u
\9a ¡n
\9a À" 30 1) ("u
\9a ¢n
\9a À" 30 3) ("u
\9a £n
\9a À" 30 5) ("u
\9a ¤n
\9a À" 30 7)
183 ("uang
\9a À" 31 0) ("u
\9a ¡ng
\9a À" 31 1) ("u
\9a ¢ng
\9a À" 31 3) ("u
\9a £ng
\9a À" 31 5) ("u
\9a ¤ng
\9a À" 31 7)
184 ("ue
\9a À" 32 0) ("u
\9a ¥
\9a À" 32 1) ("u
\9a ¦
\9a À" 32 3) ("u
\9a §
\9a À" 32 5) ("u
\9a ¨
\9a À" 32 7)
185 ("ui
\9a À" 33 0) ("u
\9a ©
\9a À" 33 1) ("u
\9a ª
\9a À" 33 3) ("u
\9a «
\9a À" 33 5) ("u
\9a ¬
\9a À" 33 7)
186 ("un
\9a À" 34 0) ("
\9a ±n
\9a À" 34 1) ("
\9a ²n
\9a À" 34 3) ("
\9a ³n
\9a À" 34 5) ("
\9a ´n
\9a À" 34 7)
187 ("uo
\9a À" 35 0) ("u
\9a
\9a À" 35 1) ("u
\9a ®
\9a À" 35 3) ("u
\9a ¯
\9a À" 35 5) ("u
\9a °
\9a À" 35 7)
188 ("
\9a ¹
\9a À" 36 0) ("
\9a µ
\9a À" 36 1) ("
\9a ¶
\9a À" 36 3) ("
\9a ·
\9a À" 36 5) ("
\9a ¸
\9a À" 36 7)
189 ("
\9a ¹e
\9a À" 37 0) ("
\9a ¹
\9a ¥
\9a À" 37 1) ("
\9a ¹
\9a ¦
\9a À" 37 3) ("
\9a ¹
\9a §
\9a À" 37 5) ("
\9a ¹
\9a ¨
\9a À" 37 7)
190 ("0
\9a À" 38 0) ("1
\9a À" 38 1) ("2
\9a À" 38 3) ("3
\9a À" 38 5) ("4
\9a À" 38 7)))
192 (defconst yincode-pinyin-table
194 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0
195 0 1 1 1 1 1 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1
196 0 1 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1
197 0 1 1 1 1 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 1 1 0 0 1
198 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 0 1 0 0 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1
199 0 1 0 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 1
200 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 1 1 0 0 1
201 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 1 1 1 1 1 0 1 1 1 0 0 1
202 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 0 0 1 0 1 0 1 0 0 0 1
203 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 1 1 0 0 1
204 0 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 0 1 0 0 0 1 1 1 1 0 0 1 0 0 0 1 1 1 1 1
205 0 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 1 1 1 0 1 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 1
206 0 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 0 1 0 0 0 0 1 1 1 0 0 1 0 0 0 0 1 1 1 1
207 0 1 1 1 1 1 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 1
208 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 0 0 1 0 1 0 1 0 0 0 1
209 0 0 0 1 1 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 0 1 1 1 0 0 1
210 0 1 1 1 1 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1
211 0 1 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 1 1 1 0 0 1
212 0 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 0 1 0 0 0 0 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1
213 0 1 1 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1
214 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 0 0 1 0 1 0 1 0 0 0 1
215 0 1 0 1 1 1 1 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 1 1 1 0 0 1 0 1 0 1 0 0 0 1
216 0 1 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1
217 0 1 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 1 1 0 0 1
220 (defconst yincode-zhuyin-shengmu
221 '(("" . 0) ("
\9a Å" . 1) ("
\9a Ø" . 2) ("
\9a Ô" . 3) ("
\9a É" . 4)
222 ("
\9a È" . 5) ("
\9a Í" . 6) ("
\9a Ï" . 7) ("
\9a Ð" . 8) ("
\9a Î" . 9)
223 ("
\9a Ì" . 10) ("
\9a Ç" . 11) ("
\9a Ë" . 12) ("
\9a Æ" . 13) ("
\9a Ñ" . 14)
224 ("
\9a Ö" . 15) ("
\9a Ù" . 16) ("
\9a Õ" . 17) ("
\9a Ê" . 18) ("
\9a è" . 19)
225 ("
\9a Ò" . 20) ("
\9a ç" . 21) ("
\9a ×" . 22) ("
\9a Ó" . 23)))
227 (defconst yincode-zhuyin-yunmu
228 '(("
\9a À" 0 0) ("
\9a Á" 0 1) ("
\9a Â" 0 3) ("
\9a Ã" 0 5) ("
\9a Ä" 0 7) ; i
229 ("
\9a Ú
\9a À" 1 0) ("
\9a Ú
\9a Á" 1 1) ("
\9a Ú
\9a Â" 1 3) ("
\9a Ú
\9a Ã" 1 5) ("
\9a Ú
\9a Ä" 1 7) ; a
230 ("
\9a Þ
\9a À" 2 0) ("
\9a Þ
\9a Á" 2 1) ("
\9a Þ
\9a Â" 2 3) ("
\9a Þ
\9a Ã" 2 5) ("
\9a Þ
\9a Ä" 2 7) ; ai
231 ("
\9a â
\9a À" 3 0) ("
\9a â
\9a Á" 3 1) ("
\9a â
\9a Â" 3 3) ("
\9a â
\9a Ã" 3 5) ("
\9a â
\9a Ä" 3 7) ; an
232 ("
\9a ä
\9a À" 4 0) ("
\9a ä
\9a Á" 4 1) ("
\9a ä
\9a Â" 4 3) ("
\9a ä
\9a Ã" 4 5) ("
\9a ä
\9a Ä" 4 7) ; ang
233 ("
\9a à
\9a À" 5 0) ("
\9a à
\9a Á" 5 1) ("
\9a à
\9a Â" 5 3) ("
\9a à
\9a Ã" 5 5) ("
\9a à
\9a Ä" 5 7) ; ao
234 ("
\9a Ü
\9a À" 6 0) ("
\9a Ü
\9a Á" 6 1) ("
\9a Ü
\9a Â" 6 3) ("
\9a Ü
\9a Ã" 6 5) ("
\9a Ü
\9a Ä" 6 7) ; e
235 ("
\9a ß
\9a À" 7 0) ("
\9a ß
\9a Á" 7 1) ("
\9a ß
\9a Â" 7 3) ("
\9a ß
\9a Ã" 7 5) ("
\9a ß
\9a Ä" 7 7) ; ei
236 ("
\9a ã
\9a À" 8 0) ("
\9a ã
\9a Á" 8 1) ("
\9a ã
\9a Â" 8 3) ("
\9a ã
\9a Ã" 8 5) ("
\9a ã
\9a Ä" 8 7) ; en
237 ("
\9a å
\9a À" 9 0) ("
\9a å
\9a Á" 9 1) ("
\9a å
\9a Â" 9 3) ("
\9a å
\9a Ã" 9 5) ("
\9a å
\9a Ä" 9 7) ; eng
238 ("
\9a æ
\9a À" 10 0) ("
\9a æ
\9a Á" 10 1) ("
\9a æ
\9a Â" 10 3) ("
\9a æ
\9a Ã" 10 5) ("
\9a æ
\9a Ä" 10 7) ; er
239 ("
\9a ç
\9a À" 11 0) ("
\9a ç
\9a Á" 11 1) ("
\9a ç
\9a Â" 11 3) ("
\9a ç
\9a Ã" 11 5) ("
\9a ç
\9a Ä" 11 7) ; i
240 ("
\9a ç
\9a Ú
\9a À" 12 0) ("
\9a ç
\9a Ú
\9a Á" 12 1) ("
\9a ç
\9a Ú
\9a Â" 12 3) ("
\9a ç
\9a Ú
\9a Ã" 12 5) ("
\9a ç
\9a Ú
\9a Ä" 12 7) ; ia
241 ("
\9a ç
\9a â
\9a À" 13 0) ("
\9a ç
\9a â
\9a Á" 13 1) ("
\9a ç
\9a â
\9a Â" 13 3) ("
\9a ç
\9a â
\9a Ã" 13 5) ("
\9a ç
\9a â
\9a Ä" 13 7) ; ian
242 ("
\9a ç
\9a ä
\9a À" 14 0) ("
\9a ç
\9a ä
\9a Á" 14 1) ("
\9a ç
\9a ä
\9a Â" 14 3) ("
\9a ç
\9a ä
\9a Ã" 14 5) ("
\9a ç
\9a ä
\9a Ä" 14 7) ; iang
243 ("
\9a ç
\9a à
\9a À" 15 0) ("
\9a ç
\9a à
\9a Á" 15 1) ("
\9a ç
\9a à
\9a Â" 15 3) ("
\9a ç
\9a à
\9a Ã" 15 5) ("
\9a ç
\9a à
\9a Ä" 15 7) ; iao
244 ("
\9a ç
\9a Ý
\9a À" 16 0) ("
\9a ç
\9a Ý
\9a Á" 16 1) ("
\9a ç
\9a Ý
\9a Â" 16 3) ("
\9a ç
\9a Ý
\9a Ã" 16 5) ("
\9a ç
\9a Ý
\9a Ä" 16 7) ; ie
245 ("
\9a ç
\9a ã
\9a À" 17 0) ("
\9a ç
\9a ã
\9a Á" 17 1) ("
\9a ç
\9a ã
\9a Â" 17 3) ("
\9a ç
\9a ã
\9a Ã" 17 5) ("
\9a ç
\9a ã
\9a Ä" 17 7) ; in
246 ("
\9a ç
\9a å
\9a À" 18 0) ("
\9a ç
\9a å
\9a Á" 18 1) ("
\9a ç
\9a å
\9a Â" 18 3) ("
\9a ç
\9a å
\9a Ã" 18 5) ("
\9a ç
\9a å
\9a Ä" 18 7) ; ing
247 ("
\9a é
\9a å
\9a À" 19 0) ("
\9a é
\9a å
\9a Á" 19 1) ("
\9a é
\9a å
\9a Â" 19 3) ("
\9a é
\9a å
\9a Ã" 19 5) ("
\9a é
\9a å
\9a Ä" 19 7) ; iong
248 ("
\9a ç
\9a á
\9a À" 20 0) ("
\9a ç
\9a á
\9a Á" 20 1) ("
\9a ç
\9a á
\9a Â" 20 3) ("
\9a ç
\9a á
\9a Ã" 20 5) ("
\9a ç
\9a á
\9a Ä" 20 7) ; iu
249 ("
\9a Ç
\9a À" 21 0) ("
\9a Ç
\9a Á" 21 1) ("
\9a Ç
\9a Â" 21 3) ("
\9a Ç
\9a Ã" 21 5) ("
\9a Ç
\9a Ä" 21 7) ; m
250 ("
\9a Ë
\9a À" 22 0) ("
\9a Ë
\9a Á" 22 1) ("
\9a Ë
\9a Â" 22 3) ("
\9a Ë
\9a Ã" 22 5) ("
\9a Ë
\9a Ä" 22 7) ; n
251 ("@
\9a À" 23 0) ("@
\9a Á" 23 1) ("@
\9a Â" 23 3) ("@
\9a Ã" 23 5) ("@
\9a Ä" 23 7) ; ng
252 ("
\9a Û
\9a À" 24 0) ("
\9a Û
\9a Á" 24 1) ("
\9a Û
\9a Â" 24 3) ("
\9a Û
\9a Ã" 24 5) ("
\9a Û
\9a Ä" 24 7) ; o
253 ("
\9a è
\9a å
\9a À" 25 0) ("
\9a è
\9a å
\9a Á" 25 1) ("
\9a è
\9a å
\9a Â" 25 3) ("
\9a è
\9a å
\9a Ã" 25 5) ("
\9a è
\9a å
\9a Ä" 25 7) ; ong
254 ("
\9a á
\9a À" 26 0) ("
\9a á
\9a Á" 26 1) ("
\9a á
\9a Â" 26 3) ("
\9a á
\9a Ã" 26 5) ("
\9a á
\9a Ä" 26 7) ; ou
255 ("
\9a è
\9a À" 27 0) ("
\9a è
\9a Á" 27 1) ("
\9a è
\9a Â" 27 3) ("
\9a è
\9a Ã" 27 5) ("
\9a è
\9a Ä" 27 7) ; u
256 ("
\9a è
\9a Ú
\9a À" 28 0) ("
\9a è
\9a Ú
\9a Á" 28 1) ("
\9a è
\9a Ú
\9a Â" 28 3) ("
\9a è
\9a Ú
\9a Ã" 28 5) ("
\9a è
\9a Ú
\9a Ä" 28 7) ; ua
257 ("
\9a è
\9a Þ
\9a À" 29 0) ("
\9a è
\9a Þ
\9a Á" 29 1) ("
\9a è
\9a Þ
\9a Â" 29 3) ("
\9a è
\9a Þ
\9a Ã" 29 5) ("
\9a è
\9a Þ
\9a Ä" 29 7) ; uai
258 ("
\9a è
\9a â
\9a À" 30 0) ("
\9a è
\9a â
\9a Á" 30 1) ("
\9a è
\9a â
\9a Â" 30 3) ("
\9a è
\9a â
\9a Ã" 30 5) ("
\9a è
\9a â
\9a Ä" 30 7) ; uan
259 ("
\9a è
\9a ä
\9a À" 31 0) ("
\9a è
\9a ä
\9a Á" 31 1) ("
\9a è
\9a ä
\9a Â" 31 3) ("
\9a è
\9a ä
\9a Ã" 31 5) ("
\9a è
\9a ä
\9a Ä" 31 7) ; uang
260 ("
\9a é
\9a Ý
\9a À" 37 0) ("
\9a é
\9a Ý
\9a Á" 37 1) ("
\9a é
\9a Ý
\9a Â" 37 3) ("
\9a é
\9a Ý
\9a Ã" 37 5) ("
\9a é
\9a Ý
\9a Ä" 37 7) ; ue
261 ("
\9a è
\9a ß
\9a À" 33 0) ("
\9a è
\9a ß
\9a Á" 33 1) ("
\9a è
\9a ß
\9a Â" 33 3) ("
\9a è
\9a ß
\9a Ã" 33 5) ("
\9a è
\9a ß
\9a Ä" 33 7) ; ui
262 ("
\9a è
\9a ã
\9a À" 34 0) ("
\9a è
\9a ã
\9a Á" 34 1) ("
\9a è
\9a ã
\9a Â" 34 3) ("
\9a è
\9a ã
\9a Ã" 34 5) ("
\9a è
\9a ã
\9a Ä" 34 7) ; un
263 ("
\9a è
\9a Û
\9a À" 35 0) ("
\9a è
\9a Û
\9a Á" 35 1) ("
\9a è
\9a Û
\9a Â" 35 3) ("
\9a è
\9a Û
\9a Ã" 35 5) ("
\9a è
\9a Û
\9a Ä" 35 7) ; uo
264 ("
\9a é
\9a À" 36 0) ("
\9a é
\9a Á" 36 1) ("
\9a é
\9a Â" 36 3) ("
\9a é
\9a Ã" 36 5) ("
\9a é
\9a Ä" 36 7) ;
\9a ¹
265 ("
\9a é
\9a Ý
\9a À" 37 0) ("
\9a é
\9a Ý
\9a Á" 37 1) ("
\9a é
\9a Ý
\9a Â" 37 3) ("
\9a é
\9a Ý
\9a Ã" 37 5) ("
\9a é
\9a Ý
\9a Ä" 37 7) ;
\9a ¹e
266 ("0
\9a À" 38 0) ("1
\9a Á" 38 1) ("2
\9a Â" 38 3) ("3
\9a Ã" 38 5) ("4
\9a Ä" 38 7) ; undefined
267 ("
\9a é
\9a â
\9a À" 39 0) ("
\9a é
\9a â
\9a Á" 39 1) ("
\9a é
\9a â
\9a Â" 39 3) ("
\9a é
\9a â
\9a Ã" 39 5) ("
\9a é
\9a â
\9a Ä" 39 7) ;
\9a ¹an
268 ("
\9a é
\9a ã
\9a À" 40 0) ("
\9a é
\9a ã
\9a Á" 40 1) ("
\9a é
\9a ã
\9a Â" 40 3) ("
\9a é
\9a ã
\9a Ã" 40 5) ("
\9a é
\9a ã
\9a Ä" 40 7) ;
\9a ¹n
271 (defconst yincode-zhuyin-table
274 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
275 ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x9586 ?\x0000 ?\x9592 ?\x9599
276 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 ?\x0000 ?\x0000
277 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x959b ?\x95a0 ?\x0000 ?\x959e
280 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000
281 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000
282 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 ?\x0000
283 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
286 ?\x828b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
287 ?\x0000 ?\x0280 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
288 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
289 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
292 ?\x838b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000
293 ?\x0000 ?\x0380 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
294 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
295 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
298 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
299 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x0000
300 ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
301 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
304 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000
305 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
306 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
307 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
310 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
311 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
312 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
313 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
316 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
317 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
318 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
319 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
322 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
323 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
324 ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x08a4 ?\x0000 ?\x0000
325 ?\x08a7 ?\x0000 ?\x08a5 ?\x0000 ?\x08a8 ?\x0000 ?\x889b ?\x88a0 ?\x8000 ?\x889e
328 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
329 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
330 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
331 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
334 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000
335 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000
336 ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
337 ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000
340 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
341 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000
342 ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
343 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
346 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
347 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000
348 ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
349 ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000
352 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000
353 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000
354 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
355 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
358 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
359 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
360 ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0ea4 ?\x0000 ?\x0000
361 ?\x0ea7 ?\x0000 ?\x0ea5 ?\x0000 ?\x0ea8 ?\x0000 ?\x8e9b ?\x8ea0 ?\x8000 ?\x8e9e
364 ?\x8f8b ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000
365 ?\x0000 ?\x0f80 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
366 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000
367 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
370 ?\x908b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000
371 ?\x0000 ?\x1080 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
372 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
373 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
376 ?\x918b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
377 ?\x0000 ?\x1180 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
378 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
379 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
382 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000
383 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x0000
384 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
385 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
388 ?\x939b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000
389 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
390 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 ?\x0000 ?\x1380 ?\x0000 ?\x0000
391 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
394 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
395 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
396 ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x14a4 ?\x0000 ?\x0000
397 ?\x14a7 ?\x0000 ?\x14a5 ?\x0000 ?\x14a8 ?\x0000 ?\x949b ?\x94a0 ?\x8000 ?\x949e
400 ?\x958b ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0090 ?\x0000 ?\x9591 ?\x9592
401 ?\x0000 ?\x1580 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x1588 ?\x1589 ?\x0000
402 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0093 ?\x8000 ?\x00a4 ?\x0000 ?\x0000
403 ?\x00a7 ?\x0000 ?\x00a5 ?\x0000 ?\x00a8 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
406 ?\x968b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
407 ?\x0000 ?\x1680 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
408 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
409 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
412 ?\x978b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
413 ?\x0000 ?\x1780 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
414 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
415 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
419 (defun egg-chinese-syllable (str &optional start)
421 (setq str (substring str start)))
422 (or (car (egg-pinyin-syllable str))
423 (car (egg-zhuyin-syllable str))))
425 (defsubst egg-make-fixed-euc-china-code (s y)
427 (+ (* 2 (nth 1 y)) (logand (nth 2 y) 1) 32)
428 (+ (* 4 (if (= s 0) 20 s)) (lsh (nth 2 y) -1) 156))))
430 (defun egg-pinyin-syllable (str)
432 (if (string-match "^[A-Za-z
\9a ¡-
\9a ¿]+
\9a À" str)
434 (setq end (match-end 0))
436 ((setq s (cdr (assoc (substring str 0 2) yincode-pinyin-shengmu)))
437 (setq y (substring str 2 end)))
438 ((setq s (cdr (assoc (substring str 0 1) yincode-pinyin-shengmu)))
439 (setq y (substring str 1 end)))
441 (setq s 0 y (substring str 0 end))))
442 (if (and (setq y (assoc y yincode-pinyin-yunmu))
443 (= (aref yincode-pinyin-table (+ (* 39 s) (nth 1 y))) 1))
444 (cons end (egg-make-fixed-euc-china-code s y)))))))
446 (defun egg-zhuyin-syllable (str)
447 (let (end s y c z (zhuyin-len (charset-bytes 'chinese-sisheng)))
448 (if (string-match "^[
\9a Å-
\9a é@0-4]+[
\9a À
\9a Á
\9a Â
\9a Ã
\9a Ä]" str)
450 (setq end (match-end 0)
451 c (substring str 0 zhuyin-len)
452 s (cdr (assoc c yincode-zhuyin-shengmu))
453 y (assoc (substring str zhuyin-len end) yincode-zhuyin-yunmu))
456 y (assoc (substring str 0 end) yincode-zhuyin-yunmu)))
458 (setq z (aref yincode-zhuyin-table (+ (* 41 s) (nth 1 y))))
459 (/= (logand z ?\x8000) 0))
460 (if (/= (logand z ?\x80) 0)
461 (cons end (egg-make-fixed-euc-china-code
462 (logand (lsh z -8) ?\x7f)
463 (list nil (logand z ?\x7f) (nth 2 y))))
464 (cons end (egg-make-fixed-euc-china-code s y))))))))
466 (defun encode-fixed-euc-china-region (beg end type)
467 "Encode the text in the region to EUC-CN/TW."
468 (let (s syl c cset (maxlen (max (length "Zhu
\9a ¡ng
\9a À") (length "
\9a Ó
\9a è
\9a ä
\9a Á"))))
471 (narrow-to-region beg end)
472 (goto-char (point-min))
473 (while (< (point) (point-max))
474 (setq s (buffer-substring (point)
475 (min (+ (point) maxlen) (point-max))))
477 ((setq syl (egg-pinyin-syllable s))
478 (delete-region (point) (+ (point) (car syl)))
480 ((setq syl (egg-zhuyin-syllable s))
481 (delete-region (point) (+ (point) (car syl)))
484 (setq c (split-char (following-char))
487 ((or (and (eq cset 'chinese-gb2312) (eq type 'cn))
488 (and (eq cset 'chinese-cns11643-1) (eq type 'tw)))
490 (insert (+ (nth 1 c) 128) (+ (nth 2 c) 128)))
491 ((and (eq cset 'chinese-cns11643-2) (eq type 'tw))
493 (insert (+ (nth 1 c) 128) (nth 2 c)))
494 ((eq cset 'chinese-sisheng)
496 (insert 0 (+ (nth 1 c) 128)))
498 (delete-region (point) (1+ (point)))
499 (insert 0 (nth 1 c)))))))
500 (- (point-max) (point-min))))))
502 (defun pre-write-encode-fixed-euc-china (from to type)
503 (let ((buf (current-buffer))
504 (work (get-buffer-create " *pre-write-encoding-work*")))
509 (insert-buffer-substring buf from to))
510 (encode-fixed-euc-china-region 1 (point-max) type)
513 (defun pre-write-encode-euc-cn (from to)
514 (pre-write-encode-fixed-euc-china from to 'cn))
516 (defun pre-write-encode-euc-tw (from to)
517 (pre-write-encode-fixed-euc-china from to 'tw))
519 (defun decode-fixed-euc-china-region (beg end type)
520 "Decode EUC-CN/TW encoded text in the region.
521 Return the length of resulting text."
526 (narrow-to-region beg end)
527 (goto-char (point-min))
528 (while (< (point) (point-max))
529 (setq c1 (buffer-substring (point) (+ (point) 2))
532 (delete-region (point) (+ (point) 2))
536 (insert leading-code-private-11
537 (charset-id 'chinese-sisheng)
543 (insert (charset-id 'chinese-gb2312) c0 (logior c1 ?\x80)))
545 (insert (charset-id 'chinese-cns11643-1) c0 c1))
547 (insert (charset-id 'chinese-cns11643-2) c0 (+ c1 ?\x80)))))
549 (setq c1 (logand c1 ?\x7f))
550 (setq s (- (lsh c1 -2) 7) ;;(+ (lsh (- c1 32) -2) 1)
551 y (- (lsh c0 -1) 16) ;;(lsh (- c0 32) -1)
552 ss (+ (logand c0 1) (logand c1 3)))
555 (setq c0 (aref yincode-zhuyin-table (+ (* 41 s) y)))
556 (if (eq (logand c0 ?\x8080) ?\x80)
558 y (logand c0 ?\x7f)))
560 (eq (aref yincode-pinyin-table (+ (* 39 s) y)) 0))
562 (insert (car (nth s yincode-zhuyin-shengmu))
563 (car (nth (+ (* 5 y) ss) yincode-zhuyin-yunmu))))
565 (eq (aref yincode-pinyin-table (+ (* 39 s) y)) 0))
567 (insert (car (nth s yincode-pinyin-shengmu))
568 (car (nth (+ (* 5 y) ss) yincode-pinyin-yunmu)))))))
569 (- (point-max) (point-min))))
570 (if (looking-at "\0\0") (forward-char 2))))
572 (defun post-read-decode-fixed-euc-china (len type)
574 (buffer-modified-p (buffer-modified-p)))
576 (decode-fixed-euc-china-region pos (+ pos len) type)
577 (set-buffer-modified-p buffer-modified-p))))
579 (defun post-read-decode-euc-cn (len)
580 (post-read-decode-fixed-euc-china len 'cn))
582 (defun post-read-decode-euc-tw (len)
583 (post-read-decode-fixed-euc-china len 'tw))
585 (make-coding-system 'fixed-euc-cn 5 ?W "Coding System for fixed EUC Chinese-gb2312")
586 (put 'fixed-euc-cn 'pre-write-conversion 'pre-write-encode-euc-cn)
587 (put 'fixed-euc-cn 'post-read-conversion 'post-read-decode-euc-cn)
589 (make-coding-system 'fixed-euc-tw 5 ?W "Coding System for fixed EUC Chinese-cns11643")
590 (put 'fixed-euc-tw 'pre-write-conversion 'pre-write-encode-euc-tw)
591 (put 'fixed-euc-tw 'post-read-conversion 'post-read-decode-euc-tw)
593 (defsubst comm-format-u32c (uint32c)
594 (let ((h0 (car uint32c))
596 (let ((b0 (logand (lsh h0 -8) 255))
598 (b2 (logand (lsh h1 -8) 255))
599 (b3 (logand h1 255)))
603 (insert-char b3 1))))
605 (defsubst comm-format-u32 (uint32)
606 (let ((b0 (logand (lsh uint32 -24) 255))
607 (b1 (logand (lsh uint32 -16) 255))
608 (b2 (logand (lsh uint32 -8) 255))
609 (b3 (logand uint32 255)))
615 (defsubst comm-format-i32 (int32)
616 (let ((b0 (logand (ash int32 -24) 255))
617 (b1 (logand (ash int32 -16) 255))
618 (b2 (logand (ash int32 -8) 255))
619 (b3 (logand int32 255)))
625 (defsubst comm-format-u16 (uint16)
626 (let ((b0 (logand (lsh uint16 -8) 255))
627 (b1 (logand uint16 255)))
631 (defsubst comm-format-u8 (uint8)
632 (let ((b0 (logand uint8 255)))
635 ;;; XXX should support other code conversion
636 (defsubst comm-format-u16-string (s)
637 (let ((euc-string (encode-coding-string s egg-fixed-euc)))
642 ;;; XXX should support other code conversion
643 (defsubst comm-format-mb-string (s)
644 (let ((euc-string (encode-coding-string s egg-mb-euc)))
648 (defsubst comm-format-u8-string (s)
652 (defsubst comm-format-bytes (s)
656 (defmacro comm-format (format &rest args)
657 "Format a string out of a control-list and arguments into the buffer.
658 u means unsigned 32-bit in big endian.
659 i means unsigned 32-bit in big endian.
660 w means unsigned 16-bit in big endian.
661 b means unsigned 8-bit.
662 S means 16-bit(big endian) wide-character string (0x0000 terminated).
663 E means multibyte string (0x00 terminated).
664 s means 8-bit string (0x00 terminated)."
665 (let ((p args) result arg f)
668 (setq f (car format))
672 (cond ((eq f 'U) (list 'comm-format-u32c arg))
673 ((eq f 'u) (list 'comm-format-u32 arg))
674 ((eq f 'i) (list 'comm-format-i32 arg))
675 ((eq f 'w) (list 'comm-format-u16 arg))
676 ((eq f 'b) (list 'comm-format-u8 arg))
677 ((eq f 'S) (list 'comm-format-u16-string arg))
678 ((eq f 'E) (list 'comm-format-mb-string arg))
679 ((eq f 's) (list 'comm-format-u8-string arg))
680 ((eq f 'B) (list 'comm-format-bytes arg))))))
682 (setq format (cdr format)))
687 ;; Do not move the point, leave it where it was.
688 (defun comm-accept-process-output (proc)
690 (accept-process-output proc)
693 ;; Assume PROC is bound to the process of current buffer
694 (defsubst comm-following-char-or-wait (proc)
697 (while (= p (point-max))
698 (accept-process-output proc))
702 (defun comm-following+forward-char (proc)
704 (comm-following-char-or-wait proc)
707 (defsubst comm-unpack-u32c (proc uint32c)
711 (lsh (comm-following+forward-char proc) 8)
712 (comm-following+forward-char proc)))
715 (lsh (comm-following+forward-char proc) 8)
716 (comm-following+forward-char proc)))
717 (set uint32c (cons h0 h1))))
719 (defsubst comm-unpack-u32 (proc uint32)
722 (lsh (comm-following+forward-char proc) 24)
723 (lsh (comm-following+forward-char proc) 16)
724 (lsh (comm-following+forward-char proc) 8)
725 (comm-following+forward-char proc))))
727 (defsubst comm-unpack-u16 (proc uint16)
730 (lsh (comm-following+forward-char proc) 8)
731 (comm-following+forward-char proc))))
733 (defsubst comm-unpack-u8 (proc uint8)
735 (comm-following+forward-char proc)))
737 ;;; XXX should support other conversion (euc-kr, cns)
738 (defsubst comm-unpack-u16-string (proc s)
739 (let ((start (point)))
740 (while (not (search-forward "\0\0" nil t))
741 (comm-accept-process-output proc))
742 (set s (buffer-substring start
744 (decode-coding-region start (- (point) 2)
747 ;;; XXX should support other conversion (euc-kr, cns)
748 (defsubst comm-unpack-mb-string (proc s)
749 (let ((start (point)))
750 (while (not (search-forward "\0" nil t))
751 (comm-accept-process-output proc))
752 (set s (buffer-substring start
754 (decode-coding-region start (- (point) 1)
757 (defsubst comm-unpack-u8-string (proc s)
758 (let ((start (point)))
759 (while (not (search-forward "\0" nil 1))
760 (comm-accept-process-output proc))
761 (set s (buffer-substring start (1- (point))))))
763 (defsubst comm-unpack-bytes (proc s)
764 (let ((start (point)))
765 (while (not (search-forward "\377" nil 1))
766 (comm-accept-process-output proc))
767 (set s (buffer-substring start (1- (point))))))
769 (defmacro comm-unpack (format &rest args)
770 "Unpack a string out of a control-string and set arguments.
771 u means unsigned 32-bit in big endian.
772 w means unsigned 16-bit in big endian.
773 b means unsigned 8-bit.
774 S means 16-bit(big endian) string (0x0000 terminated).
775 E means multibyte string (0x00 terminated).
776 s means 8-bit string (0x00 terminated).
778 (let ((p args) result arg f)
781 (setq f (car format))
785 (cond ((eq f 'U) (list 'comm-unpack-u32c
786 'proc (list 'quote arg)))
787 ((eq f 'u) (list 'comm-unpack-u32
788 'proc (list 'quote arg)))
789 ((eq f 'w) (list 'comm-unpack-u16
790 'proc (list 'quote arg)))
791 ((eq f 'b) (list 'comm-unpack-u8
792 'proc (list 'quote arg)))
793 ((eq f 'S) (list 'comm-unpack-u16-string
794 'proc (list 'quote arg)))
795 ((eq f 'E) (list 'comm-unpack-mb-string
796 'proc (list 'quote arg)))
797 ((eq f 's) (list 'comm-unpack-u8-string
798 'proc (list 'quote arg)))
799 ((eq f 'B) (list 'comm-unpack-u8-string
800 'proc (list 'quote arg)))))))
802 (setq format (cdr format)))
807 (defmacro comm-call-with-proc (proc vlist send-expr &rest receive-exprs)
812 (set-buffer (process-buffer proc))
815 (process-send-region proc (point-min) (point-max))
816 (goto-char (prog1 (point) (accept-process-output proc))))
819 (defmacro comm-call-with-proc-1 (proc vlist send-expr &rest receive-exprs)
826 (process-send-region proc (point-min) (point-max))
827 (goto-char (prog1 (point) (accept-process-output proc))))
831 ;;; egg-com.el ends here.