From a279e4bc8317bd5b9f656a1ae15775dfecd86588 Mon Sep 17 00:00:00 2001 From: morioka Date: Sun, 30 Aug 1998 12:14:52 +0000 Subject: [PATCH] egg-980703. --- ChangeLog | 23 ++++++ egg-cnv.el | 8 +-- egg-mlh.el | 14 +--- its.el | 85 +++++++++++++--------- its/erpin.el | 136 +++++++++++++++++------------------ its/hangul.el | 43 ++++------- its/hankata.el | 14 ++-- its/hira.el | 14 ++-- its/jeonkak.el | 4 +- its/kata.el | 14 ++-- its/pinyin.el | 213 +++++++++++++++++++++++++------------------------------ its/quanjiao.el | 8 +-- its/thai.el | 56 ++++++--------- its/zenkaku.el | 4 +- its/zhuyin.el | 63 +++++++--------- 15 files changed, 320 insertions(+), 379 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3829a2c..58e4fdc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +1998-07-03 KATAYAMA Yoshio + + * 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 + + * 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 * egg-cnv.el (egg-abort-conversion): Bug fix. diff --git a/egg-cnv.el b/egg-cnv.el index a996838..a835836 100644 --- a/egg-cnv.el +++ b/egg-cnv.el @@ -1,4 +1,4 @@ -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. @@ -190,11 +190,6 @@ pn;;; egg-cnv.el --- Conversion Backend in Egg Input Method Architecture (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 @@ -369,6 +364,7 @@ pn;;; egg-cnv.el --- Conversion Backend in Egg Input Method Architecture (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.") diff --git a/egg-mlh.el b/egg-mlh.el index 1c9aefe..41b5129 100644 --- a/egg-mlh.el +++ b/egg-mlh.el @@ -488,10 +488,7 @@ CHAR. MNEMONIC CONVERSION SCHEME (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))) @@ -507,15 +504,6 @@ CHAR. MNEMONIC CONVERSION SCHEME (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 "[$B$!(B-$B$s(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,.[]") diff --git a/its.el b/its.el index b01b06b..4f9d71c 100644 --- a/its.el +++ b/its.el @@ -552,23 +552,15 @@ 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 @@ -579,27 +571,51 @@ BACK $B$,(B($BIi$N(B)$B@0?t$N;~$O(B, OUTPUT $B$r=PNO$7$?8e(B, BACK $B$N $BLa$C$FF0$/$b$N$H$9$k!#JQ495,B'$O$b$C$H$b:G6a$K(B its-define-state-machine $B$5$l$?JQ49I=$KEPO?$5$l$k!#(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))) @@ -621,12 +637,11 @@ Return last state." (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) diff --git a/its/erpin.el b/its/erpin.el index 83b1d6f..087c9c0 100644 --- a/its/erpin.el +++ b/its/erpin.el @@ -21,21 +21,13 @@ (defvar its-erpin-tw-close-braket "$(G!W(B" "*]") ; "$(G!c(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) "(0@(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) "(0@(B"))) + (prog1 + (its-defrule input output) + (its-defrule (concat input " ") output) + (its-defrule (concat input "0") output)))) (defmacro its-do-erpin-table (list) `(progn @@ -50,10 +42,10 @@ (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 "(0@(B")) - (its-make-next-state state ?2 (concat sa y 2) (concat sd y2 "(0@(B")) - (its-make-next-state state ?3 (concat sa y 3) (concat sd y3 "(0@(B")) - (its-make-next-state state ?4 (concat sa y 4) (concat sd y4 "(0@(B")) + (its-make-next-state state ?1 (concat sd y1 "(0@(B")) + (its-make-next-state state ?2 (concat sd y2 "(0@(B")) + (its-make-next-state state ?3 (concat sd y3 "(0@(B")) + (its-make-next-state state ?4 (concat sd y4 "(0@(B")) (setq ss (cdr ss))))) (defmacro its-define-erpin-table () @@ -100,9 +92,6 @@ (un '("z" "(01(Bn" "(02(Bn" "(03(Bn" "(04(Bn" "un" )) (uo '("o" "u(0-(B" "u(0.(B" "u(0/(B" "u(00(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) @@ -152,6 +141,9 @@ ((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") @@ -163,7 +155,7 @@ (its-defrule "on4" "(0?@(B")))) (define-its-state-machine its-erpin-cn-map - "erpin-cn" "$A6~(BG" 'Chinese-GB + "erpin-cn" "$A6~(BG" Chinese-GB "Map for Erpin input. (Chinese-GB)" (defconst its-quanjiao-escape "Z") @@ -173,30 +165,30 @@ (its-defrule-select-mode-temporally "Q" quanjiao-downcase-cn) (its-define-erpin-table) - (its-defoutput* "b " "$A2;(B") - (its-defoutput* "c " "$A2E(B") - (its-defoutput* "ch " "$A3v(B") - (its-defoutput* "d " "$A5D(B") - (its-defoutput* "f " "$A74(B") - (its-defoutput* "g " "$A8v(B") - (its-defoutput* "h " "$A:M(B") - (its-defoutput* "i " "$AR;(B") - (its-defoutput* "j " "$A>M(B") - (its-defoutput* "k " "$A?I(B") - (its-defoutput* "l " "$AAK(B") - (its-defoutput* "m " "$AC?(B") - (its-defoutput* "n " "$ADj(B") - (its-defoutput* "p " "$AEz(B") - (its-defoutput* "q " "$AH%(B") - (its-defoutput* "r " "$AHU(B") - (its-defoutput* "s " "$AJG(B") - (its-defoutput* "u " "$AIO(B") - (its-defoutput* "t " "$AK{(B") - (its-defoutput* "w " "$ANR(B") - (its-defoutput* "x " "$AOr(B") - (its-defoutput* "y " "$ASV(B") - (its-defoutput* "z " "$ATZ(B") - (its-defoutput* "v " "$AWE(B") + (its-defrule "b " "$A2;(B") + (its-defrule "c " "$A2E(B") + (its-defrule "ch " "$A3v(B") + (its-defrule "d " "$A5D(B") + (its-defrule "f " "$A74(B") + (its-defrule "g " "$A8v(B") + (its-defrule "h " "$A:M(B") + (its-defrule "i " "$AR;(B") + (its-defrule "j " "$A>M(B") + (its-defrule "k " "$A?I(B") + (its-defrule "l " "$AAK(B") + (its-defrule "m " "$AC?(B") + (its-defrule "n " "$ADj(B") + (its-defrule "p " "$AEz(B") + (its-defrule "q " "$AH%(B") + (its-defrule "r " "$AHU(B") + (its-defrule "s " "$AJG(B") + (its-defrule "u " "$AIO(B") + (its-defrule "t " "$AK{(B") + (its-defrule "w " "$ANR(B") + (its-defrule "x " "$AOr(B") + (its-defrule "y " "$ASV(B") + (its-defrule "z " "$ATZ(B") + (its-defrule "v " "$AWE(B") (dolist (ascii '(("0" . "$A#0(B") ("1" . "$A#1(B") ("2" . "$A#2(B") ("3" . "$A#3(B") ("4" . "$A#4(B") ("5" . "$A#5(B") ("6" . "$A#6(B") ("7" . "$A#7(B") @@ -237,7 +229,7 @@ (its-defrule "!" "$A#!(B")) (define-its-state-machine its-erpin-tw-map - "erpin-tw" "$(GD((BC" 'Chinese-CNS + "erpin-tw" "$(GD((BC" Chinese-CNS "Map for Erpin input." (defconst its-quanjiao-escape "Z") @@ -247,30 +239,30 @@ (its-defrule-select-mode-temporally "Q" quanjiao-downcase-cn) (its-define-erpin-table) - (its-defoutput* "b " "$(GDb(B") - (its-defoutput* "c " "$(GD_(B") - (its-defoutput* "ch " "$(GEx(B") - (its-defoutput* "d " "$(GN{(B") - (its-defoutput* "f " "$(GE0(B") - (its-defoutput* "g " "$(GT6(B") - (its-defoutput* "h " "$(GLO(B") - (its-defoutput* "i " "$(GD!(B") - (its-defoutput* "j " "$(G^s(B") - (its-defoutput* "k " "$(GF+(B") - (its-defoutput* "l " "$(GD'(B") - (its-defoutput* "m " "$(GJd(B") - (its-defoutput* "n " "$(GH!(B") - (its-defoutput* "p " "$(GJG(B") - (its-defoutput* "q " "$(GF*(B") - (its-defoutput* "r " "$(GEJ(B") - (its-defoutput* "s " "$(GQR(B") - (its-defoutput* "u " "$(GD8(B") - (its-defoutput* "t " "$(GEl(B") - (its-defoutput* "w " "$(GJ<(B") - (its-defoutput* "x " "$(GGW(B") - (its-defoutput* "y " "$(GD4(B") - (its-defoutput* "z " "$(GGc(B") - (its-defoutput* "v " "$(Gaa(B") + (its-defrule "b " "$(GDb(B") + (its-defrule "c " "$(GD_(B") + (its-defrule "ch " "$(GEx(B") + (its-defrule "d " "$(GN{(B") + (its-defrule "f " "$(GE0(B") + (its-defrule "g " "$(GT6(B") + (its-defrule "h " "$(GLO(B") + (its-defrule "i " "$(GD!(B") + (its-defrule "j " "$(G^s(B") + (its-defrule "k " "$(GF+(B") + (its-defrule "l " "$(GD'(B") + (its-defrule "m " "$(GJd(B") + (its-defrule "n " "$(GH!(B") + (its-defrule "p " "$(GJG(B") + (its-defrule "q " "$(GF*(B") + (its-defrule "r " "$(GEJ(B") + (its-defrule "s " "$(GQR(B") + (its-defrule "u " "$(GD8(B") + (its-defrule "t " "$(GEl(B") + (its-defrule "w " "$(GJ<(B") + (its-defrule "x " "$(GGW(B") + (its-defrule "y " "$(GD4(B") + (its-defrule "z " "$(GGc(B") + (its-defrule "v " "$(Gaa(B") (dolist (ascii '(("0" . "$(G$!(B") ("1" . "$(G$"(B") ("2" . "$(G$#(B") ("3" . "$(G$$(B") ("4" . "$(G$%(B") ("5" . "$(G$&(B") ("6" . "$(G$'(B") ("7" . "$(G$((B") @@ -330,7 +322,7 @@ (its-defrule "=" "$A#=(B") (its-defrule "`" "$A#`(B") (its-defrule "\\" "$A#\(B") (its-defrule "|" "$A#|(B") (its-defrule "_" "$A#_(B") (its-defrule "+" "$A#+(B") - (its-defrule "{" "$(G!B(B") (its-defrule "}" "$(G!C(B") + (its-defrule "{" "$A#{(B") (its-defrule "}" "$A#}(B") (its-defrule "\"" "$A#"(B") (its-defrule "'" "$A#'(B") (its-defrule "<" "$A#<(B") (its-defrule ">" "$A#>(B")) (progn @@ -372,7 +364,7 @@ (its-defrule "=" "$(G"8(B") (its-defrule "`" "$(G!j(B") (its-defrule "\\" "$(G"b(B") (its-defrule "|" "$(G"^(B") (its-defrule "_" "$(G"%(B") (its-defrule "+" "$(G"0(B") - (its-defrule "{" "$A#{(B") (its-defrule "}" "$(G!a(B") + (its-defrule "{" "$(G!B(B") (its-defrule "}" "$(G!C(B") (its-defrule "\"" "$(G!i(B") (its-defrule "'" "$(G!k(B") (its-defrule "<" "$(G"6(B") (its-defrule ">" "$(G"7(B")) (progn diff --git a/its/hangul.el b/its/hangul.el index 83a7556..714682e 100644 --- a/its/hangul.el +++ b/its/hangul.el @@ -31,7 +31,6 @@ (eval-when-compile (require 'its) - (require 'egg-edep) (require 'cl)) (defvar its-hangul-enable-jeonkak-alphabet @@ -61,13 +60,11 @@ (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))) @@ -80,28 +77,16 @@ (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 @@ -114,7 +99,7 @@ list)))) (define-its-state-machine its-hangul-map - "hangul" "$(CGQ(B" 'Korean + "hangul" "$(CGQ(B" Korean "Map for Hangul input. (Korean)" (defconst its-jeonkak-escape "Z") diff --git a/its/hankata.el b/its/hankata.el index e701c1a..897ebc1 100644 --- a/its/hankata.el +++ b/its/hankata.el @@ -44,7 +44,7 @@ (defvar its-han-kata-horizontal "(I0(B" "*-") ; "$B!](B" (define-its-state-machine its-han-kata-map - "roma-han-kata" "(I11(B" "Japanese" + "roma-han-kata" "(I11(B" Japanese "Map for Romaji-Hankaku-Katakana translation. (Japanese)" (defconst its-hankaku-escape "~") ;; Escape character to Hankaku inputs @@ -64,12 +64,9 @@ (dolist (q1 '("b" "m" "p")) (its-defrule (concat "m" q1) "(I](B" -1)) - (its-defrule "N" "(I](B") - - (let ((state (its-goto-state "n" nil t))) - (its-make-next-state state -1 "n" "(I](B") - (its-make-next-state state ?' "n" "(I](B") - (its-defrule-otherwise state "(I](B")) + (its-defrule* "n" "(I](B") + (its-defrule "n'" "(I](B") + (its-defrule "N" "(I](B") (let ((small '"x" )) (its-defrule (concat small "a") "(I'(B") @@ -277,8 +274,7 @@ (define-its-state-machine-append its-han-kata-map (if its-han-kata-enable-double-n - (its-defrule "nn" "(I](B") - (its-defrule "nn" "(I](B" -1)) + (its-defrule "nn" "(I](B")) (its-defrule "-" its-han-kata-horizontal) (its-defrule "[" its-han-kata-open-bracket) diff --git a/its/hira.el b/its/hira.el index f899001..5efe895 100644 --- a/its/hira.el +++ b/its/hira.el @@ -50,7 +50,7 @@ (defvar its-hira-horizontal "$B!<(B" "*-") ; "$B!](B" (define-its-state-machine its-hira-map - "roma-kana" "$B$"(B" 'Japanese + "roma-kana" "$B$"(B" Japanese "Map for Romaji-Hiragana translation. (Japanese)" (defconst its-zenkaku-escape "Z") ;; Escape character to Zenkaku inputs @@ -72,12 +72,9 @@ (dolist (q1 '("b" "m" "p")) (its-defrule (concat "m" q1) "$B$s(B" -1)) - (its-defrule "N" "$B$s(B") - - (let ((state (its-goto-state "n" nil t))) - (its-make-next-state state -1 "n" "$B$s(B") - (its-make-next-state state ?' "n" "$B$s(B") - (its-defrule-otherwise state "$B$s(B")) + (its-defrule* "n" "$B$s(B") + (its-defrule "n'" "$B$s(B") + (its-defrule "N" "$B$s(B") (let ((small '"x" )) (its-defrule (concat small "a") "$B$!(B") @@ -440,8 +437,7 @@ (define-its-state-machine-append its-hira-map (if its-hira-enable-double-n - (its-defrule "nn" "$B$s(B") - (its-defrule "nn" "$B$s(B" -1)) + (its-defrule "nn" "$B$s(B")) (its-defrule "-" its-hira-horizontal) (its-defrule "[" its-hira-open-bracket) diff --git a/its/jeonkak.el b/its/jeonkak.el index e81fb7c..e93ce8e 100644 --- a/its/jeonkak.el +++ b/its/jeonkak.el @@ -35,7 +35,7 @@ (require 'its)) (define-its-state-machine its-jeonkak-up-map - "jeonkak-upcase" "$(C#A(B" 'Korean + "jeonkak-upcase" "$(C#A(B" Korean "Map for jeonkak-upcase input." (dolist (ascii '(("1" . "$(C#1(B") ("2" . "$(C#2(B") ("3" . "$(C#3(B") ("4" . "$(C#4(B") @@ -68,7 +68,7 @@ (its-defrule in out)))) (define-its-state-machine its-jeonkak-down-map - "jeonkak-downcase" "$(C#a(B" 'Korean + "jeonkak-downcase" "$(C#a(B" Korean "Map for jeonkak-downcase input." (dolist (ascii '(("1" . "$(C#1(B") ("2" . "$(C#2(B") ("3" . "$(C#3(B") ("4" . "$(C#4(B") diff --git a/its/kata.el b/its/kata.el index 9c11905..69ce3f6 100644 --- a/its/kata.el +++ b/its/kata.el @@ -50,7 +50,7 @@ (defvar its-kata-horizontal "$B!<(B" "*-") ; "$B!](B" (define-its-state-machine its-kata-map - "roma-kata" "$B%"(B" 'Japanese + "roma-kata" "$B%"(B" Japanese "Map for Romaji-Katakana translation. (Japanese)" (defconst its-zenkaku-escape "Z") ;; Escape character to Zenkaku inputs @@ -72,12 +72,9 @@ (dolist (q1 '("b" "m" "p")) (its-defrule (concat "m" q1) "$B%s(B" -1)) - (its-defrule "N" "$B%s(B") - - (let ((state (its-goto-state "n" nil t))) - (its-make-next-state state -1 "n" "$B%s(B") - (its-make-next-state state ?' "n" "$B%s(B") - (its-defrule-otherwise state "$B%s(B")) + (its-defrule* "n" "$B%s(B") + (its-defrule "n'" "$B%s(B") + (its-defrule "N" "$B%s(B") (let ((small '"x" )) (its-defrule (concat small "a") "$B%!(B") @@ -440,8 +437,7 @@ (define-its-state-machine-append its-kata-map (if its-kata-enable-double-n - (its-defrule "nn" "$B%s(B") - (its-defrule "nn" "$B%s(B" -1)) + (its-defrule "nn" "$B%s(B")) (its-defrule "-" its-kata-horizontal) (its-defrule "[" its-kata-open-bracket) diff --git a/its/pinyin.el b/its/pinyin.el index 887f7ca..c6ae5f6 100644 --- a/its/pinyin.el +++ b/its/pinyin.el @@ -41,61 +41,39 @@ (defvar its-pinyin-cn-open-braket "$A!8(B" "*[") ; "$A#[(B" (defvar its-pinyin-cn-close-braket "$A!9(B" "*]") ; "$A#](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 "$(G!V(B" "*[") ; "$(G!b(B " (defvar its-pinyin-tw-close-braket "$(G!W(B" "*]") ; "$(G!c(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) "(0@(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) @@ -109,15 +87,13 @@ (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) "(0@(B")) + (its-make-next-state state ?2 (concat cs (nth 2 ,yunmu) "(0@(B")) + (its-make-next-state state ?3 (concat cs (nth 3 ,yunmu) "(0@(B")) + (its-make-next-state state ?4 (concat cs (nth 4 ,yunmu) "(0@(B"))))) (defmacro its-define-pinyin-table () '(let ((- "") (B "b") (C "c") (D "d") (F "f") (G "g") (H "h") @@ -160,6 +136,17 @@ (UN '("un" "(01(Bn" "(02(Bn" "(03(Bn" "(04(Bn" "un" )) (UO '("uo" "u(0-(B" "u(0.(B" "u(0/(B" "u(00(B" "uo" ))) + (its-define-qingsheng "hm" "") + (its-define-qingsheng "hng" "") + (its-defrule* "m" "m(0@(B") + (its-defrule "m0" "m(0@(B") + (its-defrule* "n" "n(0@(B") + (its-defrule "n0" "n(0@(B") + (its-defrule "n2" "(0=@(B") + (its-defrule "n3" "(0>@(B") + (its-defrule "n4" "(0?@(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) @@ -205,20 +192,10 @@ ((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" "(0=@(B") - (its-defrule "n3" "(0>@(B") - (its-defrule "n4" "(0?@(B")))) + ((J Q X) (cons "ou" (cdr IU )))))))) (define-its-state-machine its-pinyin-cn-map - "pinyin-cn" "$AF4(BG" 'Chinese-GB + "pinyin-cn" "$AF4(BG" Chinese-GB "Map for Pinyin input. (Chinese-GB)" (defconst its-quanjiao-escape "Z") @@ -228,30 +205,30 @@ (its-defrule-select-mode-temporally "Q" quanjiao-downcase-cn) (its-define-pinyin-table) - (its-defoutput* "b " "$A2;(B") - (its-defoutput* "c " "$A2E(B") - (its-defoutput* "ch " "$A3v(B") - (its-defoutput* "d " "$A5D(B") - (its-defoutput* "f " "$A74(B") - (its-defoutput* "g " "$A8v(B") - (its-defoutput* "h " "$A:M(B") - (its-defoutput* "i " "$AR;(B") - (its-defoutput* "j " "$A>M(B") - (its-defoutput* "k " "$A?I(B") - (its-defoutput* "l " "$AAK(B") - (its-defoutput* "m " "$AC?(B") - (its-defoutput* "n " "$ADj(B") - (its-defoutput* "p " "$AEz(B") - (its-defoutput* "q " "$AH%(B") - (its-defoutput* "r " "$AHU(B") - (its-defoutput* "s " "$AJG(B") - (its-defoutput* "sh " "$AIO(B") - (its-defoutput* "t " "$AK{(B") - (its-defoutput* "w " "$ANR(B") - (its-defoutput* "x " "$AOr(B") - (its-defoutput* "y " "$ASV(B") - (its-defoutput* "z " "$ATZ(B") - (its-defoutput* "zh " "$AWE(B") + (its-defrule "b " "$A2;(B") + (its-defrule "c " "$A2E(B") + (its-defrule "ch " "$A3v(B") + (its-defrule "d " "$A5D(B") + (its-defrule "f " "$A74(B") + (its-defrule "g " "$A8v(B") + (its-defrule "h " "$A:M(B") + (its-defrule "i " "$AR;(B") + (its-defrule "j " "$A>M(B") + (its-defrule "k " "$A?I(B") + (its-defrule "l " "$AAK(B") + (its-defrule "m " "$AC?(B") + (its-defrule "n " "$ADj(B") + (its-defrule "p " "$AEz(B") + (its-defrule "q " "$AH%(B") + (its-defrule "r " "$AHU(B") + (its-defrule "s " "$AJG(B") + (its-defrule "sh " "$AIO(B") + (its-defrule "t " "$AK{(B") + (its-defrule "w " "$ANR(B") + (its-defrule "x " "$AOr(B") + (its-defrule "y " "$ASV(B") + (its-defrule "z " "$ATZ(B") + (its-defrule "zh " "$AWE(B") (dolist (ascii '(("0" . "$A#0(B") ("1" . "$A#1(B") ("2" . "$A#2(B") ("3" . "$A#3(B") ("4" . "$A#4(B") ("5" . "$A#5(B") ("6" . "$A#6(B") ("7" . "$A#7(B") @@ -292,7 +269,7 @@ (its-defrule "!" "$A#!(B")) (define-its-state-machine its-pinyin-tw-map - "pinyin-tw" "$(GQ;(BC" 'Chinese-CNS + "pinyin-tw" "$(GQ;(BC" Chinese-CNS "Map for Pinyin input." (defconst its-quanjiao-escape "Z") @@ -302,30 +279,30 @@ (its-defrule-select-mode-temporally "Q" quanjiao-downcase-tw) (its-define-pinyin-table) - (its-defoutput* "b " "$(GDb(B") - (its-defoutput* "c " "$(GD_(B") - (its-defoutput* "ch " "$(GEx(B") - (its-defoutput* "d " "$(GN{(B") - (its-defoutput* "f " "$(GE0(B") - (its-defoutput* "g " "$(GT6(B") - (its-defoutput* "h " "$(GLO(B") - (its-defoutput* "i " "$(GD!(B") - (its-defoutput* "j " "$(G^s(B") - (its-defoutput* "k " "$(GF+(B") - (its-defoutput* "l " "$(GD'(B") - (its-defoutput* "m " "$(GJd(B") - (its-defoutput* "n " "$(GH!(B") - (its-defoutput* "p " "$(GJG(B") - (its-defoutput* "q " "$(GF*(B") - (its-defoutput* "r " "$(GEJ(B") - (its-defoutput* "s " "$(GQR(B") - (its-defoutput* "sh " "$(GD8(B") - (its-defoutput* "t " "$(GEl(B") - (its-defoutput* "w " "$(GJ<(B") - (its-defoutput* "x " "$(GGW(B") - (its-defoutput* "y " "$(GD4(B") - (its-defoutput* "z " "$(GGc(B") - (its-defoutput* "zh " "$(Gaa(B") + (its-defrule "b " "$(GDb(B") + (its-defrule "c " "$(GD_(B") + (its-defrule "ch " "$(GEx(B") + (its-defrule "d " "$(GN{(B") + (its-defrule "f " "$(GE0(B") + (its-defrule "g " "$(GT6(B") + (its-defrule "h " "$(GLO(B") + (its-defrule "i " "$(GD!(B") + (its-defrule "j " "$(G^s(B") + (its-defrule "k " "$(GF+(B") + (its-defrule "l " "$(GD'(B") + (its-defrule "m " "$(GJd(B") + (its-defrule "n " "$(GH!(B") + (its-defrule "p " "$(GJG(B") + (its-defrule "q " "$(GF*(B") + (its-defrule "r " "$(GEJ(B") + (its-defrule "s " "$(GQR(B") + (its-defrule "sh " "$(GD8(B") + (its-defrule "t " "$(GEl(B") + (its-defrule "w " "$(GJ<(B") + (its-defrule "x " "$(GGW(B") + (its-defrule "y " "$(GD4(B") + (its-defrule "z " "$(GGc(B") + (its-defrule "zh " "$(Gaa(B") (dolist (ascii '(("0" . "$(G$!(B") ("1" . "$(G$"(B") ("2" . "$(G$#(B") ("3" . "$(G$$(B") ("4" . "$(G$%(B") ("5" . "$(G$&(B") ("6" . "$(G$'(B") ("7" . "$(G$((B") @@ -385,7 +362,7 @@ (its-defrule "=" "$A#=(B") (its-defrule "`" "$A#`(B") (its-defrule "\\" "$A#\(B") (its-defrule "|" "$A#|(B") (its-defrule "_" "$A#_(B") (its-defrule "+" "$A#+(B") - (its-defrule "{" "$(G!B(B") (its-defrule "}" "$(G!C(B") + (its-defrule "{" "$A#{(B") (its-defrule "}" "$A#}(B") (its-defrule "\"" "$A#"(B") (its-defrule "'" "$A#'(B") (its-defrule "<" "$A#<(B") (its-defrule ">" "$A#>(B")) (progn @@ -427,7 +404,7 @@ (its-defrule "=" "$(G"8(B") (its-defrule "`" "$(G!j(B") (its-defrule "\\" "$(G"b(B") (its-defrule "|" "$(G"^(B") (its-defrule "_" "$(G"%(B") (its-defrule "+" "$(G"0(B") - (its-defrule "{" "$A#{(B") (its-defrule "}" "$(G!a(B") + (its-defrule "{" "$(G!B(B") (its-defrule "}" "$(G!C(B") (its-defrule "\"" "$(G!i(B") (its-defrule "'" "$(G!k(B") (its-defrule "<" "$(G"6(B") (its-defrule ">" "$(G"7(B")) (progn diff --git a/its/quanjiao.el b/its/quanjiao.el index d23b881..936de40 100644 --- a/its/quanjiao.el +++ b/its/quanjiao.el @@ -35,7 +35,7 @@ (require 'its)) (define-its-state-machine its-quanjiao-up-cn-map - "quanjiao-upcase-cn" "$A#A(B" 'Chinese-GB + "quanjiao-upcase-cn" "$A#A(B" Chinese-GB "Map for quanjiao-upcase input. (Chinese-GB)" (dolist (ascii '(("0" . "$A#0(B") ("1" . "$A#1(B") ("2" . "$A#2(B") ("3" . "$A#3(B") @@ -68,7 +68,7 @@ (its-defrule in out)))) (define-its-state-machine its-quanjiao-down-cn-map - "quanjiao-downcase-cn" "$A#a(B" 'Chinese-GB + "quanjiao-downcase-cn" "$A#a(B" Chinese-GB "Map for quanjiao-downcase input. (Chinese-GB)" (dolist (ascii '(("0" . "$A#0(B") ("1" . "$A#1(B") ("2" . "$A#2(B") ("3" . "$A#3(B") @@ -101,7 +101,7 @@ (its-defrule in out)))) (define-its-state-machine its-quanjiao-up-tw-map - "quanjiao-upcase-tw" "$(G$A(B" 'Chinese-CNS + "quanjiao-upcase-tw" "$(G$A(B" Chinese-CNS "Map for quanjiao-upcase input. (Chinese-CNS)" (dolist (ascii '(("0" . "$(G$!(B") ("1" . "$(G$"(B") ("2" . "$(G$#(B") ("3" . "$(G$$(B") @@ -134,7 +134,7 @@ (its-defrule in out)))) (define-its-state-machine its-quanjiao-down-tw-map - "quanjiao-downcase-tw" "$(G$[(B" 'Chinese-CNS + "quanjiao-downcase-tw" "$(G$[(B" Chinese-CNS "Map for quanjiao-downcase input. (Chinese-CNS)" (dolist (ascii '(("0" . "$(G$!(B") ("1" . "$(G$"(B") ("2" . "$(G$#(B") ("3" . "$(G$$(B") diff --git a/its/thai.el b/its/thai.el index 3b41d18..10555ee 100644 --- a/its/thai.el +++ b/its/thai.el @@ -1,6 +1,6 @@ ;;; 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 @@ -45,52 +45,38 @@ 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" ",T!!(B" 'Thai + "kesmanee" ",T!!(B" Thai "Map for Thai Kesmanee input method with TIS620 keyboard. (Thai)" (define-its-thai-keymap diff --git a/its/zenkaku.el b/its/zenkaku.el index bfde649..71c4e79 100644 --- a/its/zenkaku.el +++ b/its/zenkaku.el @@ -35,7 +35,7 @@ (require 'its)) (define-its-state-machine its-zenkaku-up-map - "zenkaku-upcase" "$B#A(B" 'Japanese + "zenkaku-upcase" "$B#A(B" Japanese "Map for zenkaku-upcase input." (dolist (ascii '(("0" . "$B#0(B") ("1" . "$B#1(B") ("2" . "$B#2(B") ("3" . "$B#3(B") @@ -68,7 +68,7 @@ (its-defrule in out)))) (define-its-state-machine its-zenkaku-down-map - "zenkaku-downcase" "$B#a(B" 'Japanese + "zenkaku-downcase" "$B#a(B" Japanese "Map for zenkaku-downcase input." (dolist (ascii '(("0" . "$B#0(B") ("1" . "$B#1(B") ("2" . "$B#2(B") ("3" . "$B#3(B") diff --git a/its/zhuyin.el b/its/zhuyin.el index ff7213f..7357dac 100644 --- a/its/zhuyin.el +++ b/its/zhuyin.el @@ -56,33 +56,24 @@ ,@(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 "(0A(B" "(0@(B")) + (tone (if ,qingsheng "(0A(B" "(0@(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 "(0A(B")) - (its-make-next-state state ?2 (concat in 2) (concat out "(0B(B")) - (its-make-next-state state ?3 (concat in 3) (concat out "(0C(B")) - (its-make-next-state state ?4 (concat in 4) (concat out "(0D(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 "(0A(B")) + (its-make-next-state state ?2 (concat out "(0B(B")) + (its-make-next-state state ?3 (concat out "(0C(B")) + (its-make-next-state state ?4 (concat out "(0D(B"))))))) (defmacro its-define-zhuyin-table () '(let ((- '("" "")) @@ -99,11 +90,13 @@ (ER '("^" "(0f(B")) (OU '("y" "(0a(B")) (I '("e" "(0g(B")) (U '("x" "(0h(B")) (V '("u" "(0i(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) @@ -115,7 +108,6 @@ ((- 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) @@ -139,18 +131,17 @@ ((- 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) "(0B(B")) - (its-defrule (concat (car N) 3) (concat (nth 1 N) "(0C(B")) - (its-defrule (concat (car N) 4) (concat (nth 1 N) "(0D(B"))))) + (its-defrule (concat (car N) 2) (concat (nth 1 N) "(0B(B")) + (its-defrule (concat (car N) 3) (concat (nth 1 N) "(0C(B")) + (its-defrule (concat (car N) 4) (concat (nth 1 N) "(0D(B"))))) (define-its-state-machine its-zhuyin-cn-map - "zhuyin-cn" "$AW"(BG" 'Chinese-GB + "zhuyin-cn" "$AW"(BG" Chinese-GB "Map for Zhuyin input. (Chinese-GB)" (defconst its-quanjiao-escape "Z") @@ -195,7 +186,7 @@ (its-defrule "?" "$A!"(B")) (define-its-state-machine its-zhuyin-tw-map - "zhuyin-tw" "$(GNC(BC" 'Chinese-CNS + "zhuyin-tw" "$(GNC(BC" Chinese-CNS "Map for Zhuyin input." (defconst its-quanjiao-escape "Z") @@ -251,9 +242,9 @@ (its-defrule "(" "$A#((B") (its-defrule ")" "$A#)(B") (its-defrule "~" "$A!+(B") (its-defrule "=" "$A#=(B") (its-defrule "`" "$A#`(B") - (its-defrule "\\" "$(G"`(B") (its-defrule "|" "$A#|(B") + (its-defrule "\\" "$A#\(B") (its-defrule "|" "$A#|(B") (its-defrule "_" "$A#_(B") (its-defrule "+" "$A#+(B") - (its-defrule "{" "$(G!B(B") (its-defrule "}" "$(G!C(B") + (its-defrule "{" "$A#{(B") (its-defrule "}" "$A#}(B") (its-defrule "\"" "$A#"(B") (its-defrule "'" "$A#'(B")) (progn (its-defrule "#" "#") (its-defrule "$" "$") @@ -279,9 +270,9 @@ (its-defrule "(" "$(G!>(B") (its-defrule ")" "$(G!?(B") (its-defrule "~" "$(G"D(B") (its-defrule "=" "$(G"8(B") (its-defrule "`" "$(G!j(B") - (its-defrule "\\" "$(G"b(B") (its-defrule "|" "$(G"^(B") + (its-defrule "\\" "$(G"`(B") (its-defrule "|" "$(G"^(B") (its-defrule "_" "$(G"%(B") (its-defrule "+" "$(G"0(B") - (its-defrule "{" "$A#{(B") (its-defrule "}" "$(G!a(B") + (its-defrule "{" "$(G!B(B") (its-defrule "}" "$(G!C(B") (its-defrule "\"" "$(G!i(B") (its-defrule "'" "$(G!k(B")) (progn (its-defrule "#" "#") (its-defrule "$" "$") -- 1.7.10.4