+1998-07-03 KATAYAMA Yoshio <kate@pfu.co.jp>
+
+ * its/erpin.el, its/hangul.el, its/hankata.el, its/hira.el,
+ its/jeonkak.el, its/kata.el, its/pinyin.el, its/quanjiao.el,
+ its/thai.el, its/zenkaku.el: Updated using new its-*.
+
+ * its.el (define-its-state-machine): Rewritten.
+ (define-its-compiled-map): Deleted.
+ (define-its-state-machine-append): Rewritten.
+ (its-defrule): Rewritten.
+ (its-defrule*): Rewritten.
+ (its-parent-states): New Variable.
+ (its-goto-state): Remove 2nd optional argument INITIAL-STATE.
+ (its-set-interim-terminal-state): New Function.
+ (its-make-next-state): Remove 2nd argument KEYSEQ.
+
+1998-07-01 NIIBE Yutaka <gniibe@mri.co.jp>
+
+ * egg-mlh.el (mlh-hira-to-kata): Removed. Doesn't work any more.
+ (mlh-katakana): Use japanese-katakana-region.
+
+ * egg-cnv.el (egg-conversion-map): Add again mapping for "/".
+
1998-06-27 KATAYAMA Yoshio <kate@pfu.co.jp>
* egg-cnv.el (egg-abort-conversion): Bug fix.
-pn;;; egg-cnv.el --- Conversion Backend in Egg Input Method Architecture
+;;; egg-cnv.el --- Conversion Backend in Egg Input Method Architecture
;; Copyright (C) 1997, 1998 Mule Project,
;; Powered by Electrotechnical Laboratory, JAPAN.
(let ((inhibit-read-only t))
(its-define-select-keys egg-conversion-map)
(goto-char start)
- ;; XXX: Why make OPEN&CLOSE string every time when
- ;; this function is invoked? Any Reason?
- ;; For me it's matter of user costomization
- ;; of setting egg-conversion-open/egg-conversion-close
- ;; it can be string of properties at the beginning, isn't it?
(setq s (copy-sequence egg-conversion-open)
len (length s))
(set-text-properties 0 len
(define-key map [right] 'egg-forward-bunsetsu)
(define-key map [left] 'egg-backward-bunsetsu)
(define-key map " " 'egg-next-candidate)
+ (define-key map "/" 'egg-exit-conversion)
map)
"Keymap for EGG Conversion mode.")
(goto-char end-marker)
(forward-char -2)
(its-translate-region-internal beg (point))
- (insert (mlh-hira-to-kata
- (prog1
- (buffer-substring beg (point))
- (delete-region beg (point)))))
+ (japanese-katakana-region beg (point))
(delete-region (point) end-marker)
(if (null henkan-begin)
(setq henkan-begin beg)))
(if (null henkan-begin)
(setq henkan-begin beg)))
-(defun mlh-hira-to-kata (str)
- "Convert hiragana to katakana in STR."
- (let ((result (copy-sequence str))
- (i 0))
- (while (setq i (string-match "[\e$B$!\e(B-\e$B$s\e(B]" str i))
- (aset result (1+ i) ?\245)
- (setq i (+ i 3)))
- result))
-
(defun mlh-hangul ()
(forward-char -1)
(skip-chars-backward "a-zEO-RTW,.[]")
map))
(defmacro define-its-state-machine (map name indicator lang doc &rest exprs)
- `(progn
- (eval-when (eval compile)
- (let ((its-current-map 'its-temporaly-map)
- (its-temporaly-map (its-new-map ,name ,indicator ,lang)))
- ,@exprs
- (setq ,map its-temporaly-map)))
- (define-its-compiled-map ,map ,doc)))
-
-(defmacro define-its-compiled-map (map doc)
+ (let ((its-current-map map))
+ (set map (its-new-map name indicator
+ (if (eq (car-safe lang) 'quote) (nth 1 lang) lang)))
+ (eval (cons 'progn exprs)))
`(defconst ,map ',(symbol-value map) ,doc))
(defmacro define-its-state-machine-append (map &rest exprs)
- (append
- `(let ((its-current-map 'its-temporaly-map)
- (its-temporaly-map ,map)))
- exprs
- (list `(setq ,map its-temporaly-map))))
+ `(let ((its-current-map ',map))
+ ,@exprs))
;;
;; Construct State Machine
\e$BLa$C$FF0$/$b$N$H$9$k!#JQ495,B'$O$b$C$H$b:G6a$K\e(B its-define-state-machine
\e$B$5$l$?JQ49I=$KEPO?$5$l$k!#\e(B
Return last state."
- (let ((state (its-goto-state (substring input 0 -1) nil t))
- (key (aref input (1- (length input)))))
- (if (and (its-get-next-state state key) (not enable-overwrite))
- (error "Duplicated definition (%s)" input)
- (its-make-next-state state key input output back))))
+ (let ((state (its-goto-state input (if enable-overwrite t 'dup-check))))
+ (its-set-output state output)
+ (its-set-kst state back)
+ state))
+
+(defun its-defrule* (input output &optional enable-overwrite)
+ (let* ((state (its-goto-state input (if enable-overwrite t 'dup-check))))
+ (its-set-kst state nil)
+ (its-set-interim-terminal-state state output)
+ state))
+
+(defvar its-parent-states)
-(defun its-goto-state (input &optional initial-state build-if-none)
+(defun its-goto-state (input &optional build-if-none)
(let ((len (length input))
(i 0)
- (state (or initial-state
- (its-get-start-state (symbol-value its-current-map)))))
+ (state (its-get-start-state (symbol-value its-current-map)))
+ brand-new next-state key)
+ (setq its-parent-states nil)
(while (< i len)
- (setq state
- (or (its-get-next-state state (aref input i))
- (if build-if-none
- (let ((keyseq (substring input 0 (1+ i))))
- (its-make-next-state state (aref input i) keyseq keyseq))
- (error "No such state (%s)" input)))
- i (1+ i)))
+ (setq its-parent-states (cons state its-parent-states)
+ key (aref input i)
+ i (1+ i)
+ next-state (its-get-next-state state key))
+ (cond
+ (next-state
+ (setq state next-state))
+ ((null build-if-none)
+ (error "No such state (%s)" input))
+ (t
+ (if (not (or brand-new (= i 1) (its-get-kst/t state)))
+ (its-set-interim-terminal-state state))
+ (setq state (its-make-next-state state key
+ (concat (its-get-output state)
+ (list key)))
+ brand-new t))))
+ (if (and (eq build-if-none 'dup-check) (null brand-new))
+ (error "Duplicated definition (%s)" input))
state))
+(defun its-set-interim-terminal-state (state &optional output)
+ (or output (setq output (its-get-output state)))
+ (its-make-next-state state -1 output)
+ (its-defrule-otherwise state output))
+
(defun its-defoutput (input display)
(let ((state (its-goto-state input)))
(its-set-output state display)))
(its-define-otherwise state
(its-make-otherwise output class+back))))
-(defun its-defrule* (input output)
- (let ((state (its-defrule input output)))
- (its-defrule-otherwise state output)))
-
-(defun its-make-next-state (state key keyseq output &optional back)
- (let ((next-state (its-new-state output keyseq back))
+(defun its-make-next-state (state key output &optional back)
+ (let ((next-state (its-new-state output
+ (concat (its-get-keyseq state)
+ (if (> key 0) (list key)))
+ back))
(kst (its-get-kst/t state)))
(cond
((null kst)
(defvar its-erpin-tw-close-braket "\e$(G!W\e(B" "*]") ; "\e$(G!c\e(B"
(eval-when-compile
- (defsubst its-defoutput* (input display)
- (its-set-output (its-goto-state input nil t) display))
-
(defun its-define-erpin-qingsheng (shengmu yunmu &optional y)
(let ((input (concat (car shengmu) yunmu))
- (output (concat (cdr shengmu) (if y y yunmu) "\e(0@\e(B"))
- state)
- (setq state (its-goto-state input nil t))
- (its-set-output state output)
- (its-make-next-state state -1 input output)
- (its-make-next-state state ? (concat input " ") output)
- (its-make-next-state state ?0 (concat input "0") output)
- (its-define-otherwise state (its-make-otherwise output
- its-otherwise-back-one))
- state))
+ (output (concat (cdr shengmu) (if y y yunmu) "\e(0@\e(B")))
+ (prog1
+ (its-defrule input output)
+ (its-defrule (concat input " ") output)
+ (its-defrule (concat input "0") output))))
(defmacro its-do-erpin-table (list)
`(progn
(while ss
(setq sa (caar ss) sd (cdar ss)
state (its-define-erpin-qingsheng (car ss) y y5))
- (its-make-next-state state ?1 (concat sa y 1) (concat sd y1 "\e(0@\e(B"))
- (its-make-next-state state ?2 (concat sa y 2) (concat sd y2 "\e(0@\e(B"))
- (its-make-next-state state ?3 (concat sa y 3) (concat sd y3 "\e(0@\e(B"))
- (its-make-next-state state ?4 (concat sa y 4) (concat sd y4 "\e(0@\e(B"))
+ (its-make-next-state state ?1 (concat sd y1 "\e(0@\e(B"))
+ (its-make-next-state state ?2 (concat sd y2 "\e(0@\e(B"))
+ (its-make-next-state state ?3 (concat sd y3 "\e(0@\e(B"))
+ (its-make-next-state state ?4 (concat sd y4 "\e(0@\e(B"))
(setq ss (cdr ss)))))
(defmacro its-define-erpin-table ()
(un '("z" "\e(01\e(Bn" "\e(02\e(Bn" "\e(03\e(Bn" "\e(04\e(Bn" "un" ))
(uo '("o" "u\e(0-\e(B" "u\e(0.\e(B" "u\e(0/\e(B" "u\e(00\e(B" "uo" )))
- (dolist (SHENG (list B C D F G H J K L M N P Q R S T W X Y Z I U V))
- (its-defrule (car SHENG) (cdr SHENG)))
-
(its-do-erpin-table
(((O B C D F G H K L M N P S T W Y Z I U V) . a)
((O B C D G H K L M N P S T W Z I U V) . ai)
((J Q X) . (cons "t" (cdr ing )))
((J Q X) . (cons "q" (cdr iu )))))
+ (dolist (SHENG (list B C D F G H J K L M N P Q R S T W X Y Z I U V))
+ (its-defoutput (car SHENG) (cdr SHENG)))
+
(its-define-erpin-qingsheng H "m")
(its-define-erpin-qingsheng H "n" "ng")
(its-define-erpin-qingsheng O "m")
(its-defrule "on4" "\e(0?@\e(B"))))
(define-its-state-machine its-erpin-cn-map
- "erpin-cn" "\e$A6~\e(BG" 'Chinese-GB
+ "erpin-cn" "\e$A6~\e(BG" Chinese-GB
"Map for Erpin input. (Chinese-GB)"
(defconst its-quanjiao-escape "Z")
(its-defrule-select-mode-temporally "Q" quanjiao-downcase-cn)
(its-define-erpin-table)
- (its-defoutput* "b " "\e$A2;\e(B")
- (its-defoutput* "c " "\e$A2E\e(B")
- (its-defoutput* "ch " "\e$A3v\e(B")
- (its-defoutput* "d " "\e$A5D\e(B")
- (its-defoutput* "f " "\e$A74\e(B")
- (its-defoutput* "g " "\e$A8v\e(B")
- (its-defoutput* "h " "\e$A:M\e(B")
- (its-defoutput* "i " "\e$AR;\e(B")
- (its-defoutput* "j " "\e$A>M\e(B")
- (its-defoutput* "k " "\e$A?I\e(B")
- (its-defoutput* "l " "\e$AAK\e(B")
- (its-defoutput* "m " "\e$AC?\e(B")
- (its-defoutput* "n " "\e$ADj\e(B")
- (its-defoutput* "p " "\e$AEz\e(B")
- (its-defoutput* "q " "\e$AH%\e(B")
- (its-defoutput* "r " "\e$AHU\e(B")
- (its-defoutput* "s " "\e$AJG\e(B")
- (its-defoutput* "u " "\e$AIO\e(B")
- (its-defoutput* "t " "\e$AK{\e(B")
- (its-defoutput* "w " "\e$ANR\e(B")
- (its-defoutput* "x " "\e$AOr\e(B")
- (its-defoutput* "y " "\e$ASV\e(B")
- (its-defoutput* "z " "\e$ATZ\e(B")
- (its-defoutput* "v " "\e$AWE\e(B")
+ (its-defrule "b " "\e$A2;\e(B")
+ (its-defrule "c " "\e$A2E\e(B")
+ (its-defrule "ch " "\e$A3v\e(B")
+ (its-defrule "d " "\e$A5D\e(B")
+ (its-defrule "f " "\e$A74\e(B")
+ (its-defrule "g " "\e$A8v\e(B")
+ (its-defrule "h " "\e$A:M\e(B")
+ (its-defrule "i " "\e$AR;\e(B")
+ (its-defrule "j " "\e$A>M\e(B")
+ (its-defrule "k " "\e$A?I\e(B")
+ (its-defrule "l " "\e$AAK\e(B")
+ (its-defrule "m " "\e$AC?\e(B")
+ (its-defrule "n " "\e$ADj\e(B")
+ (its-defrule "p " "\e$AEz\e(B")
+ (its-defrule "q " "\e$AH%\e(B")
+ (its-defrule "r " "\e$AHU\e(B")
+ (its-defrule "s " "\e$AJG\e(B")
+ (its-defrule "u " "\e$AIO\e(B")
+ (its-defrule "t " "\e$AK{\e(B")
+ (its-defrule "w " "\e$ANR\e(B")
+ (its-defrule "x " "\e$AOr\e(B")
+ (its-defrule "y " "\e$ASV\e(B")
+ (its-defrule "z " "\e$ATZ\e(B")
+ (its-defrule "v " "\e$AWE\e(B")
(dolist (ascii '(("0" . "\e$A#0\e(B") ("1" . "\e$A#1\e(B") ("2" . "\e$A#2\e(B") ("3" . "\e$A#3\e(B")
("4" . "\e$A#4\e(B") ("5" . "\e$A#5\e(B") ("6" . "\e$A#6\e(B") ("7" . "\e$A#7\e(B")
(its-defrule "!" "\e$A#!\e(B"))
(define-its-state-machine its-erpin-tw-map
- "erpin-tw" "\e$(GD(\e(BC" 'Chinese-CNS
+ "erpin-tw" "\e$(GD(\e(BC" Chinese-CNS
"Map for Erpin input."
(defconst its-quanjiao-escape "Z")
(its-defrule-select-mode-temporally "Q" quanjiao-downcase-cn)
(its-define-erpin-table)
- (its-defoutput* "b " "\e$(GDb\e(B")
- (its-defoutput* "c " "\e$(GD_\e(B")
- (its-defoutput* "ch " "\e$(GEx\e(B")
- (its-defoutput* "d " "\e$(GN{\e(B")
- (its-defoutput* "f " "\e$(GE0\e(B")
- (its-defoutput* "g " "\e$(GT6\e(B")
- (its-defoutput* "h " "\e$(GLO\e(B")
- (its-defoutput* "i " "\e$(GD!\e(B")
- (its-defoutput* "j " "\e$(G^s\e(B")
- (its-defoutput* "k " "\e$(GF+\e(B")
- (its-defoutput* "l " "\e$(GD'\e(B")
- (its-defoutput* "m " "\e$(GJd\e(B")
- (its-defoutput* "n " "\e$(GH!\e(B")
- (its-defoutput* "p " "\e$(GJG\e(B")
- (its-defoutput* "q " "\e$(GF*\e(B")
- (its-defoutput* "r " "\e$(GEJ\e(B")
- (its-defoutput* "s " "\e$(GQR\e(B")
- (its-defoutput* "u " "\e$(GD8\e(B")
- (its-defoutput* "t " "\e$(GEl\e(B")
- (its-defoutput* "w " "\e$(GJ<\e(B")
- (its-defoutput* "x " "\e$(GGW\e(B")
- (its-defoutput* "y " "\e$(GD4\e(B")
- (its-defoutput* "z " "\e$(GGc\e(B")
- (its-defoutput* "v " "\e$(Gaa\e(B")
+ (its-defrule "b " "\e$(GDb\e(B")
+ (its-defrule "c " "\e$(GD_\e(B")
+ (its-defrule "ch " "\e$(GEx\e(B")
+ (its-defrule "d " "\e$(GN{\e(B")
+ (its-defrule "f " "\e$(GE0\e(B")
+ (its-defrule "g " "\e$(GT6\e(B")
+ (its-defrule "h " "\e$(GLO\e(B")
+ (its-defrule "i " "\e$(GD!\e(B")
+ (its-defrule "j " "\e$(G^s\e(B")
+ (its-defrule "k " "\e$(GF+\e(B")
+ (its-defrule "l " "\e$(GD'\e(B")
+ (its-defrule "m " "\e$(GJd\e(B")
+ (its-defrule "n " "\e$(GH!\e(B")
+ (its-defrule "p " "\e$(GJG\e(B")
+ (its-defrule "q " "\e$(GF*\e(B")
+ (its-defrule "r " "\e$(GEJ\e(B")
+ (its-defrule "s " "\e$(GQR\e(B")
+ (its-defrule "u " "\e$(GD8\e(B")
+ (its-defrule "t " "\e$(GEl\e(B")
+ (its-defrule "w " "\e$(GJ<\e(B")
+ (its-defrule "x " "\e$(GGW\e(B")
+ (its-defrule "y " "\e$(GD4\e(B")
+ (its-defrule "z " "\e$(GGc\e(B")
+ (its-defrule "v " "\e$(Gaa\e(B")
(dolist (ascii '(("0" . "\e$(G$!\e(B") ("1" . "\e$(G$"\e(B") ("2" . "\e$(G$#\e(B") ("3" . "\e$(G$$\e(B")
("4" . "\e$(G$%\e(B") ("5" . "\e$(G$&\e(B") ("6" . "\e$(G$'\e(B") ("7" . "\e$(G$(\e(B")
(its-defrule "=" "\e$A#=\e(B") (its-defrule "`" "\e$A#`\e(B")
(its-defrule "\\" "\e$A#\\e(B") (its-defrule "|" "\e$A#|\e(B")
(its-defrule "_" "\e$A#_\e(B") (its-defrule "+" "\e$A#+\e(B")
- (its-defrule "{" "\e$(G!B\e(B") (its-defrule "}" "\e$(G!C\e(B")
+ (its-defrule "{" "\e$A#{\e(B") (its-defrule "}" "\e$A#}\e(B")
(its-defrule "\"" "\e$A#"\e(B") (its-defrule "'" "\e$A#'\e(B")
(its-defrule "<" "\e$A#<\e(B") (its-defrule ">" "\e$A#>\e(B"))
(progn
(its-defrule "=" "\e$(G"8\e(B") (its-defrule "`" "\e$(G!j\e(B")
(its-defrule "\\" "\e$(G"b\e(B") (its-defrule "|" "\e$(G"^\e(B")
(its-defrule "_" "\e$(G"%\e(B") (its-defrule "+" "\e$(G"0\e(B")
- (its-defrule "{" "\e$A#{\e(B") (its-defrule "}" "\e$(G!a\e(B")
+ (its-defrule "{" "\e$(G!B\e(B") (its-defrule "}" "\e$(G!C\e(B")
(its-defrule "\"" "\e$(G!i\e(B") (its-defrule "'" "\e$(G!k\e(B")
(its-defrule "<" "\e$(G"6\e(B") (its-defrule ">" "\e$(G"7\e(B"))
(progn
(eval-when-compile
(require 'its)
- (require 'egg-edep)
(require 'cl))
(defvar its-hangul-enable-jeonkak-alphabet
(eval-when-compile
(defun its-define-hangul-key (key output)
- (let ((out (string-to-char output))
- (state (its-goto-state key nil t)))
- (setq its-hangul-key-alist (cons (cons out (string-to-char key))
- its-hangul-key-alist))
- (its-set-output state output)
- (its-make-next-state state -1 (its-get-keyseq state) output)
- (its-defrule-otherwise state output)))
+ (setq its-hangul-key-alist
+ (cons (cons (string-to-char output)
+ (string-to-char key))
+ its-hangul-key-alist))
+ (its-defrule key output))
(defun its-define-hangul-successor-list (keyseq)
(let ((pair (assq (aref keyseq 0) its-hangul-successor-list)))
(setcdr pair (its-hangul-make-successor (cdr pair) keyseq))))))
(defun its-defrule-hangul (input output)
- (let ((state (its-get-start-state (symbol-value its-current-map)))
- (len (length input)) (i 0)
- keyseq key prev-out out pair)
- (while (< i len)
- (setq key (aref input i)
- next-state (its-get-next-state state key)
- i (1+ i))
- (if next-state
- (setq prev-out out
- out (its-get-output next-state)
- state next-state)
- (setq keyseq (substring input 0 i)
- prev-out out
- out (if (= i len) output (concat out (list key)))
- state (its-make-next-state state key keyseq out))
- (its-make-next-state state -1 keyseq out)
- (its-defrule-otherwise state out)))
- (if (and (= (egg-chars-in-period prev-out 0 (length prev-out)) 1)
+ (let* ((state (its-defrule input output nil nil))
+ (prev-out (its-get-output (car its-parent-states)))
+ pair)
+ (if (and (= (length (string-to-list prev-out)) 1)
(> (string-to-char prev-out) ?\377)
- (setq pair (assq (aref keyseq (1- len))
+ (setq pair (assq (string-to-char (substring input -1))
its-hangul-successor-list)))
- (its-defrule-otherwise state prev-out (cdr pair) -2))))
+ (progn
+ (its-set-interim-terminal-state state)
+ (its-defrule-otherwise state prev-out (cdr pair) -2)))))
(defmacro its-define-hangul (&rest list)
(cons 'progn
list))))
(define-its-state-machine its-hangul-map
- "hangul" "\e$(CGQ\e(B" 'Korean
+ "hangul" "\e$(CGQ\e(B" Korean
"Map for Hangul input. (Korean)"
(defconst its-jeonkak-escape "Z")
(defvar its-han-kata-horizontal "\e(I0\e(B" "*-") ; "\e$B!]\e(B"
(define-its-state-machine its-han-kata-map
- "roma-han-kata" "\e(I11\e(B" "Japanese"
+ "roma-han-kata" "\e(I11\e(B" Japanese
"Map for Romaji-Hankaku-Katakana translation. (Japanese)"
(defconst its-hankaku-escape "~") ;; Escape character to Hankaku inputs
(dolist (q1 '("b" "m" "p"))
(its-defrule (concat "m" q1) "\e(I]\e(B" -1))
- (its-defrule "N" "\e(I]\e(B")
-
- (let ((state (its-goto-state "n" nil t)))
- (its-make-next-state state -1 "n" "\e(I]\e(B")
- (its-make-next-state state ?' "n" "\e(I]\e(B")
- (its-defrule-otherwise state "\e(I]\e(B"))
+ (its-defrule* "n" "\e(I]\e(B")
+ (its-defrule "n'" "\e(I]\e(B")
+ (its-defrule "N" "\e(I]\e(B")
(let ((small '"x" ))
(its-defrule (concat small "a") "\e(I'\e(B")
(define-its-state-machine-append its-han-kata-map
(if its-han-kata-enable-double-n
- (its-defrule "nn" "\e(I]\e(B")
- (its-defrule "nn" "\e(I]\e(B" -1))
+ (its-defrule "nn" "\e(I]\e(B"))
(its-defrule "-" its-han-kata-horizontal)
(its-defrule "[" its-han-kata-open-bracket)
(defvar its-hira-horizontal "\e$B!<\e(B" "*-") ; "\e$B!]\e(B"
(define-its-state-machine its-hira-map
- "roma-kana" "\e$B$"\e(B" 'Japanese
+ "roma-kana" "\e$B$"\e(B" Japanese
"Map for Romaji-Hiragana translation. (Japanese)"
(defconst its-zenkaku-escape "Z") ;; Escape character to Zenkaku inputs
(dolist (q1 '("b" "m" "p"))
(its-defrule (concat "m" q1) "\e$B$s\e(B" -1))
- (its-defrule "N" "\e$B$s\e(B")
-
- (let ((state (its-goto-state "n" nil t)))
- (its-make-next-state state -1 "n" "\e$B$s\e(B")
- (its-make-next-state state ?' "n" "\e$B$s\e(B")
- (its-defrule-otherwise state "\e$B$s\e(B"))
+ (its-defrule* "n" "\e$B$s\e(B")
+ (its-defrule "n'" "\e$B$s\e(B")
+ (its-defrule "N" "\e$B$s\e(B")
(let ((small '"x" ))
(its-defrule (concat small "a") "\e$B$!\e(B")
(define-its-state-machine-append its-hira-map
(if its-hira-enable-double-n
- (its-defrule "nn" "\e$B$s\e(B")
- (its-defrule "nn" "\e$B$s\e(B" -1))
+ (its-defrule "nn" "\e$B$s\e(B"))
(its-defrule "-" its-hira-horizontal)
(its-defrule "[" its-hira-open-bracket)
(require 'its))
(define-its-state-machine its-jeonkak-up-map
- "jeonkak-upcase" "\e$(C#A\e(B" 'Korean
+ "jeonkak-upcase" "\e$(C#A\e(B" Korean
"Map for jeonkak-upcase input."
(dolist (ascii '(("1" . "\e$(C#1\e(B") ("2" . "\e$(C#2\e(B") ("3" . "\e$(C#3\e(B") ("4" . "\e$(C#4\e(B")
(its-defrule in out))))
(define-its-state-machine its-jeonkak-down-map
- "jeonkak-downcase" "\e$(C#a\e(B" 'Korean
+ "jeonkak-downcase" "\e$(C#a\e(B" Korean
"Map for jeonkak-downcase input."
(dolist (ascii '(("1" . "\e$(C#1\e(B") ("2" . "\e$(C#2\e(B") ("3" . "\e$(C#3\e(B") ("4" . "\e$(C#4\e(B")
(defvar its-kata-horizontal "\e$B!<\e(B" "*-") ; "\e$B!]\e(B"
(define-its-state-machine its-kata-map
- "roma-kata" "\e$B%"\e(B" 'Japanese
+ "roma-kata" "\e$B%"\e(B" Japanese
"Map for Romaji-Katakana translation. (Japanese)"
(defconst its-zenkaku-escape "Z") ;; Escape character to Zenkaku inputs
(dolist (q1 '("b" "m" "p"))
(its-defrule (concat "m" q1) "\e$B%s\e(B" -1))
- (its-defrule "N" "\e$B%s\e(B")
-
- (let ((state (its-goto-state "n" nil t)))
- (its-make-next-state state -1 "n" "\e$B%s\e(B")
- (its-make-next-state state ?' "n" "\e$B%s\e(B")
- (its-defrule-otherwise state "\e$B%s\e(B"))
+ (its-defrule* "n" "\e$B%s\e(B")
+ (its-defrule "n'" "\e$B%s\e(B")
+ (its-defrule "N" "\e$B%s\e(B")
(let ((small '"x" ))
(its-defrule (concat small "a") "\e$B%!\e(B")
(define-its-state-machine-append its-kata-map
(if its-kata-enable-double-n
- (its-defrule "nn" "\e$B%s\e(B")
- (its-defrule "nn" "\e$B%s\e(B" -1))
+ (its-defrule "nn" "\e$B%s\e(B"))
(its-defrule "-" its-kata-horizontal)
(its-defrule "[" its-kata-open-bracket)
(defvar its-pinyin-cn-open-braket "\e$A!8\e(B" "*[") ; "\e$A#[\e(B"
(defvar its-pinyin-cn-close-braket "\e$A!9\e(B" "*]") ; "\e$A#]\e(B"
-(defvar its-pinyin-tw-enable-quanjioao-alphabet t "*Enable Quanjiao alphabet")
+(defvar its-pinyin-tw-enable-quanjioao-alphabet
+ (if (boundp 'its-enable-fullwidth-alphabet)
+ its-enable-fullwidth-alphabet
+ t)
+ "*Enable Quanjiao alphabet")
+
(defvar its-pinyin-tw-open-braket "\e$(G!V\e(B" "*[") ; "\e$(G!b\e(B "
(defvar its-pinyin-tw-close-braket "\e$(G!W\e(B" "*]") ; "\e$(G!c\e(B"
(eval-when-compile
- (defconst its-pinyin-term
- (char-to-string (make-char 'chinese-sisheng ?@)))
-
- (defsubst its-defoutput* (input display)
- (its-set-output (its-goto-state input nil t) display))
-
- (defun its-prev-terminal-state (input)
- (let ((len (length input))
- (state (its-get-start-state (symbol-value its-current-map)))
- (i 0) (ret nil) kst ks)
- (while (and (< i len)
- (setq state (its-get-next-state state (aref input i))))
- (if (or (null (its-kst-p (setq kst (its-get-kst/t state))))
- (mapcan (lambda (eob) (if (eq (its-eob-back eob) -1) (list t)))
- (cdr kst))
- (and (setq ks (assq -1 (car kst)))
- (null (its-get-kst/t (cdr ks)))))
- (setq ret state))
- (setq i (1+ i)))
- ret))
+ (defun its-prev-terminal-state (state-list)
+ (while (and state-list
+ (null (its-get-next-state (car state-list) -1)))
+ (setq state-list (cdr state-list)))
+ (car state-list))
(defun its-define-qingsheng (shengmu yunmu &optional s y)
(let ((input (concat shengmu yunmu))
- (output (concat (if s s (capitalize shengmu))
- (if y y yunmu)
- its-pinyin-term))
- state term kst i len c+b)
- (setq state (its-goto-state input nil t))
- (its-make-next-state state -1 input output)
- (its-make-next-state state ? (concat input " ") output)
- (its-make-next-state state ?0 (concat input "0") output)
- (its-define-otherwise
- state (its-make-otherwise output its-otherwise-back-one))
- (setq term (its-prev-terminal-state (substring input 0 -1)))
- (if term
- (progn
- (setq len (length (its-get-keyseq term))
- i len
- output (car (rassoc '(nil . -1) (cdr (its-get-kst/t term)))))
- (while (null
- (eq (setq term (its-get-next-state term (aref input i)))
- state))
- (setq i (1+ i) kst (its-get-kst/t term))
- (if (null (assq -1 (car kst)))
- (its-make-next-state term -1
- (its-get-keyseq term) output (- len i)))
- (setq c+b (its-make-class+back nil (1- (- len i))))
- (if (null (rassoc c+b (cdr kst)))
- (its-define-otherwise term
- (its-make-otherwise output c+b))))))
+ (output (concat (if s s (capitalize shengmu)) (if y y yunmu) "\e(0@\e(B"))
+ state term-state)
+ (setq state (its-defrule* input output))
+ (its-make-next-state state ? output)
+ (its-make-next-state state ?0 output)
+ (setq term-state (its-prev-terminal-state its-parent-states))
+ (if term-state
+ (let ((back (- (length (its-get-keyseq term-state)) (length input)))
+ (output (its-get-output (its-get-next-state term-state -1)))
+ (parents its-parent-states))
+ (while (null (eq (car parents) term-state))
+ (its-make-next-state (car parents) -1 output (1+ back))
+ (its-defrule-otherwise (car parents) output nil back)
+ (setq back (1+ back)
+ parents (cdr parents)))))
state))
(defmacro its-do-sisheng-table (list)
(ss (list ,@shengmu)) s cs state i)
(while ss
(setq s (car ss)
+ ss (cdr ss)
cs (capitalize s)
state (its-define-qingsheng s y cs qing))
- (setq i 1)
- (while (<= i 4)
- (its-make-next-state state (+ ?0 i)
- (concat s y i)
- (concat cs (nth i ,yunmu) its-pinyin-term))
- (setq i (1+ i)))
- (setq ss (cdr ss)))))
+ (its-make-next-state state ?1 (concat cs (nth 1 ,yunmu) "\e(0@\e(B"))
+ (its-make-next-state state ?2 (concat cs (nth 2 ,yunmu) "\e(0@\e(B"))
+ (its-make-next-state state ?3 (concat cs (nth 3 ,yunmu) "\e(0@\e(B"))
+ (its-make-next-state state ?4 (concat cs (nth 4 ,yunmu) "\e(0@\e(B")))))
(defmacro its-define-pinyin-table ()
'(let ((- "") (B "b") (C "c") (D "d") (F "f") (G "g") (H "h")
(UN '("un" "\e(01\e(Bn" "\e(02\e(Bn" "\e(03\e(Bn" "\e(04\e(Bn" "un" ))
(UO '("uo" "u\e(0-\e(B" "u\e(0.\e(B" "u\e(0/\e(B" "u\e(00\e(B" "uo" )))
+ (its-define-qingsheng "hm" "")
+ (its-define-qingsheng "hng" "")
+ (its-defrule* "m" "m\e(0@\e(B")
+ (its-defrule "m0" "m\e(0@\e(B")
+ (its-defrule* "n" "n\e(0@\e(B")
+ (its-defrule "n0" "n\e(0@\e(B")
+ (its-defrule "n2" "\e(0=@\e(B")
+ (its-defrule "n3" "\e(0>@\e(B")
+ (its-defrule "n4" "\e(0?@\e(B")
+ (its-define-qingsheng "" "ng")
+
(its-do-sisheng-table
(((- B C D F G H K L M N P S T W Y Z CH SH ZH ) A)
((- B C D G H K L M N P S T W Z CH SH ZH ) AI)
((J Q X) (cons "ei" (cdr IE )))
((J Q X) (cons "en" (cdr IN )))
((J Q X) (cons "eng" (cdr ING )))
- ((J Q X) (cons "ou" (cdr IU )))))
-
- (its-define-qingsheng "hm" "")
- (its-define-qingsheng "hng" "")
- (its-define-qingsheng "" "ng")
-
- (its-define-qingsheng "" "m")
- (its-define-qingsheng "" "n")
- (its-defrule "n2" "\e(0=@\e(B")
- (its-defrule "n3" "\e(0>@\e(B")
- (its-defrule "n4" "\e(0?@\e(B"))))
+ ((J Q X) (cons "ou" (cdr IU ))))))))
(define-its-state-machine its-pinyin-cn-map
- "pinyin-cn" "\e$AF4\e(BG" 'Chinese-GB
+ "pinyin-cn" "\e$AF4\e(BG" Chinese-GB
"Map for Pinyin input. (Chinese-GB)"
(defconst its-quanjiao-escape "Z")
(its-defrule-select-mode-temporally "Q" quanjiao-downcase-cn)
(its-define-pinyin-table)
- (its-defoutput* "b " "\e$A2;\e(B")
- (its-defoutput* "c " "\e$A2E\e(B")
- (its-defoutput* "ch " "\e$A3v\e(B")
- (its-defoutput* "d " "\e$A5D\e(B")
- (its-defoutput* "f " "\e$A74\e(B")
- (its-defoutput* "g " "\e$A8v\e(B")
- (its-defoutput* "h " "\e$A:M\e(B")
- (its-defoutput* "i " "\e$AR;\e(B")
- (its-defoutput* "j " "\e$A>M\e(B")
- (its-defoutput* "k " "\e$A?I\e(B")
- (its-defoutput* "l " "\e$AAK\e(B")
- (its-defoutput* "m " "\e$AC?\e(B")
- (its-defoutput* "n " "\e$ADj\e(B")
- (its-defoutput* "p " "\e$AEz\e(B")
- (its-defoutput* "q " "\e$AH%\e(B")
- (its-defoutput* "r " "\e$AHU\e(B")
- (its-defoutput* "s " "\e$AJG\e(B")
- (its-defoutput* "sh " "\e$AIO\e(B")
- (its-defoutput* "t " "\e$AK{\e(B")
- (its-defoutput* "w " "\e$ANR\e(B")
- (its-defoutput* "x " "\e$AOr\e(B")
- (its-defoutput* "y " "\e$ASV\e(B")
- (its-defoutput* "z " "\e$ATZ\e(B")
- (its-defoutput* "zh " "\e$AWE\e(B")
+ (its-defrule "b " "\e$A2;\e(B")
+ (its-defrule "c " "\e$A2E\e(B")
+ (its-defrule "ch " "\e$A3v\e(B")
+ (its-defrule "d " "\e$A5D\e(B")
+ (its-defrule "f " "\e$A74\e(B")
+ (its-defrule "g " "\e$A8v\e(B")
+ (its-defrule "h " "\e$A:M\e(B")
+ (its-defrule "i " "\e$AR;\e(B")
+ (its-defrule "j " "\e$A>M\e(B")
+ (its-defrule "k " "\e$A?I\e(B")
+ (its-defrule "l " "\e$AAK\e(B")
+ (its-defrule "m " "\e$AC?\e(B")
+ (its-defrule "n " "\e$ADj\e(B")
+ (its-defrule "p " "\e$AEz\e(B")
+ (its-defrule "q " "\e$AH%\e(B")
+ (its-defrule "r " "\e$AHU\e(B")
+ (its-defrule "s " "\e$AJG\e(B")
+ (its-defrule "sh " "\e$AIO\e(B")
+ (its-defrule "t " "\e$AK{\e(B")
+ (its-defrule "w " "\e$ANR\e(B")
+ (its-defrule "x " "\e$AOr\e(B")
+ (its-defrule "y " "\e$ASV\e(B")
+ (its-defrule "z " "\e$ATZ\e(B")
+ (its-defrule "zh " "\e$AWE\e(B")
(dolist (ascii '(("0" . "\e$A#0\e(B") ("1" . "\e$A#1\e(B") ("2" . "\e$A#2\e(B") ("3" . "\e$A#3\e(B")
("4" . "\e$A#4\e(B") ("5" . "\e$A#5\e(B") ("6" . "\e$A#6\e(B") ("7" . "\e$A#7\e(B")
(its-defrule "!" "\e$A#!\e(B"))
(define-its-state-machine its-pinyin-tw-map
- "pinyin-tw" "\e$(GQ;\e(BC" 'Chinese-CNS
+ "pinyin-tw" "\e$(GQ;\e(BC" Chinese-CNS
"Map for Pinyin input."
(defconst its-quanjiao-escape "Z")
(its-defrule-select-mode-temporally "Q" quanjiao-downcase-tw)
(its-define-pinyin-table)
- (its-defoutput* "b " "\e$(GDb\e(B")
- (its-defoutput* "c " "\e$(GD_\e(B")
- (its-defoutput* "ch " "\e$(GEx\e(B")
- (its-defoutput* "d " "\e$(GN{\e(B")
- (its-defoutput* "f " "\e$(GE0\e(B")
- (its-defoutput* "g " "\e$(GT6\e(B")
- (its-defoutput* "h " "\e$(GLO\e(B")
- (its-defoutput* "i " "\e$(GD!\e(B")
- (its-defoutput* "j " "\e$(G^s\e(B")
- (its-defoutput* "k " "\e$(GF+\e(B")
- (its-defoutput* "l " "\e$(GD'\e(B")
- (its-defoutput* "m " "\e$(GJd\e(B")
- (its-defoutput* "n " "\e$(GH!\e(B")
- (its-defoutput* "p " "\e$(GJG\e(B")
- (its-defoutput* "q " "\e$(GF*\e(B")
- (its-defoutput* "r " "\e$(GEJ\e(B")
- (its-defoutput* "s " "\e$(GQR\e(B")
- (its-defoutput* "sh " "\e$(GD8\e(B")
- (its-defoutput* "t " "\e$(GEl\e(B")
- (its-defoutput* "w " "\e$(GJ<\e(B")
- (its-defoutput* "x " "\e$(GGW\e(B")
- (its-defoutput* "y " "\e$(GD4\e(B")
- (its-defoutput* "z " "\e$(GGc\e(B")
- (its-defoutput* "zh " "\e$(Gaa\e(B")
+ (its-defrule "b " "\e$(GDb\e(B")
+ (its-defrule "c " "\e$(GD_\e(B")
+ (its-defrule "ch " "\e$(GEx\e(B")
+ (its-defrule "d " "\e$(GN{\e(B")
+ (its-defrule "f " "\e$(GE0\e(B")
+ (its-defrule "g " "\e$(GT6\e(B")
+ (its-defrule "h " "\e$(GLO\e(B")
+ (its-defrule "i " "\e$(GD!\e(B")
+ (its-defrule "j " "\e$(G^s\e(B")
+ (its-defrule "k " "\e$(GF+\e(B")
+ (its-defrule "l " "\e$(GD'\e(B")
+ (its-defrule "m " "\e$(GJd\e(B")
+ (its-defrule "n " "\e$(GH!\e(B")
+ (its-defrule "p " "\e$(GJG\e(B")
+ (its-defrule "q " "\e$(GF*\e(B")
+ (its-defrule "r " "\e$(GEJ\e(B")
+ (its-defrule "s " "\e$(GQR\e(B")
+ (its-defrule "sh " "\e$(GD8\e(B")
+ (its-defrule "t " "\e$(GEl\e(B")
+ (its-defrule "w " "\e$(GJ<\e(B")
+ (its-defrule "x " "\e$(GGW\e(B")
+ (its-defrule "y " "\e$(GD4\e(B")
+ (its-defrule "z " "\e$(GGc\e(B")
+ (its-defrule "zh " "\e$(Gaa\e(B")
(dolist (ascii '(("0" . "\e$(G$!\e(B") ("1" . "\e$(G$"\e(B") ("2" . "\e$(G$#\e(B") ("3" . "\e$(G$$\e(B")
("4" . "\e$(G$%\e(B") ("5" . "\e$(G$&\e(B") ("6" . "\e$(G$'\e(B") ("7" . "\e$(G$(\e(B")
(its-defrule "=" "\e$A#=\e(B") (its-defrule "`" "\e$A#`\e(B")
(its-defrule "\\" "\e$A#\\e(B") (its-defrule "|" "\e$A#|\e(B")
(its-defrule "_" "\e$A#_\e(B") (its-defrule "+" "\e$A#+\e(B")
- (its-defrule "{" "\e$(G!B\e(B") (its-defrule "}" "\e$(G!C\e(B")
+ (its-defrule "{" "\e$A#{\e(B") (its-defrule "}" "\e$A#}\e(B")
(its-defrule "\"" "\e$A#"\e(B") (its-defrule "'" "\e$A#'\e(B")
(its-defrule "<" "\e$A#<\e(B") (its-defrule ">" "\e$A#>\e(B"))
(progn
(its-defrule "=" "\e$(G"8\e(B") (its-defrule "`" "\e$(G!j\e(B")
(its-defrule "\\" "\e$(G"b\e(B") (its-defrule "|" "\e$(G"^\e(B")
(its-defrule "_" "\e$(G"%\e(B") (its-defrule "+" "\e$(G"0\e(B")
- (its-defrule "{" "\e$A#{\e(B") (its-defrule "}" "\e$(G!a\e(B")
+ (its-defrule "{" "\e$(G!B\e(B") (its-defrule "}" "\e$(G!C\e(B")
(its-defrule "\"" "\e$(G!i\e(B") (its-defrule "'" "\e$(G!k\e(B")
(its-defrule "<" "\e$(G"6\e(B") (its-defrule ">" "\e$(G"7\e(B"))
(progn
(require 'its))
(define-its-state-machine its-quanjiao-up-cn-map
- "quanjiao-upcase-cn" "\e$A#A\e(B" 'Chinese-GB
+ "quanjiao-upcase-cn" "\e$A#A\e(B" Chinese-GB
"Map for quanjiao-upcase input. (Chinese-GB)"
(dolist (ascii '(("0" . "\e$A#0\e(B") ("1" . "\e$A#1\e(B") ("2" . "\e$A#2\e(B") ("3" . "\e$A#3\e(B")
(its-defrule in out))))
(define-its-state-machine its-quanjiao-down-cn-map
- "quanjiao-downcase-cn" "\e$A#a\e(B" 'Chinese-GB
+ "quanjiao-downcase-cn" "\e$A#a\e(B" Chinese-GB
"Map for quanjiao-downcase input. (Chinese-GB)"
(dolist (ascii '(("0" . "\e$A#0\e(B") ("1" . "\e$A#1\e(B") ("2" . "\e$A#2\e(B") ("3" . "\e$A#3\e(B")
(its-defrule in out))))
(define-its-state-machine its-quanjiao-up-tw-map
- "quanjiao-upcase-tw" "\e$(G$A\e(B" 'Chinese-CNS
+ "quanjiao-upcase-tw" "\e$(G$A\e(B" Chinese-CNS
"Map for quanjiao-upcase input. (Chinese-CNS)"
(dolist (ascii '(("0" . "\e$(G$!\e(B") ("1" . "\e$(G$"\e(B") ("2" . "\e$(G$#\e(B") ("3" . "\e$(G$$\e(B")
(its-defrule in out))))
(define-its-state-machine its-quanjiao-down-tw-map
- "quanjiao-downcase-tw" "\e$(G$[\e(B" 'Chinese-CNS
+ "quanjiao-downcase-tw" "\e$(G$[\e(B" Chinese-CNS
"Map for quanjiao-downcase input. (Chinese-CNS)"
(dolist (ascii '(("0" . "\e$(G$!\e(B") ("1" . "\e$(G$"\e(B") ("2" . "\e$(G$#\e(B") ("3" . "\e$(G$$\e(B")
;;; its/thai.el --- Inputting Thai characters in Egg Input Method Architecture
-;; Copyright (C) 1998 Mule Project,
+;; Copyright (C) 1997, 1998 Mule Project,
;; Powered by Electrotechnical Laboratory, JAPAN.
;; Project Leader: Satoru Tomura <tomura@etl.go.jp>
list))))
`(let (consonant vowel tone)
,@list
- (its-define-thai-composit consonant vowel tone))))
+ (its-thai-composit consonant vowel tone))))
- (defun its-define-thai-composit (consonant vowel tone)
- (let (pair state)
+ (defun its-thai-composit (consonant vowel tone)
+ (let (keyseq output)
(while consonant
- (setq pair (car consonant)
+ (setq keyseq (car (car consonant))
+ output (cdr (car consonant))
consonant (cdr consonant))
- (setq state (its-goto-state (car pair)))
- (its-make-next-state state -1 (aref (cdr pair) 0) (cdr pair))
- (its-define-thai-add-vowel state (car pair) (cdr pair) vowel tone)
- (its-define-thai-add-tone state (car pair) (cdr pair) tone)
- (its-defrule-otherwise state (cdr pair)))))
-
- (defun its-define-thai-add-vowel (state keyseq output vowel tone)
- (let (next-state next-key next-keyseq next-output composed-output)
+ (its-thai-add-vowel keyseq output vowel tone)
+ (its-thai-add-tone keyseq output tone))))
+
+ (defun its-thai-add-vowel (keyseq output vowel tone)
+ (let (next-keyseq next-output)
(while vowel
- (setq next-key (car (car vowel))
- next-keyseq (concat keyseq next-key)
+ (setq next-keyseq (concat keyseq (car (car vowel)))
next-output (concat output (cdr (car vowel)))
- composed-output (compose-string next-output)
vowel (cdr vowel))
- (setq next-state (its-make-next-state state
- (aref next-key 0)
- next-keyseq
- composed-output))
- (its-make-next-state next-state -1 next-keyseq composed-output)
- (its-define-thai-add-tone next-state next-keyseq next-output tone)
- (its-defrule-otherwise next-state composed-output))))
-
- (defun its-define-thai-add-tone (state keyseq output tone)
- (let (next-state next-key next-keyseq next-output composed-output)
+ (its-defrule next-keyseq (compose-string next-output))
+ (its-thai-add-tone next-keyseq next-output tone))))
+
+ (defun its-thai-add-tone (keyseq output tone)
+ (let (next-keyseq next-output)
(while tone
- (setq next-key (car (car tone))
- next-keyseq (concat keyseq next-key)
+ (setq next-keyseq (concat keyseq (car (car tone)))
next-output (concat output (cdr (car tone)))
- composed-output (compose-string next-output)
- tone (cdr tone))
- (setq next-state (its-make-next-state state
- (aref next-key 0)
- next-keyseq
- composed-output))))))
+ tone (cdr tone))
+ (its-defrule next-keyseq (compose-string next-output))))))
;; Thai Kesmanee keyboard support.
(define-its-state-machine its-thai-kesmanee-map
- "kesmanee" "\e,T!!\e(B" 'Thai
+ "kesmanee" "\e,T!!\e(B" Thai
"Map for Thai Kesmanee input method with TIS620 keyboard. (Thai)"
(define-its-thai-keymap
(require 'its))
(define-its-state-machine its-zenkaku-up-map
- "zenkaku-upcase" "\e$B#A\e(B" 'Japanese
+ "zenkaku-upcase" "\e$B#A\e(B" Japanese
"Map for zenkaku-upcase input."
(dolist (ascii '(("0" . "\e$B#0\e(B") ("1" . "\e$B#1\e(B") ("2" . "\e$B#2\e(B") ("3" . "\e$B#3\e(B")
(its-defrule in out))))
(define-its-state-machine its-zenkaku-down-map
- "zenkaku-downcase" "\e$B#a\e(B" 'Japanese
+ "zenkaku-downcase" "\e$B#a\e(B" Japanese
"Map for zenkaku-downcase input."
(dolist (ascii '(("0" . "\e$B#0\e(B") ("1" . "\e$B#1\e(B") ("2" . "\e$B#2\e(B") ("3" . "\e$B#3\e(B")
,@(mapcar (lambda (syl) `(its-define-zhuyin ,@syl))
list)))
- (defmacro its-define-zhuyin (shengmu yunmu1 &optional yunmu2 qing-only)
+ (defmacro its-define-zhuyin (shengmu yunmu1 &optional yunmu2 qingsheng)
`(let ((s (list ,@shengmu))
(yi (concat (car ,yunmu1) (car ,yunmu2)))
(yo (concat (nth 1 ,yunmu1) (nth 1 ,yunmu2)))
- (tone (if ,qing-only "\e(0A\e(B" "\e(0@\e(B"))
+ (tone (if ,qingsheng "\e(0A\e(B" "\e(0@\e(B"))
in out out1 state)
(while s
(setq in (concat (car (car s)) yi)
out (concat (nth 1 (car s)) yo)
out1 (concat out tone)
- state (its-goto-state in nil t))
- (if (and ,qing-only (its-get-kst/t state))
- (its-set-output state out)
- (its-set-output state out1))
- (its-make-next-state state -1 in out1)
- (its-make-next-state state ? (concat in " ") out1)
- (its-define-otherwise state (its-make-otherwise
- out1
- its-otherwise-back-one))
- ,(if qing-only
- nil
- '(progn
- (its-make-next-state state ?1 (concat in 1) (concat out "\e(0A\e(B"))
- (its-make-next-state state ?2 (concat in 2) (concat out "\e(0B\e(B"))
- (its-make-next-state state ?3 (concat in 3) (concat out "\e(0C\e(B"))
- (its-make-next-state state ?4 (concat in 4) (concat out "\e(0D\e(B"))))
- (setq s (cdr s)))))
+ state (its-defrule in out1)
+ s (cdr s))
+ (its-defrule (concat in " ") out1)
+ ,@(if (null qingsheng)
+ '((its-make-next-state state ?1 (concat out "\e(0A\e(B"))
+ (its-make-next-state state ?2 (concat out "\e(0B\e(B"))
+ (its-make-next-state state ?3 (concat out "\e(0C\e(B"))
+ (its-make-next-state state ?4 (concat out "\e(0D\e(B")))))))
(defmacro its-define-zhuyin-table ()
'(let ((- '("" ""))
(ER '("^" "\e(0f\e(B")) (OU '("y" "\e(0a\e(B"))
(I '("e" "\e(0g\e(B")) (U '("x" "\e(0h\e(B")) (V '("u" "\e(0i\e(B")))
- (mapcar (lambda (s) (its-defrule (car s) (nth 1 s)))
- (list B P M F D T N L G K H J Q X))
+ (its-define-zhuyin (- H) M nil t)
+ (its-define-zhuyin (- H) '("@" "@") nil t)
+ (its-define-zhuyin (- ) N nil t)
(its-do-zhuyin-table
- (((- B P M F D T N L G K H ZH CH SH Z C S ) A)
+ ((( ZH CH SH R Z C S ) -)
+ ((- B P M F D T N L G K H ZH CH SH Z C S ) A)
((- B P M F L ) O)
((- M D T N L G K H ZH CH SH R Z C S ) e)
((- B P M D T N L G K H ZH CH SH Z C S ) AI)
((- B P M F D T N L G K H ZH CH SH R Z C S ) ENG)
((- ) ER)
((- P M F D T N L G K H ZH CH SH R Z C S ) OU)
- (( ZH CH SH R Z C S ) -)
((- B P M D T N L J Q X ) I)
((- D L J Q X ) I A)
((- ) I O)
((- N L J Q X ) V E)
((- J Q X ) V AN)
((- J Q X ) V EN)
- ((- J Q X ) V ENG)
+ ((- J Q X ) V ENG)))
- ((- H) M nil t)
- ((- H) '("@" "@") nil t)
- ((- ) N nil t)))
+ (mapcar (lambda (s) (its-defoutput (car s) (nth 1 s)))
+ (list B P M F D T N L G K H J Q X))
- (its-defrule (concat (car N) 2) (concat (nth 1 N) "\e(0B\e(B"))
- (its-defrule (concat (car N) 3) (concat (nth 1 N) "\e(0C\e(B"))
- (its-defrule (concat (car N) 4) (concat (nth 1 N) "\e(0D\e(B")))))
+ (its-defrule (concat (car N) 2) (concat (nth 1 N) "\e(0B\e(B"))
+ (its-defrule (concat (car N) 3) (concat (nth 1 N) "\e(0C\e(B"))
+ (its-defrule (concat (car N) 4) (concat (nth 1 N) "\e(0D\e(B")))))
(define-its-state-machine its-zhuyin-cn-map
- "zhuyin-cn" "\e$AW"\e(BG" 'Chinese-GB
+ "zhuyin-cn" "\e$AW"\e(BG" Chinese-GB
"Map for Zhuyin input. (Chinese-GB)"
(defconst its-quanjiao-escape "Z")
(its-defrule "?" "\e$A!"\e(B"))
(define-its-state-machine its-zhuyin-tw-map
- "zhuyin-tw" "\e$(GNC\e(BC" 'Chinese-CNS
+ "zhuyin-tw" "\e$(GNC\e(BC" Chinese-CNS
"Map for Zhuyin input."
(defconst its-quanjiao-escape "Z")
(its-defrule "(" "\e$A#(\e(B") (its-defrule ")" "\e$A#)\e(B")
(its-defrule "~" "\e$A!+\e(B")
(its-defrule "=" "\e$A#=\e(B") (its-defrule "`" "\e$A#`\e(B")
- (its-defrule "\\" "\e$(G"`\e(B") (its-defrule "|" "\e$A#|\e(B")
+ (its-defrule "\\" "\e$A#\\e(B") (its-defrule "|" "\e$A#|\e(B")
(its-defrule "_" "\e$A#_\e(B") (its-defrule "+" "\e$A#+\e(B")
- (its-defrule "{" "\e$(G!B\e(B") (its-defrule "}" "\e$(G!C\e(B")
+ (its-defrule "{" "\e$A#{\e(B") (its-defrule "}" "\e$A#}\e(B")
(its-defrule "\"" "\e$A#"\e(B") (its-defrule "'" "\e$A#'\e(B"))
(progn
(its-defrule "#" "#") (its-defrule "$" "$")
(its-defrule "(" "\e$(G!>\e(B") (its-defrule ")" "\e$(G!?\e(B")
(its-defrule "~" "\e$(G"D\e(B")
(its-defrule "=" "\e$(G"8\e(B") (its-defrule "`" "\e$(G!j\e(B")
- (its-defrule "\\" "\e$(G"b\e(B") (its-defrule "|" "\e$(G"^\e(B")
+ (its-defrule "\\" "\e$(G"`\e(B") (its-defrule "|" "\e$(G"^\e(B")
(its-defrule "_" "\e$(G"%\e(B") (its-defrule "+" "\e$(G"0\e(B")
- (its-defrule "{" "\e$A#{\e(B") (its-defrule "}" "\e$(G!a\e(B")
+ (its-defrule "{" "\e$(G!B\e(B") (its-defrule "}" "\e$(G!C\e(B")
(its-defrule "\"" "\e$(G!i\e(B") (its-defrule "'" "\e$(G!k\e(B"))
(progn
(its-defrule "#" "#") (its-defrule "$" "$")