--- /dev/null
+;;; euc-china.el --- Fixed EUC-CN/TW handling routines.
+
+;; Copyright (C) 1997, 1998 Mule Project,
+;; Powered by Electrotechnical Laboratory, JAPAN.
+;; Project Leader: Satoru Tomura <tomura@etl.go.jp>
+
+;; Author: KATAYAMA Yoshio <kate@pfu.co.jp>
+;; Maintainer: KATAYAMA Yoshio <kate@pfu.co.jp>
+;; Keywords: mule, multilingual, input method, chinese
+
+;; This file will be part of GNU Emacs (in future).
+
+;; EGG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; EGG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+
+;;; Code:
+
+(defvar egg-zhuyin nil)
+
+(defconst yincode-pinyin-shengmu
+ '(("" . 0) ("B" . 1) ("C" . 2) ("Ch" . 3) ("D" . 4)
+ ("F" . 5) ("G" . 6) ("H" . 7) ("J" . 8) ("K" . 9)
+ ("L" . 10) ("M" . 11) ("N" . 12) ("P" . 13) ("Q" . 14)
+ ("R" . 15) ("S" . 16) ("Sh" . 17) ("T" . 18) ("W" . 19)
+ ("X" . 20) ("Y" . 21) ("Z" . 22) ("Zh" . 23)))
+
+(defconst yincode-pinyin-yunmu
+ '(("\e(0@\e(B" 0 0) ("\e(0@\e(B" 0 1) ("\e(0@\e(B" 0 3) ("\e(0@\e(B" 0 5) ("\e(0@\e(B" 0 7)
+ ("a\e(0@\e(B" 1 0) ("\e(0!@\e(B" 1 1) ("\e(0"@\e(B" 1 3) ("\e(0#@\e(B" 1 5) ("\e(0$@\e(B" 1 7)
+ ("ai\e(0@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 0 0 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1
+ 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
+ ])
+
+(defconst yincode-zhuyin-shengmu
+ '(("" . 0) ("\e(0E\e(B" . 1) ("\e(0X\e(B" . 2) ("\e(0T\e(B" . 3) ("\e(0I\e(B" . 4)
+ ("\e(0H\e(B" . 5) ("\e(0M\e(B" . 6) ("\e(0O\e(B" . 7) ("\e(0P\e(B" . 8) ("\e(0N\e(B" . 9)
+ ("\e(0L\e(B" . 10) ("\e(0G\e(B" . 11) ("\e(0K\e(B" . 12) ("\e(0F\e(B" . 13) ("\e(0Q\e(B" . 14)
+ ("\e(0V\e(B" . 15) ("\e(0Y\e(B" . 16) ("\e(0U\e(B" . 17) ("\e(0J\e(B" . 18) ("\e(0h\e(B" . 19)
+ ("\e(0R\e(B" . 20) ("\e(0g\e(B" . 21) ("\e(0W\e(B" . 22) ("\e(0S\e(B" . 23)))
+
+(defconst yincode-zhuyin-yunmu
+ '(("\e(0@\e(B" 0 0) ("\e(0A\e(B" 0 1) ("\e(0B\e(B" 0 3) ("\e(0C\e(B" 0 5) ("\e(0D\e(B" 0 7) ; i
+ ("\e(0Z@\e(B" 1 0) ("\e(0ZA\e(B" 1 1) ("\e(0ZB\e(B" 1 3) ("\e(0ZC\e(B" 1 5) ("\e(0ZD\e(B" 1 7) ; a
+ ("\e(0^@\e(B" 2 0) ("\e(0^A\e(B" 2 1) ("\e(0^B\e(B" 2 3) ("\e(0^C\e(B" 2 5) ("\e(0^D\e(B" 2 7) ; ai
+ ("\e(0b@\e(B" 3 0) ("\e(0bA\e(B" 3 1) ("\e(0bB\e(B" 3 3) ("\e(0bC\e(B" 3 5) ("\e(0bD\e(B" 3 7) ; an
+ ("\e(0d@\e(B" 4 0) ("\e(0dA\e(B" 4 1) ("\e(0dB\e(B" 4 3) ("\e(0dC\e(B" 4 5) ("\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("\e(0g`A\e(B" 15 1) ("\e(0g`B\e(B" 15 3) ("\e(0g`C\e(B" 15 5) ("\e(0g`D\e(B" 15 7) ; iao
+ ("\e(0g]@\e(B" 16 0) ("\e(0g]A\e(B" 16 1) ("\e(0g]B\e(B" 16 3) ("\e(0g]C\e(B" 16 5) ("\e(0g]D\e(B" 16 7) ; ie
+ ("\e(0gc@\e(B" 17 0) ("\e(0gcA\e(B" 17 1) ("\e(0gcB\e(B" 17 3) ("\e(0gcC\e(B" 17 5) ("\e(0gcD\e(B" 17 7) ; in
+ ("\e(0ge@\e(B" 18 0) ("\e(0geA\e(B" 18 1) ("\e(0geB\e(B" 18 3) ("\e(0geC\e(B" 18 5) ("\e(0geD\e(B" 18 7) ; ing
+ ("\e(0ie@\e(B" 19 0) ("\e(0ieA\e(B" 19 1) ("\e(0ieB\e(B" 19 3) ("\e(0ieC\e(B" 19 5) ("\e(0ieD\e(B" 19 7) ; iong
+ ("\e(0ga@\e(B" 20 0) ("\e(0gaA\e(B" 20 1) ("\e(0gaB\e(B" 20 3) ("\e(0gaC\e(B" 20 5) ("\e(0gaD\e(B" 20 7) ; iu
+ ("\e(0G@\e(B" 21 0) ("\e(0GA\e(B" 21 1) ("\e(0GB\e(B" 21 3) ("\e(0GC\e(B" 21 5) ("\e(0GD\e(B" 21 7) ; m
+ ("\e(0K@\e(B" 22 0) ("\e(0KA\e(B" 22 1) ("\e(0KB\e(B" 22 3) ("\e(0KC\e(B" 22 5) ("\e(0KD\e(B" 22 7) ; n
+ ("@\e(0@\e(B" 23 0) ("@\e(0A\e(B" 23 1) ("@\e(0B\e(B" 23 3) ("@\e(0C\e(B" 23 5) ("@\e(0D\e(B" 23 7) ; ng
+ ("\e(0[@\e(B" 24 0) ("\e(0[A\e(B" 24 1) ("\e(0[B\e(B" 24 3) ("\e(0[C\e(B" 24 5) ("\e(0[D\e(B" 24 7) ; o
+ ("\e(0he@\e(B" 25 0) ("\e(0heA\e(B" 25 1) ("\e(0heB\e(B" 25 3) ("\e(0heC\e(B" 25 5) ("\e(0heD\e(B" 25 7) ; ong
+ ("\e(0a@\e(B" 26 0) ("\e(0aA\e(B" 26 1) ("\e(0aB\e(B" 26 3) ("\e(0aC\e(B" 26 5) ("\e(0aD\e(B" 26 7) ; ou
+ ("\e(0h@\e(B" 27 0) ("\e(0hA\e(B" 27 1) ("\e(0hB\e(B" 27 3) ("\e(0hC\e(B" 27 5) ("\e(0hD\e(B" 27 7) ; u
+ ("\e(0hZ@\e(B" 28 0) ("\e(0hZA\e(B" 28 1) ("\e(0hZB\e(B" 28 3) ("\e(0hZC\e(B" 28 5) ("\e(0hZD\e(B" 28 7) ; ua
+ ("\e(0h^@\e(B" 29 0) ("\e(0h^A\e(B" 29 1) ("\e(0h^B\e(B" 29 3) ("\e(0h^C\e(B" 29 5) ("\e(0h^D\e(B" 29 7) ; uai
+ ("\e(0hb@\e(B" 30 0) ("\e(0hbA\e(B" 30 1) ("\e(0hbB\e(B" 30 3) ("\e(0hbC\e(B" 30 5) ("\e(0hbD\e(B" 30 7) ; uan
+ ("\e(0hd@\e(B" 31 0) ("\e(0hdA\e(B" 31 1) ("\e(0hdB\e(B" 31 3) ("\e(0hdC\e(B" 31 5) ("\e(0hdD\e(B" 31 7) ; uang
+ ("\e(0i]@\e(B" 37 0) ("\e(0i]A\e(B" 37 1) ("\e(0i]B\e(B" 37 3) ("\e(0i]C\e(B" 37 5) ("\e(0i]D\e(B" 37 7) ; ue
+ ("\e(0h_@\e(B" 33 0) ("\e(0h_A\e(B" 33 1) ("\e(0h_B\e(B" 33 3) ("\e(0h_C\e(B" 33 5) ("\e(0h_D\e(B" 33 7) ; ui
+ ("\e(0hc@\e(B" 34 0) ("\e(0hcA\e(B" 34 1) ("\e(0hcB\e(B" 34 3) ("\e(0hcC\e(B" 34 5) ("\e(0hcD\e(B" 34 7) ; un
+ ("\e(0h[@\e(B" 35 0) ("\e(0h[A\e(B" 35 1) ("\e(0h[B\e(B" 35 3) ("\e(0h[C\e(B" 35 5) ("\e(0h[D\e(B" 35 7) ; uo
+ ("\e(0i@\e(B" 36 0) ("\e(0iA\e(B" 36 1) ("\e(0iB\e(B" 36 3) ("\e(0iC\e(B" 36 5) ("\e(0iD\e(B" 36 7) ; \e(09\e(B
+ ("\e(0i]@\e(B" 37 0) ("\e(0i]A\e(B" 37 1) ("\e(0i]B\e(B" 37 3) ("\e(0i]C\e(B" 37 5) ("\e(0i]D\e(B" 37 7) ; \e(09\e(Be
+ ("0\e(0@\e(B" 38 0) ("1\e(0A\e(B" 38 1) ("2\e(0B\e(B" 38 3) ("3\e(0C\e(B" 38 5) ("4\e(0D\e(B" 38 7) ; undefined
+ ("\e(0ib@\e(B" 39 0) ("\e(0ibA\e(B" 39 1) ("\e(0ibB\e(B" 39 3) ("\e(0ibC\e(B" 39 5) ("\e(0ibD\e(B" 39 7) ; \e(09\e(Ban
+ ("\e(0ic@\e(B" 40 0) ("\e(0icA\e(B" 40 1) ("\e(0icB\e(B" 40 3) ("\e(0icC\e(B" 40 5) ("\e(0icD\e(B" 40 7) ; \e(09\e(Bn
+ ))
+
+(defconst yincode-zhuyin-table
+ [
+ ;; empty ShengMu
+ ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x9586 ?\x0000 ?\x9592 ?\x9599
+ ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 ?\x0000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x959b ?\x95a0 ?\x0000 ?\x959e
+ ?\x95a2
+ ;; ShengMu B
+ ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000
+ ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu C
+ ?\x828b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x0000 ?\x0280 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
+ ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu Ch
+ ?\x838b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000
+ ?\x0000 ?\x0380 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu D
+ ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x0000
+ ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
+ ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu F
+ ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu G
+ ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu H
+ ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
+ ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu J
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
+ ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x08a4 ?\x0000 ?\x0000
+ ?\x08a7 ?\x0000 ?\x08a5 ?\x0000 ?\x08a8 ?\x0000 ?\x889b ?\x88a0 ?\x8000 ?\x889e
+ ?\x88a2
+ ;; ShengMu K
+ ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu L
+ ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000
+ ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000
+ ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
+ ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu M
+ ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000
+ ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu N
+ ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000
+ ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
+ ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu P
+ ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000
+ ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu Q
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
+ ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0ea4 ?\x0000 ?\x0000
+ ?\x0ea7 ?\x0000 ?\x0ea5 ?\x0000 ?\x0ea8 ?\x0000 ?\x8e9b ?\x8ea0 ?\x8000 ?\x8e9e
+ ?\x8ea2
+ ;; ShengMu R
+ ?\x8f8b ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000
+ ?\x0000 ?\x0f80 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000
+ ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu S
+ ?\x908b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000
+ ?\x0000 ?\x1080 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
+ ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu Sh
+ ?\x918b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x0000 ?\x1180 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu T
+ ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000
+ ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
+ ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu W
+ ?\x939b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 ?\x0000 ?\x1380 ?\x0000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu X
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
+ ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x14a4 ?\x0000 ?\x0000
+ ?\x14a7 ?\x0000 ?\x14a5 ?\x0000 ?\x14a8 ?\x0000 ?\x949b ?\x94a0 ?\x8000 ?\x949e
+ ?\x94a2
+ ;; ShengMu Y
+ ?\x958b ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0090 ?\x0000 ?\x9591 ?\x9592
+ ?\x0000 ?\x1580 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x1588 ?\x1589 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0093 ?\x8000 ?\x00a4 ?\x0000 ?\x0000
+ ?\x00a7 ?\x0000 ?\x00a5 ?\x0000 ?\x00a8 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu Z
+ ?\x968b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x0000 ?\x1680 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000
+ ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000
+ ;; ShengMu Zh
+ ?\x978b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x0000 ?\x1780 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000
+ ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000
+ ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000
+ ?\x0000
+ ])
+
+(defun egg-chinese-syllable (str &optional start)
+ (if start
+ (setq str (substring str start)))
+ (or (car (egg-pinyin-syllable str))
+ (car (egg-zhuyin-syllable str))))
+
+(defsubst egg-make-fixed-euc-china-code (s y)
+ (concat (list
+ (+ (* 2 (nth 1 y)) (logand (nth 2 y) 1) 32)
+ (+ (* 4 (if (= s 0) 20 s)) (lsh (nth 2 y) -1) 156))))
+
+(defun egg-pinyin-syllable (str)
+ (let (s y end)
+ (if (string-match "^[A-Za-z\e(0!\e(B-\e(0?\e(B]+\e(0@\e(B" str)
+ (progn
+ (setq end (match-end 0))
+ (cond
+ ((setq s (cdr (assoc (substring str 0 2) yincode-pinyin-shengmu)))
+ (setq y (substring str 2 end)))
+ ((setq s (cdr (assoc (substring str 0 1) yincode-pinyin-shengmu)))
+ (setq y (substring str 1 end)))
+ (t
+ (setq s 0 y (substring str 0 end))))
+ (if (and (setq y (assoc y yincode-pinyin-yunmu))
+ (= (aref yincode-pinyin-table (+ (* 39 s) (nth 1 y))) 1))
+ (cons end (egg-make-fixed-euc-china-code s y)))))))
+
+(defun egg-zhuyin-syllable (str)
+ (let (end s y c z (zhuyin-len (charset-bytes 'chinese-sisheng)))
+ (if (string-match "^[\e(0E\e(B-\e(0i\e(B@0-4]+[\e(0@ABCD\e(B]" str)
+ (progn
+ (setq end (match-end 0)
+ c (substring str 0 zhuyin-len)
+ s (cdr (assoc c yincode-zhuyin-shengmu))
+ y (assoc (substring str zhuyin-len end) yincode-zhuyin-yunmu))
+ (if (null (and s y))
+ (setq s 0
+ y (assoc (substring str 0 end) yincode-zhuyin-yunmu)))
+ (if (and y
+ (setq z (aref yincode-zhuyin-table (+ (* 41 s) (nth 1 y))))
+ (/= (logand z ?\x8000) 0))
+ (if (/= (logand z ?\x80) 0)
+ (cons end (egg-make-fixed-euc-china-code
+ (logand (lsh z -8) ?\x7f)
+ (list nil (logand z ?\x7f) (nth 2 y))))
+ (cons end (egg-make-fixed-euc-china-code s y))))))))
+
+(defun encode-fixed-euc-china-region (beg end type)
+ "Encode the text in the region to EUC-CN/TW."
+ (let (s syl c cset (maxlen (max (length "Zhu\e(0!\e(Bng\e(0@\e(B") (length "\e(0ShdA\e(B"))))
+ (save-excursion
+ (save-restriction
+ (narrow-to-region beg end)
+ (goto-char (point-min))
+ (while (< (point) (point-max))
+ (setq s (buffer-substring (point)
+ (min (+ (point) maxlen) (point-max))))
+ (cond
+ ((setq syl (egg-pinyin-syllable s))
+ (delete-region (point) (+ (point) (car syl)))
+ (insert (cdr syl)))
+ ((setq syl (egg-zhuyin-syllable s))
+ (delete-region (point) (+ (point) (car syl)))
+ (insert (cdr syl)))
+ (t
+ (setq c (split-char (following-char))
+ cset (car c))
+ (cond
+ ((or (and (eq cset 'chinese-gb2312) (eq type 'cn))
+ (and (eq cset 'chinese-cns11643-1) (eq type 'tw)))
+ (delete-char 1)
+ (insert (+ (nth 1 c) 128) (+ (nth 2 c) 128)))
+ ((and (eq cset 'chinese-cns11643-2) (eq type 'tw))
+ (delete-char 1)
+ (insert (+ (nth 1 c) 128) (nth 2 c)))
+ ((eq cset 'chinese-sisheng)
+ (delete-char 1)
+ (insert 0 (+ (nth 1 c) 128)))
+ (t
+ (delete-region (point) (1+ (point)))
+ (insert 0 (nth 1 c)))))))
+ (- (point-max) (point-min))))))
+
+(defun pre-write-encode-fixed-euc-china (from to type)
+ (let ((buf (current-buffer))
+ (work (get-buffer-create " *pre-write-encoding-work*")))
+ (set-buffer work)
+ (erase-buffer)
+ (if (stringp from)
+ (insert from)
+ (insert-buffer-substring buf from to))
+ (encode-fixed-euc-china-region 1 (point-max) type)
+ nil))
+
+(defun pre-write-encode-euc-cn (from to)
+ (pre-write-encode-fixed-euc-china from to 'cn))
+
+(defun pre-write-encode-euc-tw (from to)
+ (pre-write-encode-fixed-euc-china from to 'tw))
+
+(defun decode-fixed-euc-china-region (beg end type)
+ "Decode EUC-CN/TW encoded text in the region.
+Return the length of resulting text."
+ (interactive "r")
+ (prog1
+ (let (c0 c1 s y ss)
+ (save-restriction
+ (narrow-to-region beg end)
+ (goto-char (point-min))
+ (while (< (point) (point-max))
+ (setq c1 (buffer-substring (point) (+ (point) 2))
+ c0 (aref c1 0)
+ c1 (aref c1 1))
+ (delete-region (point) (+ (point) 2))
+ (cond
+ ((eq c0 0)
+ (if (> c1 ?\xa0)
+ (insert leading-code-private-11
+ (charset-id 'chinese-sisheng)
+ c1)
+ (insert c1)))
+ ((>= c0 ?\x80)
+ (cond
+ ((eq type 'cn)
+ (insert (charset-id 'chinese-gb2312) c0 (logior c1 ?\x80)))
+ ((>= c0 ?\x80)
+ (insert (charset-id 'chinese-cns11643-1) c0 c1))
+ (t
+ (insert (charset-id 'chinese-cns11643-2) c0 (+ c1 ?\x80)))))
+ (t
+ (setq c1 (logand c1 ?\x7f))
+ (setq s (- (lsh c1 -2) 7) ;;(+ (lsh (- c1 32) -2) 1)
+ y (- (lsh c0 -1) 16) ;;(lsh (- c0 32) -1)
+ ss (+ (logand c0 1) (logand c1 3)))
+ (if egg-zhuyin
+ (progn
+ (setq c0 (aref yincode-zhuyin-table (+ (* 41 s) y)))
+ (if (eq (logand c0 ?\x8080) ?\x80)
+ (setq s (lsh c0 -8)
+ y (logand c0 ?\x7f)))
+ (if (and (eq s 20)
+ (eq (aref yincode-pinyin-table (+ (* 39 s) y)) 0))
+ (setq s 0))
+ (insert (car (nth s yincode-zhuyin-shengmu))
+ (car (nth (+ (* 5 y) ss) yincode-zhuyin-yunmu))))
+ (if (and (eq s 20)
+ (eq (aref yincode-pinyin-table (+ (* 39 s) y)) 0))
+ (setq s 0))
+ (insert (car (nth s yincode-pinyin-shengmu))
+ (car (nth (+ (* 5 y) ss) yincode-pinyin-yunmu)))))))
+ (- (point-max) (point-min))))
+ (if (looking-at "\0\0") (forward-char 2))))
+
+(defun post-read-decode-fixed-euc-china (len type)
+ (let ((pos (point))
+ (buffer-modified-p (buffer-modified-p)))
+ (prog1
+ (decode-fixed-euc-china-region pos (+ pos len) type)
+ (set-buffer-modified-p buffer-modified-p))))
+
+(defun post-read-decode-euc-cn (len)
+ (post-read-decode-fixed-euc-china len 'cn))
+
+(defun post-read-decode-euc-tw (len)
+ (post-read-decode-fixed-euc-china len 'tw))
+
+(make-coding-system 'fixed-euc-cn 5 ?W "Coding System for fixed EUC Chinese-gb2312")
+(put 'fixed-euc-cn 'pre-write-conversion 'pre-write-encode-euc-cn)
+(put 'fixed-euc-cn 'post-read-conversion 'post-read-decode-euc-cn)
+
+(make-coding-system 'fixed-euc-tw 5 ?W "Coding System for fixed EUC Chinese-cns11643")
+(put 'fixed-euc-tw 'pre-write-conversion 'pre-write-encode-euc-tw)
+(put 'fixed-euc-tw 'post-read-conversion 'post-read-decode-euc-tw)
+
+;;; euc-china.el ends here.