(narrow-to-region start end)
(goto-char start)
(insert egg-conversion-open)
- (put-text-property start (point) 'egg-start t)
+ (add-text-properties start (point)
+ (list
+ 'egg-start t
+ 'egg-source (buffer-substring (point)
+ (point-max))))
(if egg-conversion-face
(put-text-property start (point) 'invisible t))
(setq start (point))
(define-key map [?\C-\ ] 'egg-decide-first-char)
(define-key map "\C-a" 'egg-beginning-of-conversion-buffer)
(define-key map "\C-b" 'egg-backward-bunsetsu)
+ (define-key map "\C-c" 'egg-abort-conversion)
(define-key map "\C-e" 'egg-end-of-conversion-buffer)
(define-key map "\C-f" 'egg-forward-bunsetsu)
(define-key map "\C-h" 'egg-help-command)
(signal 'end-of-buffer nil))))
(defun egg-get-previous-bunsetsu (p)
- (if (get-text-property (1- p) 'egg-start)
- nil
- (egg-get-bunsetsu-info (- p 2))))
+ (and (null (get-text-property (1- p) 'egg-start))
+ (null (get-text-property (1- p) 'egg-bunsetsu-last))
+ (egg-get-bunsetsu-info (- p 2))))
(defun egg-separate-characters (str)
(let* ((v (string-to-vector str))
(interactive "p")
(egg-next-candidate (- n)))
+;; Bogus function 980220
(defun egg-decide-bunsetsu (&optional end-marker)
(let ((in-loop t)
p bunsetsu-info-list bl)
(defun egg-decide-before-point ()
(interactive)
- (let ((m (make-marker))
- all start bunsetsu-list)
- (if (get-text-property (1- (point)) 'egg-start)
- (signal 'beginning-of-buffer nil)
- (setq start (1- (previous-single-property-change (point) 'egg-start))))
- (set-marker m (point))
- (goto-char start)
- ;; Delete open marker
- (delete-region start (1+ start))
- (setq bunsetsu-list (egg-decide-bunsetsu m))
- ;; delete separator
- (delete-region (1- (point)) (point))
- ;; insert open marker
- (insert egg-conversion-open)
- (put-text-property m (point) 'egg-start t)
- (if egg-conversion-face
- (put-text-property p (point) 'invisible t))
- (egg-end-conversion bunsetsu-list)
- (set-marker m nil)))
+ (let (bunsetsu-list bl (p (point)) source (dlen 0) l s)
+ (save-restriction
+ (if (null (get-text-property (1- (point)) 'egg-start))
+ (goto-char (previous-single-property-change (point) 'egg-start)))
+ (narrow-to-region (1- (point)) p)
+ (setq source (get-text-property (1- (point)) 'egg-source))
+ (setq bunsetsu-list (setq bl (list nil)))
+ (while (< (point) (point-max))
+ ;; delete sparator/open marker
+ (delete-region (1- (point)) (point))
+ (setq bl (setcdr bl (list (egg-get-bunsetsu-info (point)))))
+ (setq dlen (+ dlen (length (egg-get-bunsetsu-source (car bl)))))
+ (if (get-text-property (point) 'egg-bunsetsu-last)
+ (progn
+ (egg-end-conversion (cdr bunsetsu-list))
+ (setq bunsetsu-list (setq bl (list nil)))))
+ (setq p (point))
+ (forward-char)
+ (remove-text-properties p (point) '(face nil
+ intangible nil
+ local-map nil
+ egg-bunsetsu-last nil))))
+ (if (get-text-property (point) 'egg-end)
+ (progn
+ ;; delete close marker
+ (delete-region (point) (1+ (point)))
+ (egg-do-auto-fill)
+ (run-hooks 'input-method-after-insert-chunk-hook))
+ ;; delete last from speparater to close marker
+ (delete-region (1- (point))
+ (1+ (next-single-property-change (point) 'egg-end)))
+ ;; rebuild fence mode string
+ (setq p 0)
+ (while (< p dlen)
+ (setq s (car (get-text-property p 'its-syl source))
+ l (length s)
+ p (+ p l))
+ (if (> p dlen)
+ (put-text-property dlen p
+ 'its-syl (list (substring s (- dlen p)))
+ source)))
+ (its-restart (substring source dlen)))))
(defun egg-exit-conversion ()
(interactive)
- (let (start bunsetsu-list)
- (if (get-text-property (1- (point)) 'egg-start)
- (setq start (1- (point)))
- (setq start (1- (previous-single-property-change (point) 'egg-start))))
- (goto-char start)
- ;; Delete open marker
- (delete-region start (1+ start))
- (setq bunsetsu-list (egg-decide-bunsetsu))
- ;; Delete close marker
- (delete-region (point) (1+ (point)))
- (egg-do-auto-fill)
- (egg-end-conversion bunsetsu-list)
- (run-hooks 'input-method-after-insert-chunk-hook)))
+ (goto-char (next-single-property-change (point) 'egg-end))
+ (egg-decide-before-point))
+
+(defun egg-abort-conversion ()
+ (interactive)
+ (if (null (get-text-property (1- (point)) 'egg-start))
+ (goto-char (previous-single-property-change (point) 'egg-start)))
+ (egg-decide-before-point))
(defun egg-select-candidate ()
(interactive)
(make-coding-system 'fixed-euc-jp 4 ?W "Coding System for fixed EUC Japanese"
(cons ccl-decode-fixed-euc-jp ccl-encode-fixed-euc))
+;; Korean
+
(eval-and-compile
(define-ccl-program ccl-decode-fixed-euc-kr
`(2
(make-coding-system 'fixed-euc-kr 4 ?W "Coding System for fixed EUC Korean"
(cons ccl-decode-fixed-euc-kr ccl-encode-fixed-euc-kr))
+
+;; Chinese
+(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
+ '(("\9a À" 0 0) ("\9a À" 0 1) ("\9a À" 0 3) ("\9a À" 0 5) ("\9a À" 0 7)
+ ("a\9a À" 1 0) ("\9a ¡\9a À" 1 1) ("\9a ¢\9a À" 1 3) ("\9a £\9a À" 1 5) ("\9a ¤\9a À" 1 7)
+ ("ai\9a À" 2 0) ("\9a ¡i\9a À" 2 1) ("\9a ¢i\9a À" 2 3) ("\9a £i\9a À" 2 5) ("\9a ¤i\9a À" 2 7)
+ ("an\9a À" 3 0) ("\9a ¡n\9a À" 3 1) ("\9a ¢n\9a À" 3 3) ("\9a £n\9a À" 3 5) ("\9a ¤n\9a À" 3 7)
+ ("ang\9a À" 4 0) ("\9a ¡ng\9a À" 4 1) ("\9a ¢ng\9a À" 4 3) ("\9a £ng\9a À" 4 5) ("\9a ¤ng\9a À" 4 7)
+ ("ao\9a À" 5 0) ("\9a ¡o\9a À" 5 1) ("\9a ¢o\9a À" 5 3) ("\9a £o\9a À" 5 5) ("\9a ¤o\9a À" 5 7)
+ ("e\9a À" 6 0) ("\9a ¥\9a À" 6 1) ("\9a ¦\9a À" 6 3) ("\9a §\9a À" 6 5) ("\9a ¨\9a À" 6 7)
+ ("ei\9a À" 7 0) ("\9a ¥i\9a À" 7 1) ("\9a ¦i\9a À" 7 3) ("\9a §i\9a À" 7 5) ("\9a ¨i\9a À" 7 7)
+ ("en\9a À" 8 0) ("\9a ¥n\9a À" 8 1) ("\9a ¦n\9a À" 8 3) ("\9a §n\9a À" 8 5) ("\9a ¨n\9a À" 8 7)
+ ("eng\9a À" 9 0) ("\9a ¥ng\9a À" 9 1) ("\9a ¦ng\9a À" 9 3) ("\9a §ng\9a À" 9 5) ("\9a ¨ng\9a À" 9 7)
+ ("er\9a À" 10 0) ("\9a ¥r\9a À" 10 1) ("\9a ¦r\9a À" 10 3) ("\9a §r\9a À" 10 5) ("\9a ¨r\9a À" 10 7)
+ ("i\9a À" 11 0) ("\9a ©\9a À" 11 1) ("\9a ª\9a À" 11 3) ("\9a «\9a À" 11 5) ("\9a ¬\9a À" 11 7)
+ ("ia\9a À" 12 0) ("i\9a ¡\9a À" 12 1) ("i\9a ¢\9a À" 12 3) ("i\9a £\9a À" 12 5) ("i\9a ¤\9a À" 12 7)
+ ("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)
+ ("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)
+ ("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)
+ ("ie\9a À" 16 0) ("i\9a ¥\9a À" 16 1) ("i\9a ¦\9a À" 16 3) ("i\9a §\9a À" 16 5) ("i\9a ¨\9a À" 16 7)
+ ("in\9a À" 17 0) ("\9a ©n\9a À" 17 1) ("\9a ªn\9a À" 17 3) ("\9a «n\9a À" 17 5) ("\9a ¬n\9a À" 17 7)
+ ("ing\9a À" 18 0) ("\9a ©ng\9a À" 18 1) ("\9a ªng\9a À" 18 3) ("\9a «ng\9a À" 18 5) ("\9a ¬ng\9a À" 18 7)
+ ("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)
+ ("iu\9a À" 20 0) ("i\9a ±\9a À" 20 1) ("i\9a ²\9a À" 20 3) ("i\9a ³\9a À" 20 5) ("i\9a ´\9a À" 20 7)
+ ("m\9a À" 21 0) ("m\9a À" 21 1) ("m\9a À" 21 3) ("m\9a À" 21 5) ("m\9a À" 21 7)
+ ("n\9a À" 22 0) ("n\9a À" 22 1) ("\9a ½\9a À" 22 3) ("\9a ¾\9a À" 22 5) ("\9a ¿\9a À" 22 7)
+ ("ng\9a À" 23 0) ("ng\9a À" 23 1) ("ng\9a À" 23 3) ("ng\9a À" 23 5) ("ng\9a À" 23 7)
+ ("o\9a À" 24 0) ("\9a \9a À" 24 1) ("\9a ®\9a À" 24 3) ("\9a ¯\9a À" 24 5) ("\9a °\9a À" 24 7)
+ ("ong\9a À" 25 0) ("\9a ng\9a À" 25 1) ("\9a ®ng\9a À" 25 3) ("\9a ¯ng\9a À" 25 5) ("\9a °ng\9a À" 25 7)
+ ("ou\9a À" 26 0) ("\9a u\9a À" 26 1) ("\9a ®u\9a À" 26 3) ("\9a ¯u\9a À" 26 5) ("\9a °u\9a À" 26 7)
+ ("u\9a À" 27 0) ("\9a ±\9a À" 27 1) ("\9a ²\9a À" 27 3) ("\9a ³\9a À" 27 5) ("\9a ´\9a À" 27 7)
+ ("ua\9a À" 28 0) ("u\9a ¡\9a À" 28 1) ("u\9a ¢\9a À" 28 3) ("u\9a £\9a À" 28 5) ("u\9a ¤\9a À" 28 7)
+ ("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)
+ ("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)
+ ("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)
+ ("ue\9a À" 32 0) ("u\9a ¥\9a À" 32 1) ("u\9a ¦\9a À" 32 3) ("u\9a §\9a À" 32 5) ("u\9a ¨\9a À" 32 7)
+ ("ui\9a À" 33 0) ("u\9a ©\9a À" 33 1) ("u\9a ª\9a À" 33 3) ("u\9a «\9a À" 33 5) ("u\9a ¬\9a À" 33 7)
+ ("un\9a À" 34 0) ("\9a ±n\9a À" 34 1) ("\9a ²n\9a À" 34 3) ("\9a ³n\9a À" 34 5) ("\9a ´n\9a À" 34 7)
+ ("uo\9a À" 35 0) ("u\9a \9a À" 35 1) ("u\9a ®\9a À" 35 3) ("u\9a ¯\9a À" 35 5) ("u\9a °\9a À" 35 7)
+ ("\9a ¹\9a À" 36 0) ("\9a µ\9a À" 36 1) ("\9a ¶\9a À" 36 3) ("\9a ·\9a À" 36 5) ("\9a ¸\9a À" 36 7)
+ ("\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)
+ ("0\9a À" 38 0) ("1\9a À" 38 1) ("2\9a À" 38 3) ("3\9a À" 38 5) ("4\9a À" 38 7)))
+
+(defconst yincode-pinyin-table
+ [
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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) ("\9a Å" . 1) ("\9a Ø" . 2) ("\9a Ô" . 3) ("\9a É" . 4)
+ ("\9a È" . 5) ("\9a Í" . 6) ("\9a Ï" . 7) ("\9a Ð" . 8) ("\9a Î" . 9)
+ ("\9a Ì" . 10) ("\9a Ç" . 11) ("\9a Ë" . 12) ("\9a Æ" . 13) ("\9a Ñ" . 14)
+ ("\9a Ö" . 15) ("\9a Ù" . 16) ("\9a Õ" . 17) ("\9a Ê" . 18) ("\9a è" . 19)
+ ("\9a Ò" . 20) ("\9a ç" . 21) ("\9a ×" . 22) ("\9a Ó" . 23)))
+
+(defconst yincode-zhuyin-yunmu
+ '(("\9a À" 0 0) ("\9a Á" 0 1) ("\9a Â" 0 3) ("\9a Ã" 0 5) ("\9a Ä" 0 7) ; i
+ ("\9a Ú\9a À" 1 0) ("\9a Ú\9a Á" 1 1) ("\9a Ú\9a Â" 1 3) ("\9a Ú\9a Ã" 1 5) ("\9a Ú\9a Ä" 1 7) ; a
+ ("\9a Þ\9a À" 2 0) ("\9a Þ\9a Á" 2 1) ("\9a Þ\9a Â" 2 3) ("\9a Þ\9a Ã" 2 5) ("\9a Þ\9a Ä" 2 7) ; ai
+ ("\9a â\9a À" 3 0) ("\9a â\9a Á" 3 1) ("\9a â\9a Â" 3 3) ("\9a â\9a Ã" 3 5) ("\9a â\9a Ä" 3 7) ; an
+ ("\9a ä\9a À" 4 0) ("\9a ä\9a Á" 4 1) ("\9a ä\9a Â" 4 3) ("\9a ä\9a Ã" 4 5) ("\9a ä\9a Ä" 4 7) ; ang
+ ("\9a à\9a À" 5 0) ("\9a à\9a Á" 5 1) ("\9a à\9a Â" 5 3) ("\9a à\9a Ã" 5 5) ("\9a à\9a Ä" 5 7) ; ao
+ ("\9a Ü\9a À" 6 0) ("\9a Ü\9a Á" 6 1) ("\9a Ü\9a Â" 6 3) ("\9a Ü\9a Ã" 6 5) ("\9a Ü\9a Ä" 6 7) ; e
+ ("\9a ß\9a À" 7 0) ("\9a ß\9a Á" 7 1) ("\9a ß\9a Â" 7 3) ("\9a ß\9a Ã" 7 5) ("\9a ß\9a Ä" 7 7) ; ei
+ ("\9a ã\9a À" 8 0) ("\9a ã\9a Á" 8 1) ("\9a ã\9a Â" 8 3) ("\9a ã\9a Ã" 8 5) ("\9a ã\9a Ä" 8 7) ; en
+ ("\9a å\9a À" 9 0) ("\9a å\9a Á" 9 1) ("\9a å\9a Â" 9 3) ("\9a å\9a Ã" 9 5) ("\9a å\9a Ä" 9 7) ; eng
+ ("\9a æ\9a À" 10 0) ("\9a æ\9a Á" 10 1) ("\9a æ\9a Â" 10 3) ("\9a æ\9a Ã" 10 5) ("\9a æ\9a Ä" 10 7) ; er
+ ("\9a ç\9a À" 11 0) ("\9a ç\9a Á" 11 1) ("\9a ç\9a Â" 11 3) ("\9a ç\9a Ã" 11 5) ("\9a ç\9a Ä" 11 7) ; i
+ ("\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
+ ("\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
+ ("\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
+ ("\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
+ ("\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
+ ("\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
+ ("\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
+ ("\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
+ ("\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
+ ("\9a Ç\9a À" 21 0) ("\9a Ç\9a Á" 21 1) ("\9a Ç\9a Â" 21 3) ("\9a Ç\9a Ã" 21 5) ("\9a Ç\9a Ä" 21 7) ; m
+ ("\9a Ë\9a À" 22 0) ("\9a Ë\9a Á" 22 1) ("\9a Ë\9a Â" 22 3) ("\9a Ë\9a Ã" 22 5) ("\9a Ë\9a Ä" 22 7) ; n
+ ("@\9a À" 23 0) ("@\9a Á" 23 1) ("@\9a Â" 23 3) ("@\9a Ã" 23 5) ("@\9a Ä" 23 7) ; ng
+ ("\9a Û\9a À" 24 0) ("\9a Û\9a Á" 24 1) ("\9a Û\9a Â" 24 3) ("\9a Û\9a Ã" 24 5) ("\9a Û\9a Ä" 24 7) ; o
+ ("\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
+ ("\9a á\9a À" 26 0) ("\9a á\9a Á" 26 1) ("\9a á\9a Â" 26 3) ("\9a á\9a Ã" 26 5) ("\9a á\9a Ä" 26 7) ; ou
+ ("\9a è\9a À" 27 0) ("\9a è\9a Á" 27 1) ("\9a è\9a Â" 27 3) ("\9a è\9a Ã" 27 5) ("\9a è\9a Ä" 27 7) ; u
+ ("\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
+ ("\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
+ ("\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
+ ("\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
+ ("\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
+ ("\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
+ ("\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
+ ("\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
+ ("\9a é\9a À" 36 0) ("\9a é\9a Á" 36 1) ("\9a é\9a Â" 36 3) ("\9a é\9a Ã" 36 5) ("\9a é\9a Ä" 36 7) ; \9a ¹
+ ("\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
+ ("0\9a À" 38 0) ("1\9a Á" 38 1) ("2\9a Â" 38 3) ("3\9a Ã" 38 5) ("4\9a Ä" 38 7) ; undefined
+ ("\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
+ ("\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
+ ))
+
+(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\9a ¡-\9a ¿]+\9a À" 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 "^[\9a Å-\9a é@0-4]+[\9a À\9a Á\9a Â\9a Ã\9a Ä]" 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\9a ¡ng\9a À") (length "\9a Ó\9a è\9a ä\9a Á"))))
+ (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)
\f
(defsubst comm-format-u32c (uint32c)
(let ((h0 (car uint32c))