From: kate Date: Sat, 14 Mar 1998 09:36:41 +0000 (+0000) Subject: 980314 version X-Git-Tag: egg-980304~2^2~1 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efad2997c240e23522ab1a4c94e400420738b1e4;p=elisp%2Fegg.git 980314 version --- diff --git a/egg-cnv.el b/egg-cnv.el index 92c7593..b85cd04 100644 --- a/egg-cnv.el +++ b/egg-cnv.el @@ -31,16 +31,68 @@ ;;; Code: +(defvar egg-current-language) +(make-variable-buffer-local 'egg-current-language) +(put 'egg-current-language 'permanent-local t) + (defsubst egg-bunsetsu-info () 'intangible) (defun egg-get-bunsetsu-info (p) - (let ((info (get-text-property p (egg-bunsetsu-info)))) - (cond - ((consp info) - (setq egg-conversion-backend (car info)) - (cdr info))))) + (let ((bunsetsu-info (get-text-property p (egg-bunsetsu-info)))) + (if bunsetsu-info + (setq egg-conversion-backend (get-text-property p 'egg-backend) + egg-current-language (get-text-property p 'egg-lang))) + bunsetsu-info)) ;; +(defconst egg-conversion-backend-other-languages + [ egg-init-other-languages + + egg-start-conversion-other-languages + egg-get-bunsetsu-converted-other-languages + egg-get-bunsetsu-source-other-languages + egg-list-candidates-other-languages + egg-get-number-of-candidates-other-languages + egg-get-current-candidate-number-other-languages + egg-get-all-candidates-other-languages + egg-decide-candidate-other-languages + egg-change-bunsetsu-length-other-languages + egg-end-conversion-other-languages + nil + + egg-fini-other-languages + ]) + +(defun egg-init-other-languages () + ) + +(defun egg-start-conversion-other-languages (yomi-string language) + (list yomi-string)) +(defun egg-get-bunsetsu-converted-other-languages (bunsetsu-info) + bunsetsu-info) +(defun egg-get-bunsetsu-source-other-languages (bunsetsu-info) + bunsetsu-info) +(defun egg-list-candidates-other-languages (bunsetsu-info prev-bunsetsu-info) + 1) +(defun egg-get-number-of-candidates-other-languages (bunsetsu-info) + 1) +(defun egg-get-current-candidate-number-other-languages (bunsetsu-info) + 0) +(defun egg-get-all-candidates-other-languages (bunsetsu-info) + (list bunsetsu-info)) +(defun egg-decide-candidate-other-languages (bunsetsu-info candidate-pos) + bunsetsu-info) +(defun egg-change-bunsetsu-length-other-languages (b0 b1 b2 len) + (let ((s (concat b1 b2))) + (set-text-properties 0 (length s) nil s) + (if (= len (length s)) + (list s) + (list (substring s 0 len) (substring s len))))) +(defun egg-end-conversion-other-languages (bunsetsu-info-list) + nil) +(defun egg-fini-other-languages (language) + nil) + (defvar egg-conversion-backend-alist nil) (make-variable-buffer-local 'egg-conversion-backend-alist) (defvar egg-conversion-backend nil) @@ -49,10 +101,10 @@ (defvar egg-finalize-backend-alist nil) (defun egg-set-current-backend (language) - (let ((backend (assoc lang egg-conversion-backend-alist))) - (if (null backend) - (error "%S is not supported" lang) - (setq egg-conversion-backend (cdr backend))))) + (setq egg-conversion-backend + (cdr (assoc language egg-conversion-backend-alist))) + (if (null egg-conversion-backend) + (setq egg-conversion-backend egg-conversion-backend-other-languages))) (defun egg-initialize-backend (language) (egg-set-current-backend language) @@ -79,6 +131,11 @@ (funcall (aref egg-conversion-backend 9) b0 b1 b2 len)) (defun egg-end-conversion (bunsetsu-info-list) (funcall (aref egg-conversion-backend 10) bunsetsu-info-list)) +(defun egg-start-reverse-conversion (yomi-string language) + (egg-set-current-backend language) + (if (aref egg-conversion-backend 11) + (funcall (aref egg-conversion-backend 11) yomi-string language) + (beep))) (defun egg-finalize-backend () (let ((alist egg-finalize-backend-alist)) @@ -86,97 +143,136 @@ (funcall (car (car (car alist))) (cdr (car (car alist)))) (setq alist (cdr alist))))) -(defmacro egg-set-conversion-backend-internal (backend langs &optional force) - `(let ((l ,langs) pair) - (while l - (setq pair (assoc (car l) egg-conversion-backend-alist)) - (if (null pair) - (setq egg-conversion-backend-alist - (cons (cons (car l) ,backend) - egg-conversion-backend-alist)) - ,(if force `(setcdr pair ,backend))) - (setq pair (cons (aref ,backend 11) (car l))) - (if (null (assoc pair egg-finalize-backend-alist)) - (setq egg-finalize-backend-alist - (cons (list pair) egg-finalize-backend-alist))) - (setq l (cdr l))))) - -(defun egg-set-conversion-backend (backend curent-langs other-langs) - (egg-set-conversion-backend-internal backend curent-langs t) - (egg-set-conversion-backend-internal backend other-langs)) +(defun egg-set-conversion-backend (backend langs &optional force) + (let (pair) + (if backend + (setq egg-conversion-backend backend) + (setq backend egg-conversion-backend)) + (while langs + (setq pair (assoc (car langs) egg-conversion-backend-alist)) + (cond + ((null pair) + (setq egg-conversion-backend-alist + (cons (cons (car langs) backend) egg-conversion-backend-alist))) + (force + (setcdr pair backend))) + (setq pair (cons (aref backend (1- (length backend))) (car langs))) + (if (null (assoc pair egg-finalize-backend-alist)) + (setq egg-finalize-backend-alist + (cons (list pair) egg-finalize-backend-alist))) + (setq langs (cdr langs))))) -(defvar egg-conversion-open "|") -(defvar egg-conversion-close "|") +(defvar egg-conversion-open "|" "*$B%U%'%s%9$N;OE@$r<($9J8;zNs(B (1 $BJ8;z0J>e(B)") +(defvar egg-conversion-close "|" "*$B%U%'%s%9$N=*E@$r<($9J8;zNs(B (1 $BJ8;z0J>e(B)") +(defvar egg-conversion-face nil "*$B%U%'%s%9I=<($KMQ$$$k(B face $B$^$?$O(B nil") (defvar egg-conversion-separator " ") +(defun egg-get-conversion-face () + (let ((face (and (listp egg-conversion-face) + (or (assoc egg-current-language egg-conversion-face) + (assoc t egg-conversion-face))))) + (if face (cdr face) egg-conversion-face))) + ;; (defun egg-convert-region (start end) (interactive "r") - (let (bunsetsu-info-list lang contin p s e) - (save-restriction - (narrow-to-region start end) - (goto-char start) - (insert egg-conversion-open) - (add-text-properties start (point) + (if (>= start end) + ;; nothing to do + nil + (remove-text-properties start end '(read-only nil intangible nil)) + (goto-char start) + (insert egg-conversion-open) + (let ((inhibit-read-only t) + (max (make-marker)) + bunsetsu-info-list contin p s e result) + (setq p (+ (point) (- end start))) + (set-text-properties start (point) (list + 'read-only t 'egg-start t - 'egg-source (buffer-substring (point) - (point-max)))) + 'egg-source (buffer-substring (point) p))) (if egg-conversion-face - (put-text-property start (point) 'invisible t)) + (put-text-property start (point) 'invisible t)) (setq start (point)) - (egg-separate-languages start (point-max)) + (goto-char p) + (insert egg-conversion-close) + (set-text-properties p (point) '(read-only t rear-nonsticky t egg-end t)) + (if egg-conversion-face + (put-text-property p (point) 'invisible t)) + (set-marker max p) + (egg-separate-languages start max) (goto-char start) - (while (< (point) (point-max)) - (setq lang (get-text-property (point) 'egg-lang) + (while (< (point) max) + (setq egg-current-language (get-text-property (point) 'egg-lang) s (point) e (point)) - (while (and (< e (point-max)) - (equal lang (get-text-property e 'egg-lang))) - (setq e (next-single-property-change e 'egg-lang nil (point-max)))) - (setq bunsetsu-info-list - (egg-start-conversion (buffer-substring s e) lang)) - (setq contin (< e (point-max))) + (while (and (< e max) + (equal egg-current-language + (get-text-property e 'egg-lang))) + (setq e (next-single-property-change e 'egg-lang nil max))) + (condition-case result + (setq bunsetsu-info-list + (egg-start-conversion + (buffer-substring-no-properties s e) + egg-current-language)) + (error + (setq egg-conversion-backend egg-conversion-backend-other-languages + bunsetsu-info-list (egg-start-conversion-other-languages + (buffer-substring-no-properties s e) + egg-current-language)) + (message "egg %s backend: %s" egg-current-language (cadr result)))) + (setq contin (< e max)) (delete-region s e) (egg-insert-bunsetsu-list bunsetsu-info-list - (if (< (point) (point-max)) 'contine t)))) - (setq p (point)) - (insert egg-conversion-close) - (put-text-property p (point) 'egg-end t) - (if egg-conversion-face - (put-text-property p (point) 'invisible t)) - (goto-char start))) + (if (< (point) max) 'contine t))) + (set-marker max nil) + (goto-char start)))) -(defun egg-separate-languages (start end) - (let (lang last-lang last-chinese p l c cset) +(defun egg-separate-languages (start end &optional use-context) + (let (lang last-lang last-chinese p pe l c cset) ;; 1st pass -- mark undefined Chinese part (goto-char start) + (and use-context + (setq last-lang (get-text-property (1- (point)) 'egg-lang)) + (or (equal last-lang "Chinese-GB") (equal last-lang "Chinese-CNS")) + (setq last-chinese last-lang)) (while (< (point) end) - (setq p (next-single-property-change (point) 'its-lang nil end)) + (setq p (point) + pe (next-single-property-change (point) 'egg-lang nil end)) (cond - ((get-text-property (point) 'its-lang) - (goto-char p)) - ((setq l (egg-chinese-syllable (buffer-substring (point) p))) - (setq p (point)) - (goto-char (+ (point) l)) - (put-text-property p (point) 'its-lang "Chinese")) + ((get-text-property (point) 'egg-lang) + (goto-char pe) + (setq lang nil)) + ((setq l (egg-chinese-syllable (buffer-substring p pe))) + (goto-char (+ p l)) + (setq lang "Chinese")) ((progn (setq c (following-char) cset (char-charset c)) (eq cset 'chinese-sisheng)) - (setq p (point)) (forward-char) - (put-text-property p (point) 'its-lang "Chinese")) + (setq lang "Chinese")) ((eq cset 'ascii) - (forward-char)) - (t - (setq p (point)) + (skip-chars-forward "\0-\177" pe) + (if (eq (char-charset (following-char)) 'chinese-sisheng) + (goto-char (max (1+ pp) (- (point) 6)))) + (setq lang nil)) + ((eq cset 'composition) (forward-char) - (put-text-property p (point) 'its-lang (egg-char-to-language c))))) + (setq lang (egg-charset-to-language + (char-charset (car (decompose-composite-char c 'list)))))) + (t + (skip-chars-forward (concat (vector (make-char cset 33 33)) + "-" + (vector (make-char cset 127 127))) + pe) + (setq lang (egg-charset-to-language cset)))) + (if lang + (put-text-property p (point) 'egg-lang lang))) ;; 2nd pass -- set language property (goto-char start) (while (< (point) end) - (setq lang (get-text-property (point) 'its-lang)) + (setq lang (get-text-property (point) 'egg-lang)) (cond ((null lang) (setq lang (or last-lang @@ -188,20 +284,19 @@ (if (or (equal lang "Chinese-GB") (equal lang "Chinese-CNS")) (setq last-chinese lang)) (setq p (point)) - (goto-char (next-single-property-change (point) 'its-lang nil end)) + (goto-char (next-single-property-change (point) 'egg-lang nil end)) (set-text-properties p (point) (list 'egg-lang lang))))) -(defun egg-char-to-language (c) - (let ((charset (char-charset c)) - (list language-info-alist)) +(defun egg-charset-to-language (charset) + (let ((list language-info-alist)) (while (and list (null (memq charset (assq 'charset (car list))))) (setq list (cdr list))) (car (car list)))) (defun egg-next-part-lang (end) - (let* ((p (next-single-property-change (point) 'its-lang nil end)) - (lang (get-text-property p 'its-lang))) + (let* ((p (next-single-property-change (point) 'egg-lang nil end)) + (lang (get-text-property p 'egg-lang))) (if (equal lang "Chinese") (egg-next-chinese-lang end) (or lang @@ -212,8 +307,8 @@ (let (p lang) (setq p (point)) (while (and (< p end) (null lang)) - (setq p (next-single-property-change p 'its-lang nil end)) - (setq lang (get-text-property p 'its-lang)) + (setq p (next-single-property-change p 'egg-lang nil end)) + (setq lang (get-text-property p 'egg-lang)) (if (null (or (equal lang "Chinese-GB") (equal lang "Chinese-CNS"))) (setq lang nil))) @@ -227,7 +322,8 @@ egg-default-language) (t "Chinese-GB")))) -(defvar egg-conversion-face nil) +(require 'its-keydef) + (defvar egg-conversion-map (let ((map (make-sparse-keymap)) (i 33)) @@ -249,13 +345,14 @@ (define-key map "\C-n" 'egg-next-candidate) (define-key map "\C-o" 'egg-enlarge-bunsetsu) (define-key map "\C-p" 'egg-previous-candidate) + (define-key map "\C-r" 'egg-reverse-convert-bunsetu) + (define-key map "\M-r" 'egg-reconvert-bunsetsu) (define-key map "\M-s" 'egg-select-candidate) (define-key map [return] 'egg-exit-conversion) -;; (define-key map "\C-\\" 'egg-exit-mode-no-egg) (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) + (its-define-select-keys map) map) "Keymap for EGG Conversion mode.") @@ -266,26 +363,46 @@ (defun egg-insert-bunsetsu (bunsetsu-info last) (let ((bunsetsu (egg-get-bunsetsu-converted bunsetsu-info)) - (p (point))) + (p (point)) p1) (insert bunsetsu) + (setq p1 (point)) (if (null (eq last t)) (insert egg-conversion-separator)) - (add-text-properties p (point) - (list 'face egg-conversion-face - 'local-map egg-conversion-map - (egg-bunsetsu-info) (cons egg-conversion-backend - bunsetsu-info) - 'egg-bunsetsu-last last)))) + (set-text-properties p (point) + (list 'read-only t + (egg-bunsetsu-info) bunsetsu-info + 'egg-backend egg-conversion-backend + 'egg-lang egg-current-language + 'egg-bunsetsu-last last + 'local-map egg-conversion-map)) + (if egg-conversion-face + (put-text-property p p1 'face (egg-get-conversion-face))))) (defun egg-insert-bunsetsu-list (bunsetsu-info-list &optional last) (let ((l bunsetsu-info-list) - bunsetsu-info bunsetsu p) + bunsetsu-info) (while l (setq bunsetsu-info (car l) - l (cdr l) - p (point)) + l (cdr l)) (egg-insert-bunsetsu bunsetsu-info (and (null l) last))))) +(defun egg-beginning-of-conversion-buffer (n) + (interactive "p") + (cond + ((<= n 0) + (egg-end-of-conversion-buffer 1)) + ((null (get-text-property (1- (point)) 'egg-start)) + (goto-char (previous-single-property-change (1- (point)) 'egg-start))))) + +(defun egg-end-of-conversion-buffer(n) + (interactive "p") + (cond + ((<= n 0) + (egg-beginning-of-conversion-buffer 1)) + (t + (goto-char (next-single-property-change (point) 'egg-end)) + (backward-char)))) + (defun egg-backward-bunsetsu (n) (interactive "p") (let (start) @@ -331,7 +448,8 @@ (defun egg-enlarge-bunsetsu (n) (interactive "p") - (let* ((b0 (egg-get-previous-bunsetsu (point))) + (let* ((inhibit-read-only t) + (b0 (egg-get-previous-bunsetsu (point))) (b1 (egg-get-bunsetsu-info (point))) (s1 (egg-get-bunsetsu-source b1)) (s1len (egg-separate-characters s1)) @@ -370,7 +488,8 @@ (defun egg-next-candidate (n) (interactive "p") - (let ((last (get-text-property (point) 'egg-bunsetsu-last)) + (let ((inhibit-read-only t) + (last (get-text-property (point) 'egg-bunsetsu-last)) (b (egg-get-bunsetsu-info (point))) new i max+ p beep) (setq max+ (egg-get-number-of-candidates b)) @@ -383,17 +502,19 @@ (setq max+ (egg-get-number-of-candidates b))) (setq i (egg-get-current-candidate-number b)) (setq i (+ n i))) - (if (< i 0) ; go backward as if it is ring - (while (< i 0) - (setq i (+ i max+)))) - (if (>= i max+) ; don't go forward - (setq i (1- max+) - beep t)) - (setq new (egg-decide-candidate b i)) - (setq p (point)) - (delete-region p (progn (forward-char) (point))) - (egg-insert-bunsetsu new last) - (goto-char p) + (if (null max+) + (setq beep t) + (if (< i 0) ; go backward as if it is ring + (while (< i 0) + (setq i (+ i max+)))) + (if (>= i max+) ; don't go forward + (setq i (1- max+) + beep t)) + (setq new (egg-decide-candidate b i)) + (setq p (point)) + (delete-region p (progn (forward-char) (point))) + (egg-insert-bunsetsu new last) + (goto-char p)) (if beep (ding)))) @@ -401,73 +522,83 @@ (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) - (setq p (point)) - (while in-loop - (let ((bl1 (cons (egg-get-bunsetsu-info p) nil))) - (if bl - (setq bl (setcdr bl bl1)) - (setq bunsetsu-info-list (setq bl bl1)))) - (forward-char) - (remove-text-properties p (point) '(face nil - intangible nil - local-map nil - egg-bunsetsu-last nil)) - (setq p (point)) - (if (or (and end-marker (= p end-marker)) - (get-text-property p 'egg-end)) - (setq in-loop nil) - (setq p (1- p)) - (delete-region p (1+ p)))) ; Delete bunsetsu separator - bunsetsu-info-list)) +(defun egg-reconvert-bunsetsu-internal (n func) + (let ((inhibit-read-only t) + (p (point)) + source last bunsetsu-list) + (if (<= n 0) + (beep) + (while (and (null last) (> n 0)) + (setq source (concat source + (egg-get-bunsetsu-converted + (egg-get-bunsetsu-info (point)))) + last (get-text-property (point) 'egg-bunsetsu-last) + n (1- n)) + (forward-char)) + (cond + ((> n 0) + (beep)) + ((setq bunsetsu-list (funcall func source egg-current-language)) + (delete-region p (point)) + (egg-insert-bunsetsu-list bunsetsu-list (if (eq last t) t 'contine)) + (goto-char p) + (if (egg-get-previous-bunsetsu p) + (progn + (backward-char) + (put-text-property (point) p 'egg-bunsetsu-last 'contine) + (forward-char)))))))) + +(defun egg-reverse-convert-bunsetu (n) + (interactive "p") + (egg-reconvert-bunsetsu-internal n 'egg-start-reverse-conversion)) + +(defun egg-reconvert-bunsetsu (n) + (interactive "p") + (egg-reconvert-bunsetsu-internal n 'egg-start-conversion)) (defun egg-decide-before-point () (interactive) - (let (bunsetsu-list bl (p (point)) source (dlen 0) l s) + (let ((inhibit-read-only t) + (len (length egg-conversion-open)) + bunsetsu-list bl (p (point)) source lang 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)) + (narrow-to-region (- (point) len) p) (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))))) + (delete-region (- (point) len) (point)) + (setq len 1 + bl (setcdr bl (list (egg-get-bunsetsu-info (point))))) (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)))) + (set-text-properties p (point) nil))) + (if (cdr bunsetsu-list) + (egg-end-conversion (cdr bunsetsu-list))) (if (get-text-property (point) 'egg-end) (progn ;; delete close marker - (delete-region (point) (1+ (point))) + (delete-region (point) (+ (point) (length egg-conversion-close))) (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))))) + ;; delete from last speparater + (delete-region (1- (point)) (point)) + (setq source "") + (while (null (get-text-property (point) 'egg-end)) + (setq s (egg-get-bunsetsu-source (egg-get-bunsetsu-info (point)))) + (put-text-property 0 (length s) 'egg-lang egg-current-language s) + (setq source (concat source s)) + (setq p (point)) + (forward-char) + (delete-region p (point))) + ;; delete close marker + (delete-region (point) (+ (point) (length egg-conversion-close))) + (its-restart source t)))) (defun egg-exit-conversion () (interactive) @@ -476,13 +607,20 @@ (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)) + (let ((inhibit-read-only t) source) + (goto-char (- (if (get-text-property (1- (point)) 'egg-start) + (point) + (previous-single-property-change (point) 'egg-start)) + (length egg-conversion-open))) + (setq source (get-text-property (point) 'egg-source)) + (delete-region (point) (+ (next-single-property-change (point) 'egg-end) + (length egg-conversion-close))) + (its-restart source))) (defun egg-select-candidate () (interactive) - (let ((last (get-text-property (point) 'egg-bunsetsu-last)) + (let ((inhibit-read-only t) + (last (get-text-property (point) 'egg-bunsetsu-last)) (b (egg-get-bunsetsu-info (point))) (in-loop t) new i max+ p) @@ -492,20 +630,27 @@ (setq i (egg-list-candidates b prev-b)) (setq max+ (egg-get-number-of-candidates b))) (setq i (egg-get-current-candidate-number b))) - (let* ((candidate-list (egg-get-all-candidates b)) - (l candidate-list) - (candidate (menudiag-select (list 'menu "$B8uJd(B:" l) (list (nth i l))))) - (setq i 0) - (while in-loop - (if (eq candidate (car l)) - (setq in-loop nil) - (setq l (cdr l) - i (1+ i)))) - (setq new (egg-decide-candidate b i)) - (setq p (point)) - (delete-region p (progn (forward-char) (point))) - (egg-insert-bunsetsu new last) - (goto-char p)))) + (let (candidate-list candidate l) + (if (null max+) + ;; fake 1 candidate + (menudiag-select (list 'menu "$B8uJd(B:" + (list (egg-get-bunsetsu-converted b)) + (list (egg-get-bunsetsu-converted b)))) + (setq candidate-list (egg-get-all-candidates b) + l candidate-list + candidate (menudiag-select (list 'menu "$B8uJd(B:" l) + (list (nth i l)))) + (setq i 0) + (while in-loop + (if (eq candidate (car l)) + (setq in-loop nil) + (setq l (cdr l) + i (1+ i)))) + (setq new (egg-decide-candidate b i)) + (setq p (point)) + (delete-region p (progn (forward-char) (point))) + (egg-insert-bunsetsu new last) + (goto-char p))))) (provide 'egg-cnv) ;;; egg-cnv.el ends here. diff --git a/egg-com.el b/egg-com.el index a15ba79..d9a97fe 100644 --- a/egg-com.el +++ b/egg-com.el @@ -149,45 +149,45 @@ ("X" . 20) ("Y" . 21) ("Z" . 22) ("Zh" . 23))) (defconst yincode-pinyin-yunmu - '(("š À" 0 0) ("š À" 0 1) ("š À" 0 3) ("š À" 0 5) ("š À" 0 7) - ("aš À" 1 0) ("š ¡š À" 1 1) ("š ¢š À" 1 3) ("š £š À" 1 5) ("š ¤š À" 1 7) - ("aiš À" 2 0) ("š ¡iš À" 2 1) ("š ¢iš À" 2 3) ("š £iš À" 2 5) ("š ¤iš À" 2 7) - ("anš À" 3 0) ("š ¡nš À" 3 1) ("š ¢nš À" 3 3) ("š £nš À" 3 5) ("š ¤nš À" 3 7) - ("angš À" 4 0) ("š ¡ngš À" 4 1) ("š ¢ngš À" 4 3) ("š £ngš À" 4 5) ("š ¤ngš À" 4 7) - ("aoš À" 5 0) ("š ¡oš À" 5 1) ("š ¢oš À" 5 3) ("š £oš À" 5 5) ("š ¤oš À" 5 7) - ("eš À" 6 0) ("š ¥š À" 6 1) ("š ¦š À" 6 3) ("š §š À" 6 5) ("š ¨š À" 6 7) - ("eiš À" 7 0) ("š ¥iš À" 7 1) ("š ¦iš À" 7 3) ("š §iš À" 7 5) ("š ¨iš À" 7 7) - ("enš À" 8 0) ("š ¥nš À" 8 1) ("š ¦nš À" 8 3) ("š §nš À" 8 5) ("š ¨nš À" 8 7) - ("engš À" 9 0) ("š ¥ngš À" 9 1) ("š ¦ngš À" 9 3) ("š §ngš À" 9 5) ("š ¨ngš À" 9 7) - ("erš À" 10 0) ("š ¥rš À" 10 1) ("š ¦rš À" 10 3) ("š §rš À" 10 5) ("š ¨rš À" 10 7) - ("iš À" 11 0) ("š ©š À" 11 1) ("š ªš À" 11 3) ("š «š À" 11 5) ("š ¬š À" 11 7) - ("iaš À" 12 0) ("iš ¡š À" 12 1) ("iš ¢š À" 12 3) ("iš £š À" 12 5) ("iš ¤š À" 12 7) - ("ianš À" 13 0) ("iš ¡nš À" 13 1) ("iš ¢nš À" 13 3) ("iš £nš À" 13 5) ("iš ¤nš À" 13 7) - ("iangš À" 14 0) ("iš ¡ngš À" 14 1) ("iš ¢ngš À" 14 3) ("iš £ngš À" 14 5) ("iš ¤ngš À" 14 7) - ("iaoš À" 15 0) ("iš ¡oš À" 15 1) ("iš ¢oš À" 15 3) ("iš £oš À" 15 5) ("iš ¤oš À" 15 7) - ("ieš À" 16 0) ("iš ¥š À" 16 1) ("iš ¦š À" 16 3) ("iš §š À" 16 5) ("iš ¨š À" 16 7) - ("inš À" 17 0) ("š ©nš À" 17 1) ("š ªnš À" 17 3) ("š «nš À" 17 5) ("š ¬nš À" 17 7) - ("ingš À" 18 0) ("š ©ngš À" 18 1) ("š ªngš À" 18 3) ("š «ngš À" 18 5) ("š ¬ngš À" 18 7) - ("iongš À" 19 0) ("iš ­ngš À" 19 1) ("iš ®ngš À" 19 3) ("iš ¯ngš À" 19 5) ("iš °ngš À" 19 7) - ("iuš À" 20 0) ("iš ±š À" 20 1) ("iš ²š À" 20 3) ("iš ³š À" 20 5) ("iš ´š À" 20 7) - ("mš À" 21 0) ("mš À" 21 1) ("mš À" 21 3) ("mš À" 21 5) ("mš À" 21 7) - ("nš À" 22 0) ("nš À" 22 1) ("š ½š À" 22 3) ("š ¾š À" 22 5) ("š ¿š À" 22 7) - ("ngš À" 23 0) ("ngš À" 23 1) ("ngš À" 23 3) ("ngš À" 23 5) ("ngš À" 23 7) - ("oš À" 24 0) ("š ­š À" 24 1) ("š ®š À" 24 3) ("š ¯š À" 24 5) ("š °š À" 24 7) - ("ongš À" 25 0) ("š ­ngš À" 25 1) ("š ®ngš À" 25 3) ("š ¯ngš À" 25 5) ("š °ngš À" 25 7) - ("ouš À" 26 0) ("š ­uš À" 26 1) ("š ®uš À" 26 3) ("š ¯uš À" 26 5) ("š °uš À" 26 7) - ("uš À" 27 0) ("š ±š À" 27 1) ("š ²š À" 27 3) ("š ³š À" 27 5) ("š ´š À" 27 7) - ("uaš À" 28 0) ("uš ¡š À" 28 1) ("uš ¢š À" 28 3) ("uš £š À" 28 5) ("uš ¤š À" 28 7) - ("uaiš À" 29 0) ("uš ¡iš À" 29 1) ("uš ¢iš À" 29 3) ("uš £iš À" 29 5) ("uš ¤iš À" 29 7) - ("uanš À" 30 0) ("uš ¡nš À" 30 1) ("uš ¢nš À" 30 3) ("uš £nš À" 30 5) ("uš ¤nš À" 30 7) - ("uangš À" 31 0) ("uš ¡ngš À" 31 1) ("uš ¢ngš À" 31 3) ("uš £ngš À" 31 5) ("uš ¤ngš À" 31 7) - ("ueš À" 32 0) ("uš ¥š À" 32 1) ("uš ¦š À" 32 3) ("uš §š À" 32 5) ("uš ¨š À" 32 7) - ("uiš À" 33 0) ("uš ©š À" 33 1) ("uš ªš À" 33 3) ("uš «š À" 33 5) ("uš ¬š À" 33 7) - ("unš À" 34 0) ("š ±nš À" 34 1) ("š ²nš À" 34 3) ("š ³nš À" 34 5) ("š ´nš À" 34 7) - ("uoš À" 35 0) ("uš ­š À" 35 1) ("uš ®š À" 35 3) ("uš ¯š À" 35 5) ("uš °š À" 35 7) - ("š ¹š À" 36 0) ("š µš À" 36 1) ("š ¶š À" 36 3) ("š ·š À" 36 5) ("š ¸š À" 36 7) - ("š ¹eš À" 37 0) ("š ¹š ¥š À" 37 1) ("š ¹š ¦š À" 37 3) ("š ¹š §š À" 37 5) ("š ¹š ¨š À" 37 7) - ("0š À" 38 0) ("1š À" 38 1) ("2š À" 38 3) ("3š À" 38 5) ("4š À" 38 7))) + '(("(0@(B" 0 0) ("(0@(B" 0 1) ("(0@(B" 0 3) ("(0@(B" 0 5) ("(0@(B" 0 7) + ("a(0@(B" 1 0) ("(0!@(B" 1 1) ("(0"@(B" 1 3) ("(0#@(B" 1 5) ("(0$@(B" 1 7) + ("ai(0@(B" 2 0) ("(0!(Bi(0@(B" 2 1) ("(0"(Bi(0@(B" 2 3) ("(0#(Bi(0@(B" 2 5) ("(0$(Bi(0@(B" 2 7) + ("an(0@(B" 3 0) ("(0!(Bn(0@(B" 3 1) ("(0"(Bn(0@(B" 3 3) ("(0#(Bn(0@(B" 3 5) ("(0$(Bn(0@(B" 3 7) + ("ang(0@(B" 4 0) ("(0!(Bng(0@(B" 4 1) ("(0"(Bng(0@(B" 4 3) ("(0#(Bng(0@(B" 4 5) ("(0$(Bng(0@(B" 4 7) + ("ao(0@(B" 5 0) ("(0!(Bo(0@(B" 5 1) ("(0"(Bo(0@(B" 5 3) ("(0#(Bo(0@(B" 5 5) ("(0$(Bo(0@(B" 5 7) + ("e(0@(B" 6 0) ("(0%@(B" 6 1) ("(0&@(B" 6 3) ("(0'@(B" 6 5) ("(0(@(B" 6 7) + ("ei(0@(B" 7 0) ("(0%(Bi(0@(B" 7 1) ("(0&(Bi(0@(B" 7 3) ("(0'(Bi(0@(B" 7 5) ("(0((Bi(0@(B" 7 7) + ("en(0@(B" 8 0) ("(0%(Bn(0@(B" 8 1) ("(0&(Bn(0@(B" 8 3) ("(0'(Bn(0@(B" 8 5) ("(0((Bn(0@(B" 8 7) + ("eng(0@(B" 9 0) ("(0%(Bng(0@(B" 9 1) ("(0&(Bng(0@(B" 9 3) ("(0'(Bng(0@(B" 9 5) ("(0((Bng(0@(B" 9 7) + ("er(0@(B" 10 0) ("(0%(Br(0@(B" 10 1) ("(0&(Br(0@(B" 10 3) ("(0'(Br(0@(B" 10 5) ("(0((Br(0@(B" 10 7) + ("i(0@(B" 11 0) ("(0)@(B" 11 1) ("(0*@(B" 11 3) ("(0+@(B" 11 5) ("(0,@(B" 11 7) + ("ia(0@(B" 12 0) ("i(0!@(B" 12 1) ("i(0"@(B" 12 3) ("i(0#@(B" 12 5) ("i(0$@(B" 12 7) + ("ian(0@(B" 13 0) ("i(0!(Bn(0@(B" 13 1) ("i(0"(Bn(0@(B" 13 3) ("i(0#(Bn(0@(B" 13 5) ("i(0$(Bn(0@(B" 13 7) + ("iang(0@(B" 14 0) ("i(0!(Bng(0@(B" 14 1) ("i(0"(Bng(0@(B" 14 3) ("i(0#(Bng(0@(B" 14 5) ("i(0$(Bng(0@(B" 14 7) + ("iao(0@(B" 15 0) ("i(0!(Bo(0@(B" 15 1) ("i(0"(Bo(0@(B" 15 3) ("i(0#(Bo(0@(B" 15 5) ("i(0$(Bo(0@(B" 15 7) + ("ie(0@(B" 16 0) ("i(0%@(B" 16 1) ("i(0&@(B" 16 3) ("i(0'@(B" 16 5) ("i(0(@(B" 16 7) + ("in(0@(B" 17 0) ("(0)(Bn(0@(B" 17 1) ("(0*(Bn(0@(B" 17 3) ("(0+(Bn(0@(B" 17 5) ("(0,(Bn(0@(B" 17 7) + ("ing(0@(B" 18 0) ("(0)(Bng(0@(B" 18 1) ("(0*(Bng(0@(B" 18 3) ("(0+(Bng(0@(B" 18 5) ("(0,(Bng(0@(B" 18 7) + ("iong(0@(B" 19 0) ("i(0-(Bng(0@(B" 19 1) ("i(0.(Bng(0@(B" 19 3) ("i(0/(Bng(0@(B" 19 5) ("i(00(Bng(0@(B" 19 7) + ("iu(0@(B" 20 0) ("i(01@(B" 20 1) ("i(02@(B" 20 3) ("i(03@(B" 20 5) ("i(04@(B" 20 7) + ("m(0@(B" 21 0) ("m(0@(B" 21 1) ("m(0@(B" 21 3) ("m(0@(B" 21 5) ("m(0@(B" 21 7) + ("n(0@(B" 22 0) ("n(0@(B" 22 1) ("(0=@(B" 22 3) ("(0>@(B" 22 5) ("(0?@(B" 22 7) + ("ng(0@(B" 23 0) ("ng(0@(B" 23 1) ("ng(0@(B" 23 3) ("ng(0@(B" 23 5) ("ng(0@(B" 23 7) + ("o(0@(B" 24 0) ("(0-@(B" 24 1) ("(0.@(B" 24 3) ("(0/@(B" 24 5) ("(00@(B" 24 7) + ("ong(0@(B" 25 0) ("(0-(Bng(0@(B" 25 1) ("(0.(Bng(0@(B" 25 3) ("(0/(Bng(0@(B" 25 5) ("(00(Bng(0@(B" 25 7) + ("ou(0@(B" 26 0) ("(0-(Bu(0@(B" 26 1) ("(0.(Bu(0@(B" 26 3) ("(0/(Bu(0@(B" 26 5) ("(00(Bu(0@(B" 26 7) + ("u(0@(B" 27 0) ("(01@(B" 27 1) ("(02@(B" 27 3) ("(03@(B" 27 5) ("(04@(B" 27 7) + ("ua(0@(B" 28 0) ("u(0!@(B" 28 1) ("u(0"@(B" 28 3) ("u(0#@(B" 28 5) ("u(0$@(B" 28 7) + ("uai(0@(B" 29 0) ("u(0!(Bi(0@(B" 29 1) ("u(0"(Bi(0@(B" 29 3) ("u(0#(Bi(0@(B" 29 5) ("u(0$(Bi(0@(B" 29 7) + ("uan(0@(B" 30 0) ("u(0!(Bn(0@(B" 30 1) ("u(0"(Bn(0@(B" 30 3) ("u(0#(Bn(0@(B" 30 5) ("u(0$(Bn(0@(B" 30 7) + ("uang(0@(B" 31 0) ("u(0!(Bng(0@(B" 31 1) ("u(0"(Bng(0@(B" 31 3) ("u(0#(Bng(0@(B" 31 5) ("u(0$(Bng(0@(B" 31 7) + ("ue(0@(B" 32 0) ("u(0%@(B" 32 1) ("u(0&@(B" 32 3) ("u(0'@(B" 32 5) ("u(0(@(B" 32 7) + ("ui(0@(B" 33 0) ("u(0)@(B" 33 1) ("u(0*@(B" 33 3) ("u(0+@(B" 33 5) ("u(0,@(B" 33 7) + ("un(0@(B" 34 0) ("(01(Bn(0@(B" 34 1) ("(02(Bn(0@(B" 34 3) ("(03(Bn(0@(B" 34 5) ("(04(Bn(0@(B" 34 7) + ("uo(0@(B" 35 0) ("u(0-@(B" 35 1) ("u(0.@(B" 35 3) ("u(0/@(B" 35 5) ("u(00@(B" 35 7) + ("(09@(B" 36 0) ("(05@(B" 36 1) ("(06@(B" 36 3) ("(07@(B" 36 5) ("(08@(B" 36 7) + ("(09(Be(0@(B" 37 0) ("(09%@(B" 37 1) ("(09&@(B" 37 3) ("(09'@(B" 37 5) ("(09(@(B" 37 7) + ("0(0@(B" 38 0) ("1(0@(B" 38 1) ("2(0@(B" 38 3) ("3(0@(B" 38 5) ("4(0@(B" 38 7))) (defconst yincode-pinyin-table [ @@ -218,54 +218,54 @@ ]) (defconst yincode-zhuyin-shengmu - '(("" . 0) ("š Å" . 1) ("š Ø" . 2) ("š Ô" . 3) ("š É" . 4) - ("š È" . 5) ("š Í" . 6) ("š Ï" . 7) ("š Ð" . 8) ("š Î" . 9) - ("š Ì" . 10) ("š Ç" . 11) ("š Ë" . 12) ("š Æ" . 13) ("š Ñ" . 14) - ("š Ö" . 15) ("š Ù" . 16) ("š Õ" . 17) ("š Ê" . 18) ("š è" . 19) - ("š Ò" . 20) ("š ç" . 21) ("š ×" . 22) ("š Ó" . 23))) + '(("" . 0) ("(0E(B" . 1) ("(0X(B" . 2) ("(0T(B" . 3) ("(0I(B" . 4) + ("(0H(B" . 5) ("(0M(B" . 6) ("(0O(B" . 7) ("(0P(B" . 8) ("(0N(B" . 9) + ("(0L(B" . 10) ("(0G(B" . 11) ("(0K(B" . 12) ("(0F(B" . 13) ("(0Q(B" . 14) + ("(0V(B" . 15) ("(0Y(B" . 16) ("(0U(B" . 17) ("(0J(B" . 18) ("(0h(B" . 19) + ("(0R(B" . 20) ("(0g(B" . 21) ("(0W(B" . 22) ("(0S(B" . 23))) (defconst yincode-zhuyin-yunmu - '(("š À" 0 0) ("š Á" 0 1) ("š Â" 0 3) ("š Ã" 0 5) ("š Ä" 0 7) ; i - ("š Úš À" 1 0) ("š Úš Á" 1 1) ("š Úš Â" 1 3) ("š Úš Ã" 1 5) ("š Úš Ä" 1 7) ; a - ("š Þš À" 2 0) ("š Þš Á" 2 1) ("š Þš Â" 2 3) ("š Þš Ã" 2 5) ("š Þš Ä" 2 7) ; ai - ("š âš À" 3 0) ("š âš Á" 3 1) ("š âš Â" 3 3) ("š âš Ã" 3 5) ("š âš Ä" 3 7) ; an - ("š äš À" 4 0) ("š äš Á" 4 1) ("š äš Â" 4 3) ("š äš Ã" 4 5) ("š äš Ä" 4 7) ; ang - ("š àš À" 5 0) ("š àš Á" 5 1) ("š àš Â" 5 3) ("š àš Ã" 5 5) ("š àš Ä" 5 7) ; ao - ("š Üš À" 6 0) ("š Üš Á" 6 1) ("š Üš Â" 6 3) ("š Üš Ã" 6 5) ("š Üš Ä" 6 7) ; e - ("š ßš À" 7 0) ("š ßš Á" 7 1) ("š ßš Â" 7 3) ("š ßš Ã" 7 5) ("š ßš Ä" 7 7) ; ei - ("š ãš À" 8 0) ("š ãš Á" 8 1) ("š ãš Â" 8 3) ("š ãš Ã" 8 5) ("š ãš Ä" 8 7) ; en - ("š åš À" 9 0) ("š åš Á" 9 1) ("š åš Â" 9 3) ("š åš Ã" 9 5) ("š åš Ä" 9 7) ; eng - ("š æš À" 10 0) ("š æš Á" 10 1) ("š æš Â" 10 3) ("š æš Ã" 10 5) ("š æš Ä" 10 7) ; er - ("š çš À" 11 0) ("š çš Á" 11 1) ("š çš Â" 11 3) ("š çš Ã" 11 5) ("š çš Ä" 11 7) ; i - ("š çš Úš À" 12 0) ("š çš Úš Á" 12 1) ("š çš Úš Â" 12 3) ("š çš Úš Ã" 12 5) ("š çš Úš Ä" 12 7) ; ia - ("š çš âš À" 13 0) ("š çš âš Á" 13 1) ("š çš âš Â" 13 3) ("š çš âš Ã" 13 5) ("š çš âš Ä" 13 7) ; ian - ("š çš äš À" 14 0) ("š çš äš Á" 14 1) ("š çš äš Â" 14 3) ("š çš äš Ã" 14 5) ("š çš äš Ä" 14 7) ; iang - ("š çš àš À" 15 0) ("š çš àš Á" 15 1) ("š çš àš Â" 15 3) ("š çš àš Ã" 15 5) ("š çš àš Ä" 15 7) ; iao - ("š çš Ýš À" 16 0) ("š çš Ýš Á" 16 1) ("š çš Ýš Â" 16 3) ("š çš Ýš Ã" 16 5) ("š çš Ýš Ä" 16 7) ; ie - ("š çš ãš À" 17 0) ("š çš ãš Á" 17 1) ("š çš ãš Â" 17 3) ("š çš ãš Ã" 17 5) ("š çš ãš Ä" 17 7) ; in - ("š çš åš À" 18 0) ("š çš åš Á" 18 1) ("š çš åš Â" 18 3) ("š çš åš Ã" 18 5) ("š çš åš Ä" 18 7) ; ing - ("š éš åš À" 19 0) ("š éš åš Á" 19 1) ("š éš åš Â" 19 3) ("š éš åš Ã" 19 5) ("š éš åš Ä" 19 7) ; iong - ("š çš áš À" 20 0) ("š çš áš Á" 20 1) ("š çš áš Â" 20 3) ("š çš áš Ã" 20 5) ("š çš áš Ä" 20 7) ; iu - ("š Çš À" 21 0) ("š Çš Á" 21 1) ("š Çš Â" 21 3) ("š Çš Ã" 21 5) ("š Çš Ä" 21 7) ; m - ("š Ëš À" 22 0) ("š Ëš Á" 22 1) ("š Ëš Â" 22 3) ("š Ëš Ã" 22 5) ("š Ëš Ä" 22 7) ; n - ("@š À" 23 0) ("@š Á" 23 1) ("@š Â" 23 3) ("@š Ã" 23 5) ("@š Ä" 23 7) ; ng - ("š Ûš À" 24 0) ("š Ûš Á" 24 1) ("š Ûš Â" 24 3) ("š Ûš Ã" 24 5) ("š Ûš Ä" 24 7) ; o - ("š èš åš À" 25 0) ("š èš åš Á" 25 1) ("š èš åš Â" 25 3) ("š èš åš Ã" 25 5) ("š èš åš Ä" 25 7) ; ong - ("š áš À" 26 0) ("š áš Á" 26 1) ("š áš Â" 26 3) ("š áš Ã" 26 5) ("š áš Ä" 26 7) ; ou - ("š èš À" 27 0) ("š èš Á" 27 1) ("š èš Â" 27 3) ("š èš Ã" 27 5) ("š èš Ä" 27 7) ; u - ("š èš Úš À" 28 0) ("š èš Úš Á" 28 1) ("š èš Úš Â" 28 3) ("š èš Úš Ã" 28 5) ("š èš Úš Ä" 28 7) ; ua - ("š èš Þš À" 29 0) ("š èš Þš Á" 29 1) ("š èš Þš Â" 29 3) ("š èš Þš Ã" 29 5) ("š èš Þš Ä" 29 7) ; uai - ("š èš âš À" 30 0) ("š èš âš Á" 30 1) ("š èš âš Â" 30 3) ("š èš âš Ã" 30 5) ("š èš âš Ä" 30 7) ; uan - ("š èš äš À" 31 0) ("š èš äš Á" 31 1) ("š èš äš Â" 31 3) ("š èš äš Ã" 31 5) ("š èš äš Ä" 31 7) ; uang - ("š éš Ýš À" 37 0) ("š éš Ýš Á" 37 1) ("š éš Ýš Â" 37 3) ("š éš Ýš Ã" 37 5) ("š éš Ýš Ä" 37 7) ; ue - ("š èš ßš À" 33 0) ("š èš ßš Á" 33 1) ("š èš ßš Â" 33 3) ("š èš ßš Ã" 33 5) ("š èš ßš Ä" 33 7) ; ui - ("š èš ãš À" 34 0) ("š èš ãš Á" 34 1) ("š èš ãš Â" 34 3) ("š èš ãš Ã" 34 5) ("š èš ãš Ä" 34 7) ; un - ("š èš Ûš À" 35 0) ("š èš Ûš Á" 35 1) ("š èš Ûš Â" 35 3) ("š èš Ûš Ã" 35 5) ("š èš Ûš Ä" 35 7) ; uo - ("š éš À" 36 0) ("š éš Á" 36 1) ("š éš Â" 36 3) ("š éš Ã" 36 5) ("š éš Ä" 36 7) ; š ¹ - ("š éš Ýš À" 37 0) ("š éš Ýš Á" 37 1) ("š éš Ýš Â" 37 3) ("š éš Ýš Ã" 37 5) ("š éš Ýš Ä" 37 7) ; š ¹e - ("0š À" 38 0) ("1š Á" 38 1) ("2š Â" 38 3) ("3š Ã" 38 5) ("4š Ä" 38 7) ; undefined - ("š éš âš À" 39 0) ("š éš âš Á" 39 1) ("š éš âš Â" 39 3) ("š éš âš Ã" 39 5) ("š éš âš Ä" 39 7) ; š ¹an - ("š éš ãš À" 40 0) ("š éš ãš Á" 40 1) ("š éš ãš Â" 40 3) ("š éš ãš Ã" 40 5) ("š éš ãš Ä" 40 7) ; š ¹n + '(("(0@(B" 0 0) ("(0A(B" 0 1) ("(0B(B" 0 3) ("(0C(B" 0 5) ("(0D(B" 0 7) ; i + ("(0Z@(B" 1 0) ("(0ZA(B" 1 1) ("(0ZB(B" 1 3) ("(0ZC(B" 1 5) ("(0ZD(B" 1 7) ; a + ("(0^@(B" 2 0) ("(0^A(B" 2 1) ("(0^B(B" 2 3) ("(0^C(B" 2 5) ("(0^D(B" 2 7) ; ai + ("(0b@(B" 3 0) ("(0bA(B" 3 1) ("(0bB(B" 3 3) ("(0bC(B" 3 5) ("(0bD(B" 3 7) ; an + ("(0d@(B" 4 0) ("(0dA(B" 4 1) ("(0dB(B" 4 3) ("(0dC(B" 4 5) ("(0dD(B" 4 7) ; ang + ("(0`@(B" 5 0) ("(0`A(B" 5 1) ("(0`B(B" 5 3) ("(0`C(B" 5 5) ("(0`D(B" 5 7) ; ao + ("(0\@(B" 6 0) ("(0\A(B" 6 1) ("(0\B(B" 6 3) ("(0\C(B" 6 5) ("(0\D(B" 6 7) ; e + ("(0_@(B" 7 0) ("(0_A(B" 7 1) ("(0_B(B" 7 3) ("(0_C(B" 7 5) ("(0_D(B" 7 7) ; ei + ("(0c@(B" 8 0) ("(0cA(B" 8 1) ("(0cB(B" 8 3) ("(0cC(B" 8 5) ("(0cD(B" 8 7) ; en + ("(0e@(B" 9 0) ("(0eA(B" 9 1) ("(0eB(B" 9 3) ("(0eC(B" 9 5) ("(0eD(B" 9 7) ; eng + ("(0f@(B" 10 0) ("(0fA(B" 10 1) ("(0fB(B" 10 3) ("(0fC(B" 10 5) ("(0fD(B" 10 7) ; er + ("(0g@(B" 11 0) ("(0gA(B" 11 1) ("(0gB(B" 11 3) ("(0gC(B" 11 5) ("(0gD(B" 11 7) ; i + ("(0gZ@(B" 12 0) ("(0gZA(B" 12 1) ("(0gZB(B" 12 3) ("(0gZC(B" 12 5) ("(0gZD(B" 12 7) ; ia + ("(0gb@(B" 13 0) ("(0gbA(B" 13 1) ("(0gbB(B" 13 3) ("(0gbC(B" 13 5) ("(0gbD(B" 13 7) ; ian + ("(0gd@(B" 14 0) ("(0gdA(B" 14 1) ("(0gdB(B" 14 3) ("(0gdC(B" 14 5) ("(0gdD(B" 14 7) ; iang + ("(0g`@(B" 15 0) ("(0g`A(B" 15 1) ("(0g`B(B" 15 3) ("(0g`C(B" 15 5) ("(0g`D(B" 15 7) ; iao + ("(0g]@(B" 16 0) ("(0g]A(B" 16 1) ("(0g]B(B" 16 3) ("(0g]C(B" 16 5) ("(0g]D(B" 16 7) ; ie + ("(0gc@(B" 17 0) ("(0gcA(B" 17 1) ("(0gcB(B" 17 3) ("(0gcC(B" 17 5) ("(0gcD(B" 17 7) ; in + ("(0ge@(B" 18 0) ("(0geA(B" 18 1) ("(0geB(B" 18 3) ("(0geC(B" 18 5) ("(0geD(B" 18 7) ; ing + ("(0ie@(B" 19 0) ("(0ieA(B" 19 1) ("(0ieB(B" 19 3) ("(0ieC(B" 19 5) ("(0ieD(B" 19 7) ; iong + ("(0ga@(B" 20 0) ("(0gaA(B" 20 1) ("(0gaB(B" 20 3) ("(0gaC(B" 20 5) ("(0gaD(B" 20 7) ; iu + ("(0G@(B" 21 0) ("(0GA(B" 21 1) ("(0GB(B" 21 3) ("(0GC(B" 21 5) ("(0GD(B" 21 7) ; m + ("(0K@(B" 22 0) ("(0KA(B" 22 1) ("(0KB(B" 22 3) ("(0KC(B" 22 5) ("(0KD(B" 22 7) ; n + ("@(0@(B" 23 0) ("@(0A(B" 23 1) ("@(0B(B" 23 3) ("@(0C(B" 23 5) ("@(0D(B" 23 7) ; ng + ("(0[@(B" 24 0) ("(0[A(B" 24 1) ("(0[B(B" 24 3) ("(0[C(B" 24 5) ("(0[D(B" 24 7) ; o + ("(0he@(B" 25 0) ("(0heA(B" 25 1) ("(0heB(B" 25 3) ("(0heC(B" 25 5) ("(0heD(B" 25 7) ; ong + ("(0a@(B" 26 0) ("(0aA(B" 26 1) ("(0aB(B" 26 3) ("(0aC(B" 26 5) ("(0aD(B" 26 7) ; ou + ("(0h@(B" 27 0) ("(0hA(B" 27 1) ("(0hB(B" 27 3) ("(0hC(B" 27 5) ("(0hD(B" 27 7) ; u + ("(0hZ@(B" 28 0) ("(0hZA(B" 28 1) ("(0hZB(B" 28 3) ("(0hZC(B" 28 5) ("(0hZD(B" 28 7) ; ua + ("(0h^@(B" 29 0) ("(0h^A(B" 29 1) ("(0h^B(B" 29 3) ("(0h^C(B" 29 5) ("(0h^D(B" 29 7) ; uai + ("(0hb@(B" 30 0) ("(0hbA(B" 30 1) ("(0hbB(B" 30 3) ("(0hbC(B" 30 5) ("(0hbD(B" 30 7) ; uan + ("(0hd@(B" 31 0) ("(0hdA(B" 31 1) ("(0hdB(B" 31 3) ("(0hdC(B" 31 5) ("(0hdD(B" 31 7) ; uang + ("(0i]@(B" 37 0) ("(0i]A(B" 37 1) ("(0i]B(B" 37 3) ("(0i]C(B" 37 5) ("(0i]D(B" 37 7) ; ue + ("(0h_@(B" 33 0) ("(0h_A(B" 33 1) ("(0h_B(B" 33 3) ("(0h_C(B" 33 5) ("(0h_D(B" 33 7) ; ui + ("(0hc@(B" 34 0) ("(0hcA(B" 34 1) ("(0hcB(B" 34 3) ("(0hcC(B" 34 5) ("(0hcD(B" 34 7) ; un + ("(0h[@(B" 35 0) ("(0h[A(B" 35 1) ("(0h[B(B" 35 3) ("(0h[C(B" 35 5) ("(0h[D(B" 35 7) ; uo + ("(0i@(B" 36 0) ("(0iA(B" 36 1) ("(0iB(B" 36 3) ("(0iC(B" 36 5) ("(0iD(B" 36 7) ; (09(B + ("(0i]@(B" 37 0) ("(0i]A(B" 37 1) ("(0i]B(B" 37 3) ("(0i]C(B" 37 5) ("(0i]D(B" 37 7) ; (09(Be + ("0(0@(B" 38 0) ("1(0A(B" 38 1) ("2(0B(B" 38 3) ("3(0C(B" 38 5) ("4(0D(B" 38 7) ; undefined + ("(0ib@(B" 39 0) ("(0ibA(B" 39 1) ("(0ibB(B" 39 3) ("(0ibC(B" 39 5) ("(0ibD(B" 39 7) ; (09(Ban + ("(0ic@(B" 40 0) ("(0icA(B" 40 1) ("(0icB(B" 40 3) ("(0icC(B" 40 5) ("(0icD(B" 40 7) ; (09(Bn )) (defconst yincode-zhuyin-table @@ -429,7 +429,7 @@ (defun egg-pinyin-syllable (str) (let (s y end) - (if (string-match "^[A-Za-zš ¡-š ¿]+š À" str) + (if (string-match "^[A-Za-z(0!(B-(0?(B]+(0@(B" str) (progn (setq end (match-end 0)) (cond @@ -445,7 +445,7 @@ (defun egg-zhuyin-syllable (str) (let (end s y c z (zhuyin-len (charset-bytes 'chinese-sisheng))) - (if (string-match "^[š Å-š é@0-4]+[š Àš Áš Âš Ãš Ä]" str) + (if (string-match "^[(0E(B-(0i(B@0-4]+[(0@ABCD(B]" str) (progn (setq end (match-end 0) c (substring str 0 zhuyin-len) @@ -465,7 +465,7 @@ (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š ¡ngš À") (length "š Óš èš äš Á")))) + (let (s syl c cset (maxlen (max (length "Zhu(0!(Bng(0@(B") (length "(0ShdA(B")))) (save-excursion (save-restriction (narrow-to-region beg end) diff --git a/egg-hilit.el b/egg-hilit.el new file mode 100644 index 0000000..b5568a5 --- /dev/null +++ b/egg-hilit.el @@ -0,0 +1,33 @@ +(defvar egg-face-color-japanese "Cyan") +(defvar egg-face-color-chinese "Pink") +(defvar egg-face-color-taiwanise "Salmon") +(defvar egg-face-color-korean "Yellow") + +(defun egg-set-fg-color (color) + (let ((face (make-face (intern (concat "fg:" color))))) + (set-face-foreground face color) + face)) + +(defun egg-set-bg-color (color) + (let ((face (make-face (intern (concat "bg:" color))))) + (set-face-background face color) + face)) + +(defun egg-make-face (color) + (list 'underline (egg-set-bg-color color))) + +(defconst its-fence-face + (and window-system + (list (cons "Japanese" (egg-make-face egg-face-color-japanese)) + (cons "Chinese-GB" (egg-make-face egg-face-color-chinese)) + (cons "Chinese-CNS" (egg-make-face egg-face-color-taiwanise)) + (cons "Korean" (egg-make-face egg-face-color-korean)) + (cons t 'underline)))) + +(defconst egg-conversion-face + (and window-system + (list (cons "Japanese" (egg-make-face egg-face-color-japanese)) + (cons "Chinese-GB" (egg-make-face egg-face-color-chinese)) + (cons "Chinese-CNS" (egg-make-face egg-face-color-taiwanise)) + (cons "Korean" (egg-make-face egg-face-color-korean)) + (cons t 'underline)))) diff --git a/egg-mlh.el b/egg-mlh.el index ee7ffca..a520acf 100644 --- a/egg-mlh.el +++ b/egg-mlh.el @@ -6,6 +6,7 @@ ;; Project Leader: Satoru Tomura ;; Author: NIIBE Yutaka +;; KATAYAMA Yoshio ; Multilingual Enhancement ;; Maintainer: NIIBE Yutaka ;; Keywords: mule, multilingual, input method @@ -38,7 +39,8 @@ Do `mlh-backward-henkan'. Then, invoke appropriate conversion, if needed. Or else, execute command that space-bar invokes usually." (interactive) (let ((henkan-begin nil) - (inhibit-henkan t)) + (inhibit-henkan t) + (its-disable-special-action t)) (its-select-hiragana) ;; force to Japanese (mlh-backward-henkan) (if henkan-begin diff --git a/egg.el b/egg.el index 9dd3b40..a88bcf2 100644 --- a/egg.el +++ b/egg.el @@ -58,6 +58,7 @@ (if (null (string= (car arg) egg-last-method-name)) (progn (funcall (nth 1 arg)) + (egg-set-conversion-backend nil (list its-current-language) t) (setq egg-default-language its-current-language))) (setq egg-last-method-name (car arg)) (use-local-map (if egg-mode-preference @@ -65,15 +66,7 @@ (egg-modeless-map))) (setq inactivate-current-input-method-function 'egg-mode) (setq describe-current-input-method-function 'egg-help) - (add-hook 'input-method-activate-hook 'egg-set-mode-line-title))) - -(defun egg-set-mode-line-title () - (setq current-input-method-title (its-get-indicator its-current-map)) - (force-mode-line-update)) - -(defun egg-check-language (lang) - (if (null (member lang egg-support-languages)) - (error "%S is not supported" lang))) + (add-hook 'input-method-activate-hook 'its-set-mode-line-title))) (defun egg-modefull-map () "Generate modefull keymap for EGG mode." diff --git a/egg/sj3.el b/egg/sj3.el index 6f059a7..0342dce 100644 --- a/egg/sj3.el +++ b/egg/sj3.el @@ -44,45 +44,70 @@ sj3-decide-candidate sj3-change-bunsetsu-length sj3-end-conversion + nil sj3-fini ]) -(defconst sj3-server-port 3000 "Port number of SJ3 server") +(defvar sj3-server-port 3000 "Port number of SJ3 server") (defvar sj3-stdy-size 0 "STDYSIZE of SJ3 server") (defvar sj3-hostname "localhost" "Hostname of SJ3 server") -(defun sj3-open (hostname) +(defvar sj3-open-message) + +(defun sj3-open (hostname-list) "Establish the connection to SJ3 server. Return process object." (let* ((buf (generate-new-buffer " *SJ3*")) - (proc (open-network-stream "SJ3" buf hostname sj3-server-port)) - result) - (process-kill-without-query proc) - (set-process-coding-system proc 'no-conversion 'no-conversion) - (set-marker-insertion-type (process-mark proc) t) + (msg-form "SJ3: connecting to sj3serv at %s...") + hostname proc result msg) (save-excursion (set-buffer buf) (erase-buffer) (buffer-disable-undo) (setq enable-multibyte-characters nil)) - ;; Initialize dictionaries - (setq sj3-sys-dict-list nil) - (setq sj3-user-dict-list nil) - (setq result (sj3rpc-open proc (system-name) (user-login-name))) - (if (< result 0) - (let ((msg (sj3rpc-get-error-message (- result)))) - (delete-process proc) - (kill-buffer buf) - (error "Can't open SJ3 session (%s): %s" hostname msg))) - (setq result (sj3rpc-get-stdy-size proc)) - (if (< result 0) - (let ((msg (sj3rpc-get-error-message (- result)))) - (delete-process proc) - (kill-buffer buf) - (error "Can't get SJ3 STDYSIZE: %s"msg))) - (setq sj3-stdy-size result) - proc)) + (cond + ((null hostname-list) + (setq hostname-list '("localhost"))) + ((null (listp hostname-list)) + (setq hostname-list (list hostname-list)))) + (while (and hostname-list (null proc)) + (setq hostname (car hostname-list) + hostname-list (cdr hostname-list)) + (message msg-form hostname) + (sit-for 0) + (condition-case result + (setq proc (open-network-stream "SJ3" buf hostname sj3-server-port)) + (error nil)) + (if proc + (progn + (process-kill-without-query proc) + (set-process-coding-system proc 'no-conversion 'no-conversion) + (set-marker-insertion-type (process-mark proc) t) + ;; Initialize dictionaries + (setq sj3-sys-dict-list nil) + (setq sj3-user-dict-list nil) + (setq result (sj3rpc-open proc (system-name) (user-login-name))) + (if (< result 0) + (progn + (delete-process proc) + (setq proc nil + msg (format "Can't open SJ3 session (%s): %s" + hostname msg))) + (setq result (sj3rpc-get-stdy-size proc)) + (if (< result 0) + (progn + (delete-process proc) + (setq proc nil + msg (format "Can't get SJ3 STDYSIZE: %s" + (sj3rpc-get-error-message (- result))))) + (setq sj3-stdy-size result)))))) + (if proc + (progn + (setq sj3-open-message (format (concat msg-form "done") hostname)) + proc) + (kill-buffer buf) + (error "%s" (or msg "no sj3serv available"))))) ;; ::= [ ] (defvar sj3-environment nil @@ -162,13 +187,14 @@ (if (< dic-id 0) (error "Dame2") ; XXX (setq dict-list (cons dic-id dict-list) - l (cdr l)))))) - (setq sj3-environment (vector proc dict-list))))) + l (cdr l))))) + (message "%s" sj3-open-message) + (setq sj3-environment (vector proc dict-list)))))) (defun sj3-init () ) -(defun sj3-start-conversion (yomi lang) +(defun sj3-start-conversion (yomi &optional lang) "Convert YOMI string to kanji, and enter conversion mode. Return the list of bunsetsu." (let ((env (sj3-get-environment))) @@ -253,8 +279,7 @@ Return the list of bunsetsu." "Activate SJ3 backend of Tamagotchy." (egg-set-support-languages sj3-support-languages) (egg-set-conversion-backend sj3-conversion-backend - sj3-support-languages - nil) + sj3-support-languages) (apply 'egg-mode arg)) ;;; egg/sj3.el ends here. diff --git a/egg/sj3rpc.el b/egg/sj3rpc.el index c92dbb7..a7eda4c 100644 --- a/egg/sj3rpc.el +++ b/egg/sj3rpc.el @@ -70,8 +70,14 @@ ((eq c 'VERSION) 103) (t (error "No such constant"))))) +;; XXX +(defconst sj3rpc-error-message (vector )) + (defun sj3rpc-get-error-message (errno) - (or (aref sj3rpc-error-message errno) (format "#%d" errno))) + (or (and (>= errno 0) + (< errno (length sj3rpc-error-message)) + (aref sj3rpc-error-message errno)) + (format "#%d" errno))) (defmacro sj3rpc-call-with-environment (e vlist send-expr &rest receive-exprs) (let ((v (append diff --git a/egg/wnn.el b/egg/wnn.el index a07977e..22822b3 100644 --- a/egg/wnn.el +++ b/egg/wnn.el @@ -60,6 +60,7 @@ wnn-decide-candidate wnn-change-bunsetsu-length wnn-end-conversion + wnn-start-reverse-conversion wnn-fini ]) @@ -153,18 +154,23 @@ (defvar wnn-environments nil "Environment for WNN kana-kanji conversion") -(defcustom wnn-jserver "localhost" "jserver host" :group 'wnn :type 'string) -(defcustom wnn-cserver "localhost" "cserver host" :group 'wnn :type 'string) -(defcustom wnn-tserver "localhost" "tserver host" :group 'wnn :type 'string) -(defcustom wnn-kserver "localhost" "kserver host" :group 'wnn :type 'string) +(defcustom wnn-jserver nil "jserver host list" :group 'wnn :type 'string) +(defcustom wnn-cserver nil "cserver host list" :group 'wnn :type 'string) +(defcustom wnn-tserver nil "tserver host list" :group 'wnn :type 'string) +(defcustom wnn-kserver nil "kserver host list" :group 'wnn :type 'string) + +(defcustom wnn-jport 22273 "jserver port number" :group 'wnn :type 'integer) +(defcustom wnn-cport 22289 "cserver port number" :group 'wnn :type 'integer) +(defcustom wnn-tport 22321 "tserver port number" :group 'wnn :type 'integer) +(defcustom wnn-kport 22305 "kserver port number" :group 'wnn :type 'integer) ;; The port number should be initialized from $WNNLIB/serverdefs by wnn-init (defconst wnn-server-info-list - ;; language locale server port stream coding-system hostname - '(("Japanese" "ja_JP" jserver 22273 "Wnn" fixed-euc-jp wnn-jserver) - ("Chinese-GB" "zh_CN" cserver 22289 "cWnn" fixed-euc-cn wnn-cserver) - ("Chinese-CNS" "zh_TW" tserver 22321 "tWnn" fixed-euc-tw wnn-tserver) - ("Korean" "ko_KR" kserver 22305 "kWnn" fixed-euc-kr wnn-kserver))) + ;; language locale server port stream coding-system hostname + '(("Japanese" "ja_JP" jserver wnn-jport "Wnn" fixed-euc-jp wnn-jserver) + ("Chinese-GB" "zh_CN" cserver wnn-cport "cWnn" fixed-euc-cn wnn-cserver) + ("Chinese-CNS" "zh_TW" tserver wnn-tport "tWnn" fixed-euc-tw wnn-tserver) + ("Korean" "ko_KR" kserver wnn-kport "kWnn" fixed-euc-kr wnn-kserver))) (defun wnn-get-server-info (lang) (let (info) @@ -180,7 +186,7 @@ (nth 2 info)) (defsubst wnn-server-port (info) - (nth 3 info)) + (symbol-value (nth 3 info))) (defsubst wnn-server-stream-name (info) (nth 4 info)) @@ -207,6 +213,9 @@ Return the list of bunsetsu." (wnnenv-set-daibunsetsu-info env (car result)) (cdr result))) +(defun wnn-start-reverse-conversion (yomi &optional language dic-set) + (wnn-start-conversion yomi language dic-set t)) + (defun wnn-get-bunsetsu-converted (bunsetsu) (concat (wnn-bunsetsu-get-converted bunsetsu) (wnn-bunsetsu-get-fuzokugo bunsetsu))) @@ -390,43 +399,65 @@ Return the list of bunsetsu." l (cdr l)))))) ;; +(defvar wnn-open-message) + (defun wnn-open (server-info) "Establish the connection to WNN server. Return process object." ;; Open the session to WNN server, (let ((buf (generate-new-buffer (wnn-server-buffer-name server-info))) - (hostname (wnn-server-hostname server-info)) - proc result) - (condition-case result - (setq proc (open-network-stream (wnn-server-stream-name server-info) - buf - hostname - (wnn-server-port server-info))) - (error (progn - (kill-buffer buf) - (signal (car result) (cdr result))))) - (process-kill-without-query proc) - (set-process-coding-system proc 'no-conversion 'no-conversion) - (set-process-sentinel proc 'wnn-comm-sentinel) - (set-marker-insertion-type (process-mark proc) t) + (server-type (wnn-server-type server-info)) + (hostname-list (wnn-server-hostname server-info)) + (msg-form "WNN: connecting to %S at %s...") + hostname proc result msg) (save-excursion (set-buffer buf) (erase-buffer) (buffer-disable-undo) (setq enable-multibyte-characters nil egg-fixed-euc (wnn-server-coding-system server-info))) - (setq result (wnnrpc-open proc - (if (equal hostname "localhost") - "unix" - (system-name)) - (user-login-name))) - (if (< result 0) - (let ((msg (wnnrpc-get-error-message (- result)))) - (delete-process proc) - (kill-buffer buf) - (error "Can't open WNN session (%s %S): %s" - hostname - (wnn-server-type server-info) msg)) - proc))) + (cond + ((null hostname-list) + (setq hostname-list '("localhost"))) + ((null (listp hostname-list)) + (setq hostname-list (list hostname-list)))) + (while (and hostname-list (null proc)) + (setq hostname (car hostname-list) + hostname-list (cdr hostname-list)) + (message msg-form server-type hostname) + (sit-for 0) + (condition-case result + (setq proc (open-network-stream (wnn-server-stream-name server-info) + buf + hostname + (wnn-server-port server-info))) + (error nil)) + (if proc + (progn + (process-kill-without-query proc) + (set-process-coding-system proc 'no-conversion 'no-conversion) + (set-process-sentinel proc 'wnn-comm-sentinel) + (set-marker-insertion-type (process-mark proc) t) + (setq result (wnnrpc-open proc + (if (equal hostname "localhost") + "unix" + (system-name)) + (user-login-name))) + (if (< result 0) + (progn + (delete-process proc) + (setq proc nil + msg (format "Can't open WNN session (%s %S): %s" + hostname + (wnn-server-type server-info) + msg))))))) + (if proc + (progn + (setq wnn-open-message (format (concat msg-form "done") + server-type + hostname)) + proc) + (kill-buffer buf) + (error "%s" (or msg (format "no %S available" server-type)))))) (defvar wnn-dictionary-specification-list '((jserver @@ -722,6 +753,12 @@ REVERSE specifies reverse conversion, if non nil." (eq (wnn-dic-spec-reverse s) reverse)) (setq env e)) (setq spec (cdr spec))) + (if (null env) + (error "WNN: environment for %S%s (%s) not found" + server-type + (if dic-set (format "(%S)" dic-set) "") + (if reverse 'reverse 'normal))) + (message "%s" wnn-open-message) env))) (defun wnn-create-environment (proc server-type spec) @@ -884,7 +921,6 @@ REVERSE specifies reverse conversion, if non nil." "Activate Wnn backend of Tamagotchy." (egg-set-support-languages wnn-support-languages) (egg-set-conversion-backend wnn-conversion-backend - (list (nth 2 arg)) wnn-support-languages) (apply 'egg-mode arg)) diff --git a/its-keydef.el b/its-keydef.el index 9ccbf1f..9372491 100644 --- a/its-keydef.el +++ b/its-keydef.el @@ -1,37 +1,40 @@ (eval-when-compile (require 'cl)) -(defvar its-current-language "Japanese") - (defvar its-zhuyin nil) (make-variable-buffer-local 'its-zhuyin) +(put 'its-zhuyin 'permanent-local t) -(defun its-make-select-func (key1 key2 name file map &optional lang zhuyin) - (setq name (intern (concat "its-select-" (symbol-name name))) - file (intern (concat "its/" (symbol-name file))) - map (intern (concat "its-" (symbol-name map) "-map")) - lang (symbol-name lang)) - (cons - `(defun ,name (&optional mode-line-unchange) - (interactive) - (cond - ((its-in-fence-p) - (its-input-end) - (its-put-cursor t)) - ((egg-get-bunsetsu-info (point)) - (egg-exit-conversion))) - ,(if lang `(egg-check-language ,lang)) - (require ',file) - (setq its-current-map ,map) - ,(if lang `(setq its-current-language ,lang)) - ,(if zhuyin `(setq its-zhuyin ,(eq zhuyin 'T))) - (if (null mode-line-unchange) - (egg-set-mode-line-title))) - `(define-key map - (if fence - ,(concat "\e" (vector key2)) - ,(concat "\C-x\C-m" (vector key1))) - ',name))) +(eval-when (eval compile) + (defun its-make-select-func (key1 key2 func file map &optional zhuyin) + (setq func (intern (concat "its-select-" (symbol-name func))) + file (intern (concat "its/" (symbol-name file))) + map (intern (concat "its-" (symbol-name map) "-map"))) + (cons + `(defun ,func (&optional temporally mode-line-unchange) + (interactive "P") + (if temporally + (its-select-mode-temporally ',func) + (let ((inhibit-read-only t)) + (require ',file) + (cond + ((its-in-fence-p) + (its-input-end) + (its-put-cursor t)) + ((egg-get-bunsetsu-info (point)) + (egg-exit-conversion))) + (setq its-current-select-func ',func) + (setq its-current-map ,map) + (if (its-get-language its-current-map) + (setq its-current-language (its-get-language its-current-map))) + ,(if zhuyin `(setq its-zhuyin ,(eq zhuyin 'T))) + (if (null mode-line-unchange) + (its-set-mode-line-title))))) + `(define-key map + (if fence + ,(concat "\e" key2) + ,(concat "\C-x\C-m" key1)) + ',func)))) (defmacro its-do-list-make-select-func (list) (eval-when (eval compile) @@ -47,25 +50,25 @@ ,@keydefs))))) (its-do-list-make-select-func - ((?Q ?Q upcase ascii up) - (?q ?q downcase ascii down) - (?h ?\C-h hiragana hira hira Japanese) - (?k ?\C-k katakana kata kata Japanese) - (?x ?\C-x hankaku-katakana hankata han-kata Japanese) - (?Z ?Z zenkaku-upcase zenkaku zenkaku-up Japanese) - (?z ?z zenkaku-downcase zenkaku zenkaku-down Japanese) - (?\C-e ?\C-e erpin-cn erpin erpin-cn Chinese-GB NIL) - (?\C-p ?\C-p pinyin-cn pinyin pinyin-cn Chinese-GB NIL) - (?\C-z ?\C-z zhuyin-cn zhuyin zhuyin-cn Chinese-GB T) - (?\C-u ?\C-u quanjiao-upcase-cn quanjiao quanjiao-up-cn Chinese-GB) - (?\C-d ?\C-d quanjiao-downcase-cn quanjiao quanjiao-down-cn Chinese-GB) - (?E ?E erpin-tw erpin erpin-tw Chinese-CNS NIL) - (?P ?P pinyin-tw pinyin pinyin-tw Chinese-CNS NIL) - (?Z ?Z zhuyin-tw zhuyin zhuyin-tw Chinese-CNS T) - (?U ?U quanjiao-upcase-tw quanjiao quanjiao-up-tw Chinese-CNS) - (?C ?C quanjiao-downcase-tw quanjiao quanjiao-down-tw Chinese-CNS) - (?H ?H hangul hangul hangul Korean) - (?J ?J jeonkak-upcase jeonkak jeonkak-up Korean) - (?j ?j jeonkak-downcase jeonkak jeonkak-down Korean))) + (("Q" "Q" upcase ascii up) + ("q" "q" downcase ascii down) + ("h" "\C-h" hiragana hira hira) + ("k" "\C-k" katakana kata kata) + ("x" "\C-x" hankaku-katakana hankata han-kata) + ("Z" "Z" zenkaku-upcase zenkaku zenkaku-up) + ("z" "z" zenkaku-downcase zenkaku zenkaku-down) + ("\C-e" "\C-e" erpin-cn erpin erpin-cn NIL) + ("\C-p" "\C-p" pinyin-cn pinyin pinyin-cn NIL) + ("\C-z" "\C-z" zhuyin-cn zhuyin zhuyin-cn T) + ("\C-u" "\C-u" quanjiao-upcase-cn quanjiao quanjiao-up-cn) + ("\C-d" "\C-d" quanjiao-downcase-cn quanjiao quanjiao-down-cn) + ("E" "E" erpin-tw erpin erpin-tw NIL) + ("P" "P" pinyin-tw pinyin pinyin-tw NIL) + ("C" "C" zhuyin-tw zhuyin zhuyin-tw T) + ("U" "U" quanjiao-upcase-tw quanjiao quanjiao-up-tw) + ("D" "D" quanjiao-downcase-tw quanjiao quanjiao-down-tw) + ("H" "H" hangul hangul hangul) + ("J" "J" jeonkak-upcase jeonkak jeonkak-up) + ("j" "j" jeonkak-downcase jeonkak jeonkak-down))) (provide 'its-keydef) diff --git a/its.el b/its.el index 0c78b7f..d55f755 100644 --- a/its.el +++ b/its.el @@ -32,8 +32,21 @@ (require 'cl) +(defvar its-current-map nil) +(make-variable-buffer-local 'its-current-map) +(put 'its-current-map 'permanent-local t) + +(defvar its-current-select-func nil) +(make-variable-buffer-local 'its-current-select-func) +(put 'its-current-select-func 'permanent-local t) + +(defvar its-previous-select-func nil) +(make-variable-buffer-local 'its-previous-select-func) +(put 'its-previous-select-func 'permanent-local t) + (defvar its-current-language) (make-variable-buffer-local 'its-current-language) +(put 'its-current-language 'permanent-local t) ;; Data structure in ITS ;; (1) SYL and CURSOR @@ -174,16 +187,19 @@ ;; ;; -(require 'its-keydef) +(eval-when (eval load compile) + (require 'its-keydef)) (defvar its-mode-map (let ((map (make-sparse-keymap)) (i 33)) (define-key map "\C-a" 'its-beginning-of-input-buffer) (define-key map "\C-b" 'its-backward-SYL) + (define-key map "\C-c" 'its-cancel-input) (define-key map "\C-d" 'its-delete-SYL) (define-key map "\C-e" 'its-end-of-input-buffer) (define-key map "\C-f" 'its-forward-SYL) + (define-key map "\C-g" 'its-select-previous-mode) (define-key map "\C-]" 'its-cancel-input) (define-key map "\C-h" 'its-mode-help-command) (define-key map "\C-k" 'its-kill-line) @@ -191,17 +207,19 @@ (define-key map "\C-m" 'its-exit-mode) ; RET (define-key map [return] 'its-exit-mode) (define-key map "\C-t" 'its-transpose-chars) + (define-key map "\C-w" 'its-kick-convert-region) + (define-key map "\C-y" 'its-yank) + (define-key map "\M-y" 'its-yank-pop) (define-key map [backspace] 'its-delete-backward-SYL) (define-key map [delete] 'its-delete-backward-SYL) (define-key map [M-backspace] 'its-delete-backward-SYL-by-keystroke) (define-key map [M-delete] 'its-delete-backward-SYL-by-keystroke) (define-key map [right] 'its-forward-SYL) (define-key map [left] 'its-backward-SYL) - (define-key map "\C-\\" 'its-exit-mode-off-input-method) (while (< i 127) (define-key map (vector i) 'its-self-insert-char) (setq i (1+ i))) - (define-key map " " 'its-kick-convert-region) + (define-key map " " 'its-kick-convert-region-or-self-insert) (define-key map "\177" 'its-delete-backward-SYL) ;; (define-key map "\M-p" 'its-previous-map) @@ -214,18 +232,25 @@ map) "Keymap for ITS mode.") -(defvar its-fence-open "|" "*$B%U%'%s%9$N;OE@$r<($9J8;zNs(B (1 $BJ8;z(B)") -(defvar its-fence-close "|" "*$B%U%'%s%9$N=*E@$r<($9J8;zNs(B (1 $BJ8;z(B)") -(defvar its-fence-face nil "*$B%U%'%s%9I=<($KMQ$$$k(B face $B$^$?$O(B nil") +(defvar its-fence-open "|" "*$B%U%'%s%9$N;OE@$r<($9J8;zNs(B (1 $BJ8;z0J>e(B)") +(defvar its-fence-close "|" "*$B%U%'%s%9$N=*E@$r<($9J8;zNs(B (1 $BJ8;z0J>e(B)") +(defvar its-fence-face nil "*$B%U%'%s%9I=<($KMQ$$$k(B face $B$^$?$O(B nil") (defconst its-setup-fence-before-insert-SYL nil) +(defun its-get-fence-face () + (let ((face (and (consp its-fence-face) + (or (assoc its-current-language its-fence-face) + (assoc t its-fence-face))))) + (if face (cdr face) its-fence-face))) + (defun its-put-cursor (cursor) (let ((p (point)) (map (copy-keymap its-mode-map))) (its-define-select-keys map) (insert "!") (add-text-properties p (point) (list 'local-map map + 'read-only t 'invisible t 'intangible 'its-part-2 'its-cursor cursor)) @@ -248,33 +273,38 @@ ;; (defun its-setup-fence-mode () (let ((open-props '(its-start t intangible its-part-1)) - (close-props '(its-end t intangible its-part-2)) + (close-props '(rear-nonsticky t its-end t intangible its-part-2)) (p (point)) p1) + ;; Put open-fence before inhibit-read-only to detect read-nly (insert its-fence-open) - (setq p1 (point)) - (add-text-properties p p1 open-props) - (insert its-fence-close) - (add-text-properties p1 (point) close-props) - (if its-fence-face - (put-text-property 'invisible t p (point))) - (goto-char p1) - (its-put-cursor t))) + (let ((inhibit-read-only t)) + (setq p1 (point)) + (add-text-properties p p1 open-props) + (insert its-fence-close) + (add-text-properties p1 (point) close-props) + (if its-fence-face + (put-text-property p (point) 'invisible t)) + (put-text-property p (point) 'read-only t) + (goto-char p1) + (its-put-cursor t)))) (defun its-start (key) (let ((its-setup-fence-before-insert-SYL t)) - (its-input nil key) - (force-mode-line-update))) + (its-input nil key))) -(defun its-restart (str) +(defun its-restart (str &optional set-prop) (let (p) - (its-setup-fence-mode t) + (its-setup-fence-mode) (setq p (point)) (insert str) + (if set-prop + (its-setup-yanked-portion p (point))) (its-beginning-of-input-buffer))) (defun its-self-insert-char () (interactive) - (let ((key last-command-char) + (let ((inhibit-read-only t) + (key last-command-char) (cursor (get-text-property (point) 'its-cursor)) (syl (get-text-property (1- (point)) 'its-syl))) (cond @@ -287,10 +317,6 @@ (setq syl nil))) (its-input syl key))) -(defvar its-current-map nil) -(make-variable-buffer-local 'its-current-map) -(put 'its-current-map 'permanent-local t) - (defun its-initial-ISYL () (its-get-start-state its-current-map)) @@ -339,17 +365,26 @@ ;;; ITS State Machine ;;; +(defvar its-disable-special-action nil) + ;; Return CURSOR (defun its-state-machine (state key emit) (let ((next-state (its-get-next-state state key)) expr-output-back kst/t output keyseq back) (cond ;; proceed to next status - (next-state + ((and next-state + (not (and its-disable-special-action + (eq (its-get-kst/t next-state) t)))) (setq kst/t (its-get-kst/t next-state) output (its-get-output next-state) keyseq (its-get-keyseq next-state)) (cond + ;; Special actions. + ((eq kst/t t) + (funcall emit (cons "" keyseq) state 'its-cursor) + (apply (car output) (cdr output))) + ;; Still, it's a intermediate state. ((its-kst-p kst/t) (funcall emit next-state state nil)) @@ -360,8 +395,8 @@ (funcall emit next-state state 'its-cursor) (its-state-machine-keyseq (substring keyseq kst/t) emit (< key 0))) - ;; Here we arrive to a terminal state. - ;; Emit a DSYL, and go ahead. + ;; Here we arrive to a terminal state. + ;; Emit a DSYL, and go ahead. (t (funcall emit next-state state 'its-cursor)))) @@ -423,18 +458,20 @@ (progn (setq its-setup-fence-before-insert-SYL nil) (its-setup-fence-mode))) - (its-buffer-delete-SYL oldsyl) - (its-update-latest-SYL newsyl) - (let ((p (point))) - (insert (its-get-output newsyl)) - (add-text-properties p (point) - (list 'its-syl newsyl - 'its-map its-current-map - 'its-lang its-current-language - 'intangible 'its-part-1)) - (if its-fence-face - (put-text-property p (point) 'face its-fence-face)) - (its-set-cursor-status cursor))) + (let ((inhibit-read-only t)) + (its-buffer-delete-SYL oldsyl) + (its-update-latest-SYL newsyl) + (let ((p (point))) + (insert (its-get-output newsyl)) + (add-text-properties p (point) + (list 'its-map its-current-map + 'its-syl newsyl + 'egg-lang its-current-language + 'read-only t + 'intangible 'its-part-1)) + (if its-fence-face + (put-text-property p (point) 'face (its-get-fence-face))) + (its-set-cursor-status cursor)))) (defun its-buffer-delete-SYL (syl) (let ((len (length (its-get-output syl)))) @@ -442,7 +479,8 @@ (defun its-get-next-state (state key) (let ((kst/t (its-get-kst/t state))) - (cdr (assq key (car kst/t))))) + (and (listp kst/t) + (cdr (assq key (car kst/t)))))) ;; XXX XXX XXX (defun its-otherwise-match (expr key) @@ -470,9 +508,14 @@ (emit (lambda (nsyl osyl cursor) (its-update-latest-SYL nsyl) cursor)) + (its-current-map its-current-map) + (its-current-select-func its-current-select-func) + (its-current-language its-current-language) + (its-zhuyin its-zhuyin) + (its-previous-select-func its-previous-select-func) cursor) (if (null syl) - (setq (its-initial-ISYL))) + (setq syl (its-initial-ISYL))) (while (and syl (< i len)) (setq cursor (its-state-machine syl (aref keyseq i) emit)) (cond @@ -483,7 +526,7 @@ (t its-latest-SYL)) (setq i (1+ i))) - (if eol + (if (and syl eol) (setq cursor (its-state-machine syl -1 emit))) (not (eq cursor 'its-keyseq-test-failed)))) @@ -579,39 +622,90 @@ Return last state." (defun its-make-next-state (state key keyseq output &optional back) (let ((next-state (its-new-state output keyseq back)) (kst (its-get-kst/t state))) - (if kst - (setcar kst (cons (cons key next-state) (car kst))) + (cond + ((null kst) (its-set-kst state (list (list (cons key next-state))))) + ((consp kst) + (setcar kst (cons (cons key next-state) (car kst)))) + (t + (error "Can't make new state after %S" (its-get-keyseq state)))) next-state)) + +(defmacro its-defrule-select-mode-temporally (input select-func) + `(its-defrule ,input '(its-select-mode-temporally + ,(intern (concat "its-select-" + (symbol-name select-func)))) + t)) ;;; (defun its-beginning-of-input-buffer () (interactive) - (its-input-end) - (if (not (get-text-property (1- (point)) 'its-start)) - (let ((begpos (previous-single-property-change (point) 'its-start))) - ;; Make SYLs have property of "part 2" - (put-text-property begpos (point) 'intangible 'its-part-2) - (goto-char begpos))) - (its-put-cursor t)) + (let ((inhibit-read-only t)) + (its-input-end) + (if (not (get-text-property (1- (point)) 'its-start)) + (let ((begpos (previous-single-property-change (point) 'its-start))) + ;; Make SYLs have property of "part 2" + (put-text-property begpos (point) 'intangible 'its-part-2) + (goto-char begpos))) + (its-put-cursor t))) (defun its-end-of-input-buffer () (interactive) - (its-input-end) - (if (not (get-text-property (point) 'its-end)) - (let ((endpos (next-single-property-change (point) 'its-end))) - ;; Make SYLs have property of "part 1" - (put-text-property (point) endpos 'intangible 'its-part-1) - (goto-char endpos))) - (its-put-cursor t)) + (let ((inhibit-read-only t)) + (its-input-end) + (if (not (get-text-property (point) 'its-end)) + (let ((endpos (next-single-property-change (point) 'its-end))) + ;; Make SYLs have property of "part 1" + (put-text-property (point) endpos 'intangible 'its-part-1) + (goto-char endpos))) + (its-put-cursor t))) + +(defun its-kill-line (n) + (interactive "p") + (let ((inhibit-read-only t) + (p (point))) + (its-input-end) + (if (> n 0) + (cond + ((get-text-property (1- (point)) 'its-start) + (its-cancel-input)) + ((get-text-property (point) 'its-end) + (its-put-cursor t)) + (t + (delete-region (next-single-property-change (point) 'its-end) + (point)) + (its-put-cursor t))) + (cond + ((get-text-property (point) 'its-end) + (its-cancel-input)) + ((get-text-property (1- (point)) 'its-start) + (its-put-cursor t)) + (t + (delete-region (point) + (previous-single-property-change (point) 'its-start)) + (its-put-cursor t)))))) + +(defun its-cancel-input () + (interactive) + (let ((inhibit-read-only t)) + (delete-region (if (get-text-property (1- (point)) 'its-start) + (point) + (previous-single-property-change (1- (point)) 'its-start)) + (if (get-text-property (point) 'its-end) + (point) + (next-single-property-change (point) 'its-end))) + (its-put-cursor t) + (its-exit-mode-internal))) ;; TODO: move in VSYL (defun its-backward-SYL (n) (interactive "p") - (its-input-end) - (let ((syl (get-text-property (1- (point)) 'its-syl)) - (p (point)) - (old-point (point))) + (let ((inhibit-read-only t) + syl p old-point) + (its-input-end) + (setq syl (get-text-property (1- (point)) 'its-syl) + p (point) + old-point (point)) (while (and syl (> n 0)) (setq p (- p (length (its-get-output syl)))) (setq syl (get-text-property (1- p) 'its-syl)) @@ -626,10 +720,12 @@ Return last state." ;; TODO: move in VSYL (defun its-forward-SYL (n) (interactive "p") - (its-input-end) - (let ((syl (get-text-property (point) 'its-syl)) - (p (point)) - (old-point (point))) + (let ((inhibit-read-only t) + syl p old-point) + (its-input-end) + (setq syl (get-text-property (point) 'its-syl) + p (point) + old-point (point)) (while (and syl (> n 0)) (setq p (+ p (length (its-get-output syl)))) (setq syl (get-text-property p 'its-syl)) @@ -644,9 +740,11 @@ Return last state." ;; TODO: handle VSYL. KILLFLAG (defun its-delete-SYL (n killflag) (interactive "p\nP") - (its-input-end) - (let ((syl (get-text-property (point) 'its-syl)) - (p (point))) + (let ((inhibit-read-only t) + syl p) + (its-input-end) + (setq syl (get-text-property (point) 'its-syl) + p (point)) (while (and syl (> n 0)) (setq p (+ p (length (its-get-output syl)))) (setq syl (get-text-property p 'its-syl)) @@ -654,19 +752,19 @@ Return last state." (if (> n 0) (progn (its-put-cursor t) - (signal 'args-out-of-range (list p n))) + (signal 'end-of-buffer nil)) (delete-region (point) p) + (its-put-cursor t) ;; Check if empty - (let ((s (get-text-property (1- (point)) 'its-start)) - (e (get-text-property (point) 'its-end))) - (if (and s e) - (its-exit-mode-internal) - (its-put-cursor t)))))) + (if (and (get-text-property (1- (point)) 'its-start) + (get-text-property (1+ (point)) 'its-end)) + (its-exit-mode-internal))))) ;; TODO: killflag (defun its-delete-backward-SYL (n killflag) (interactive "p\nP") - (let ((syl (get-text-property (1- (point)) 'its-syl)) + (let ((inhibit-read-only t) + (syl (get-text-property (1- (point)) 'its-syl)) (cursor (get-text-property (point) 'its-cursor))) (if (null syl) (signal 'beginning-of-buffer nil) @@ -683,20 +781,20 @@ Return last state." (setq syl (get-text-property (1- p) 'its-syl)) (setq n (1- n))) (if (> n 0) - (signal 'args-out-of-range (list p n)) + (signal 'beginning-of-buffer nil) (delete-region p (1+ (point))) ; also delete cursor + (its-put-cursor t) ;; Check if empty - (let ((s (get-text-property (1- (point)) 'its-start)) - (e (get-text-property (point) 'its-end))) - (if (and s e) - (its-exit-mode-internal) - (its-put-cursor t)))))) + (if (and (get-text-property (1- (point)) 'its-start) + (get-text-property (1+ (point)) 'its-end)) + (its-exit-mode-internal))))) (defvar its-delete-by-keystroke nil) (defun its-delete-backward-SYL-by-keystroke (n killflag) (interactive "p\nP") - (let ((its-delete-by-keystroke t)) + (let ((inhibit-read-only t) + (its-delete-by-keystroke t)) (its-delete-backward-SYL n killflag))) ;; TODO: killflag @@ -705,6 +803,7 @@ Return last state." (len (length keyseq)) (p (- (point) (length (its-get-output syl)))) (its-current-map (get-text-property (1- (point)) 'its-map)) + (its-current-language (get-text-property (1- (point)) 'egg-lang)) back pp) (if (< n 0) (signal 'args-out-of-range (list (- (point) n) (point)))) @@ -743,8 +842,6 @@ Return last state." ;; Check if empty ((and (get-text-property (1- (point)) 'its-start) (get-text-property (1+ (point)) 'its-end)) - ;; Delete CURSOR - (delete-region (point) (1+ (point))) (its-exit-mode-internal)) ((and its-delete-by-keystroke (null (its-concrete-DSYL-p (get-text-property (1- p) 'its-syl)))) @@ -754,7 +851,8 @@ Return last state." (defun its-transpose-chars (n) (interactive "p") - (let ((syl (get-text-property (1- (point)) 'its-syl)) + (let ((inhibit-read-only t) + (syl (get-text-property (1- (point)) 'its-syl)) (cursor (get-text-property (point) 'its-cursor)) keyseq len) (cond @@ -802,6 +900,50 @@ Return last state." (delete-region (- (point) (length (its-get-output syl))) (point)) (its-state-machine-keyseq keyseq 'its-buffer-ins/del-SYL))))))) +(defun its-yank (&optional arg) + (interactive "*P") + (let ((inhibit-read-only t)) + (its-input-end) + (its-put-cursor t) + (yank arg) + (its-setup-yanked-portion (region-beginning) (region-end)))) + +(defun its-yank-pop (arg) + (interactive "*p") + (let ((inhibit-read-only t)) + (its-input-end) + (its-put-cursor t) + (yank-pop arg) + (its-setup-yanked-portion (region-beginning) (region-end)))) + +(defun its-setup-yanked-portion (start end) + (let ((yank-before (eq (point) end)) + (max-sisheng (make-char 'chinese-sisheng 127)) + p syl lang) + (remove-text-properties start end '(intangible nil)) + (egg-separate-languages start end t) + (goto-char start) + (while (< (point) end) + (setq p (point) + lang (get-text-property p 'egg-lang)) + (if (and + (or (equal lang "Chinese-GB") (equal lang "Chinese-CNS")) + (<= (following-char) max-sisheng) + (setq len (egg-chinese-syllable (buffer-substring (point) end)))) + (goto-char (+ (point) len)) + (forward-char)) + (setq syl (buffer-substring-no-properties p (point))) + (put-text-property p (point) 'its-syl (cons syl syl)) + (if its-fence-face + (let ((its-current-language (get-text-property p 'egg-lang))) + (put-text-property p (point) 'face (its-get-fence-face))))) + (if yank-before + (add-text-properties start end '(read-only t intangible its-part-1)) + (add-text-properties start end '(read-only t intangible its-part-2)) + (delete-region (point) (1+ (point))) + (goto-char start) + (its-put-cursor t)))) + ;; Return VOID (defun its-input-end () (let ((cursor (get-text-property (point) 'its-cursor))) @@ -813,43 +955,53 @@ Return last state." (defun its-exit-mode () "Exit ITS mode." (interactive) - (its-input-end) - (its-exit-mode-internal)) + (let ((inhibit-read-only t)) + (its-exit-mode-internal))) (defun its-exit-mode-off-input-method () "Exit ITS mode." (interactive) - (its-input-end) - (its-exit-mode-internal) - (inactivate-input-method)) + (let ((inhibit-read-only t)) + (its-exit-mode-internal) + (inactivate-input-method))) ;; TODO: handle overwrite-mode, insertion-hook, fill... (defun its-exit-mode-internal (&optional proceed-to-conversion) - (let (start end) + (let (start end s e) + (its-select-previous-mode t) + ;; Delete CURSOR + (delete-region (point) (1+ (point))) ;; Delete open fence - (if (get-text-property (1- (point)) 'its-start) - (setq start (1- (point))) - (setq start (1- (previous-single-property-change (point) 'its-start)))) - (delete-region start (1+ start)) + (setq s (if (get-text-property (1- (point)) 'its-start) + (point) + (previous-single-property-change (point) 'its-start)) + start (- s (length its-fence-open))) + (delete-region start s) ;; Delete close fence - (if (get-text-property (point) 'its-end) - (setq end (point)) - (setq end (next-single-property-change (point) 'its-end))) - (delete-region end (1+ end)) - ;; Remove all properties added by ITS - (remove-text-properties start end '(its-map nil - face nil - intangible nil)) + (setq end (if (get-text-property (point) 'its-end) + (point) + (next-single-property-change (point) 'its-end)) + e (+ end (length its-fence-close))) + (delete-region end e) (if proceed-to-conversion (egg-convert-region start end) - (remove-text-properties start end '(its-lang nil its-syl nil)) + ;; Remove all properties + (set-text-properties start end nil) (egg-do-auto-fill) (run-hooks 'input-method-after-insert-chunk-hook)))) (defun its-kick-convert-region () (interactive) - (its-input-end) - (its-exit-mode-internal t)) + (let ((inhibit-read-only t)) + (its-exit-mode-internal t))) + +(defun its-kick-convert-region-or-self-insert () + (interactive) + (let ((syl (and (null (get-text-property (point) 'its-cursor)) + (get-text-property (1- (point)) 'its-syl)))) + (if (its-keyseq-acceptable-p (vector last-command-char) syl) + (its-self-insert-char) + (its-kick-convert-region)))) (defun its-in-fence-p () (eq (get-text-property (point) 'intangible) 'its-part-2)) @@ -866,14 +1018,14 @@ Return last state." (oldlen (length its-translation-result))) (setq its-translation-result (concat its-translation-result output)) (put-text-property oldlen (length its-translation-result) - 'its-lang its-current-language + 'egg-lang its-current-language its-translation-result))) cursor) (defun its-translate-region (start end) (interactive "r") (its-translate-region-internal start end) - (remove-text-properties start (point) '(its-lang nil))) + (set-text-properties start (point) nil)) (defun its-translate-region-internal (start end) (setq its-translation-result "") @@ -895,5 +1047,28 @@ Return last state." (delete-region start end) (insert its-translation-result))) +(defun its-set-mode-line-title () + (let ((title (its-get-indicator its-current-map))) + (setq current-input-method-title (if its-previous-select-func + (concat "<" title ">") + title)) + (force-mode-line-update))) + +(defun its-select-mode-temporally (func) + (let ((select-func its-current-select-func)) + (funcall func) + (if (null its-previous-select-func) + (setq its-previous-select-func select-func)) + (its-set-mode-line-title))) + +(defun its-select-previous-mode (&optional quiet) + (interactive) + (if (null its-previous-select-func) + (if (null quiet) + (beep)) + (funcall its-previous-select-func) + (setq its-previous-select-func nil) + (its-set-mode-line-title))) + (provide 'its) ;;; its.el ends here. diff --git a/its/ascii.el b/its/ascii.el new file mode 100644 index 0000000..272a340 --- /dev/null +++ b/its/ascii.el @@ -0,0 +1,55 @@ +;;; its/ascii.el --- ASCII Input in Egg Input Method Architecture + +;; Copyright (C) 1997, 1998 Mule Project, +;; Powered by Electrotechnical Laboratory, JAPAN. +;; Project Leader: Satoru Tomura + +;; Author: KATAYAMA Yoshio + +;; This file will be part of GNU Emacs (in future). + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: +;; +;; Symbol input is desined by jiro@math.keio.ac.jp (TANAKA Jiro) +;; This file is based on the rules of its/hira.el in Mule-2.3 distribution. +;; + +;;; Code: + +(eval-when-compile + (require 'its)) + +(define-its-state-machine its-up-map + "upcase" "aA" nil nil + "Map for upcase input." + + (let ((i ? )) + (while (<= i ?~) + (its-defrule (char-to-string i) (upcase (char-to-string i))) + (setq i (1+ i))))) + +(define-its-state-machine its-down-map + "downcase" "aa" nil nil + "Map for downcase input." + + (let ((i ? )) + (while (<= i ?~) + (its-defrule (char-to-string i) (char-to-string i)) + (setq i (1+ i))))) + +(provide 'its/ascii) diff --git a/its/erpin.el b/its/erpin.el new file mode 100644 index 0000000..db0665b --- /dev/null +++ b/its/erpin.el @@ -0,0 +1,387 @@ +(eval-when-compile + (require 'its) + (require 'cl)) + +(defvar its-erpin-cn-enable-quanjioao-alphabet t "*Enable Quanjiao alphabet") +(defvar its-erpin-cn-open-braket "$A!8(B" "*[") ; "$A#[(B" +(defvar its-erpin-cn-close-braket "$A!9(B" "*]") ; "$A#](B" + +(defvar its-erpin-tw-enable-quanjioao-alphabet t "*Enable Quanjiao alphabet") +(defvar its-erpin-tw-open-braket "$(G!V(B" "*[") ; "$(G!b(B " +(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)) + + (defmacro its-do-erpin-table (list) + `(progn + ,@(mapcar (lambda (syl) + `(its-define-erpin ,(car syl) ,(cdr syl))) + list))) + + (defmacro its-define-erpin (shengmu yunmu) + `(let ((y1 (nth 1 ,yunmu)) (y2 (nth 2 ,yunmu)) (y3 (nth 3 ,yunmu)) + (y4 (nth 4 ,yunmu)) (y5 (nth 5 ,yunmu)) (y (car ,yunmu)) + (ss (list ,@shengmu)) sa sd state) + (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")) + (setq ss (cdr ss))))) + + (defmacro its-define-erpin-table () + '(let ((O '("o" . "")) (B '("b" . "B")) (C '("c" . "C")) (D '("d" . "D")) + (F '("f" . "F")) (G '("g" . "G")) (H '("h" . "H")) (J '("j" . "J")) + (K '("k" . "K")) (L '("l" . "L")) (M '("m" . "M")) (N '("n" . "N")) + (P '("p" . "P")) (Q '("q" . "Q")) (R '("r" . "R")) (S '("s" . "S")) + (T '("t" . "T")) (W '("w" . "W")) (X '("x" . "X")) (Y '("y" . "Y")) + (Z '("z" . "Z")) + (I '("i" . "Ch")) (U '("u" . "Sh")) (V '("v" . "Zh")) + + (a '("a" "(0!(B" "(0"(B" "(0#(B" "(0$(B" "a" )) + (ai '("s" "(0!(Bi" "(0"(Bi" "(0#(Bi" "(0$(Bi" "ai" )) + (an '("f" "(0!(Bn" "(0"(Bn" "(0#(Bn" "(0$(Bn" "an" )) + (ang '("g" "(0!(Bng" "(0"(Bng" "(0#(Bng" "(0$(Bng" "ang" )) + (ao '("d" "(0!(Bo" "(0"(Bo" "(0#(Bo" "(0$(Bo" "ao" )) + (e '("e" "(0%(B" "(0&(B" "(0'(B" "(0((B" "e" )) + (ei '("w" "(0%(Bi" "(0&(Bi" "(0'(Bi" "(0((Bi" "ei" )) + (en '("r" "(0%(Bn" "(0&(Bn" "(0'(Bn" "(0((Bn" "en" )) + (eng '("t" "(0%(Bng" "(0&(Bng" "(0'(Bng" "(0((Bng" "eng" )) + (er '("y" "(0%(Br" "(0&(Br" "(0'(Br" "(0((Br" "er" )) + (i '("i" "(0)(B" "(0*(B" "(0+(B" "(0,(B" "i" )) + (ia '("p" "i(0!(B" "i(0"(B" "i(0#(B" "i(0$(B" "ia" )) + (ian '("h" "i(0!(Bn" "i(0"(Bn" "i(0#(Bn" "i(0$(Bn" "ian" )) + (iang '("j" "i(0!(Bng" "i(0"(Bng" "i(0#(Bng" "i(0$(Bng" "iang")) + (iao '("k" "i(0!(Bo" "i(0"(Bo" "i(0#(Bo" "i(0$(Bo" "iao" )) + (ie '("l" "i(0%(B" "i(0&(B" "i(0'(B" "i(0((B" "ie" )) + (in '("m" "(0)(Bn" "(0*(Bn" "(0+(Bn" "(0,(Bn" "in" )) + (ing '("n" "(0)(Bng" "(0*(Bng" "(0+(Bng" "(0,(Bng" "ing" )) + (iong '("b" "i(0-(Bng" "i(0.(Bng" "i(0/(Bng" "i(00(Bng" "iong")) + (iu '("y" "i(01(B" "i(02(B" "i(03(B" "i(04(B" "iu" )) + (o '("o" "(0-(B" "(0.(B" "(0/(B" "(00(B" "o" )) + (ong '("b" "(0-(Bng" "(0.(Bng" "(0/(Bng" "(00(Bng" "ong" )) + (ou '("q" "(0-(Bu" "(0.(Bu" "(0/(Bu" "(00(Bu" "ou" )) + (u '("u" "(01(B" "(02(B" "(03(B" "(04(B" "u" )) + (v '("v" "(05(B" "(06(B" "(07(B" "(08(B" "(09(B" )) + (ua '("p" "u(0!(B" "u(0"(B" "u(0#(B" "u(0$(B" "ua" )) + (uai '("k" "u(0!(Bi" "u(0"(Bi" "u(0#(Bi" "u(0$(Bi" "uai" )) + (uan '("x" "u(0!(Bn" "u(0"(Bn" "u(0#(Bn" "u(0$(Bn" "uan" )) + (uang '("j" "u(0!(Bng" "u(0"(Bng" "u(0#(Bng" "u(0$(Bng" "uang")) + (ue '("c" "u(0%(B" "u(0&(B" "u(0'(B" "u(0((B" "ue" )) + (ve '("c" "(09%(B" "(09&(B" "(09'(B" "(09((B" "(09(Be" )) + (ui '("c" "u(0)(B" "u(0*(B" "u(0+(B" "u(0,(B" "ui" )) + (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) + ((O B C D F G H K L M N P R S T W Y Z I U V) . an) + ((O B C D F G H K L M N P R S T W Y Z I U V) . ang) + ((O B C D G H K L M N P R S T Y Z I U V) . ao) + ((O C D G H K L M N R S T Y Z I U V) . e) + ((O B C D F G H K L M N P T W Z U V) . ei) + ((O B C D F G H K M N P R S W Z I U V) . en) + ((O B C D F G H K L M N P R S T W Z I U V) . eng) + ((O ) . er) + (( B C D J L M N P Q R S T X Y Z I U V) . i) + (( D J L Q X ) . ia) + (( B D J L M N P Q T X ) . ian) + (( J L N Q X ) . iang) + (( B D J L M N P Q T X ) . iao) + (( B D J L M N P Q T X ) . ie) + (( B J L M N P Q X Y ) . in) + (( B D J L M N P Q T X Y ) . ing) + (( J Q X ) . iong) + (( D J L M N Q X ) . iu) + ((O B F M P W Y ) . o) + (( C D G H K L N R S T Y Z I V) . ong) + ((O C D F G H K L M N P R S T Y Z I U V) . ou) + (( B C D F G H J K L M N P Q R S T W X Y Z I U V) . u) + (( L N ) . v) + (( G H K R I U V) . ua) + (( G H K I U V) . uai) + (( C D G H J K L N Q R S T X Y Z I U V) . uan) + (( G H K I U V) . uang) + (( J Q X Y ) . ue) + (( L N ) . ve) + (( C D G H K R S T Z I U V) . ui) + (( C D G H J K L Q R S T X Y Z I U V) . un) + (( C D G H K L N R S T Z I U V) . uo) + + (('("" . "")) . (cons "er" (cdr er))) + + ((J Q X) . (cons "a" (cdr ia ))) + ((J Q X) . (cons "s" (cdr ia ))) + ((J Q X) . (cons "f" (cdr ian ))) + ((J Q X) . (cons "g" (cdr iang))) + ((J Q X) . (cons "d" (cdr iao ))) + ((J Q X) . (cons "e" (cdr ie ))) + ((J Q X) . (cons "w" (cdr ie ))) + ((J Q X) . (cons "r" (cdr in ))) + ((J Q X) . (cons "t" (cdr ing ))) + ((J Q X) . (cons "q" (cdr iu ))))) + + (its-define-erpin-qingsheng H "m") + (its-define-erpin-qingsheng H "n" "ng") + (its-define-erpin-qingsheng O "m") + (its-define-erpin-qingsheng O "n") + + (its-defrule "on5" "ng(0@(B") + (its-defrule "on2" "(0=@(B") + (its-defrule "on3" "(0>@(B") + (its-defrule "on4" "(0?@(B")))) + +(define-its-state-machine its-erpin-cn-map + "erpin-cn" "$A6~(BG" "Chinese-GB" + "Map for Erpin input. (Chinese-GB)" + + (defconst its-quanjiao-escape "Z") + (defconst its-banjiao-escape "X") + + (its-defrule-select-mode-temporally "B" downcase) + (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") + + (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") + ("8" . "$A#8(B") ("9" . "$A#9(B") + (" " . "$A!!(B") ("!" . "$A#!(B") ("@" . "$A#@(B") ("#" . "$A##(B") + ("$" . "$A!g(B") ("%" . "$A#%(B") ("^" . "$A#^(B") ("&" . "$A#&(B") + ("*" . "$A#*(B") ("(" . "$A#((B") (")" . "$A#)(B") + ("-" . "$A#-(B") ("=" . "$A#=(B") ("`" . "$A#`(B") ("\\" . "$A#\(B") + ("|" . "$A#|(B") ("_" . "$A#_(B") ("+" . "$A#+(B") ("~" . "$A!+(B") + ("[" . "$A#[(B") ("]" . "$A#](B") ("{" . "$A#{(B") ("}" . "$A#}(B") + (":" . "$A#:(B") (";" . "$A#;(B") ("\"" . "$A#"(B") ("'" . "$A#'(B") + ("<" . "$A#<(B") (">" . "$A#>(B") ("?" . "$A#?(B") ("/" . "$A#/(B") + ("," . "$A#,(B") ("." . "$A#.(B") + ("a" . "$A#a(B") ("b" . "$A#b(B") ("c" . "$A#c(B") ("d" . "$A#d(B") + ("e" . "$A#e(B") ("f" . "$A#f(B") ("g" . "$A#g(B") ("h" . "$A#h(B") + ("i" . "$A#i(B") ("j" . "$A#j(B") ("k" . "$A#k(B") ("l" . "$A#l(B") + ("m" . "$A#m(B") ("n" . "$A#n(B") ("o" . "$A#o(B") ("p" . "$A#p(B") + ("q" . "$A#q(B") ("r" . "$A#r(B") ("s" . "$A#s(B") ("t" . "$A#t(B") + ("u" . "$A#u(B") ("v" . "$A#v(B") ("w" . "$A#w(B") ("x" . "$A#x(B") + ("y" . "$A#y(B") ("z" . "$A#z(B") + ("A" . "$A#A(B") ("B" . "$A#B(B") ("C" . "$A#C(B") ("D" . "$A#D(B") + ("E" . "$A#E(B") ("F" . "$A#F(B") ("G" . "$A#G(B") ("H" . "$A#H(B") + ("I" . "$A#I(B") ("J" . "$A#J(B") ("K" . "$A#K(B") ("L" . "$A#L(B") + ("M" . "$A#M(B") ("N" . "$A#N(B") ("O" . "$A#O(B") ("P" . "$A#P(B") + ("Q" . "$A#Q(B") ("R" . "$A#R(B") ("S" . "$A#S(B") ("T" . "$A#T(B") + ("U" . "$A#U(B") ("V" . "$A#V(B") ("W" . "$A#W(B") ("X" . "$A#X(B") + ("Y" . "$A#Y(B") ("Z" . "$A#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule (concat its-banjiao-escape in) in) + (its-defrule (concat its-quanjiao-escape in) out))) + + (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 "!" "$A#!(B")) + +(define-its-state-machine its-erpin-tw-map + "erpin-tw" "$(GD((BC" "Chinese-CNS" + "Map for Erpin input." + + (defconst its-quanjiao-escape "Z") + (defconst its-banjiao-escape "X") + + (its-defrule-select-mode-temporally "B" downcase) + (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") + + (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") + ("8" . "$(G$)(B") ("9" . "$(G$*(B") + (" " . "$(G!!(B") ("!" . "$(G!*(B") ("@" . "$(G"i(B") ("#" . "$(G!l(B") + ("$" . "$(G"c(B") ("%" . "$(G"h(B") ("^" . "$(G!T(B") ("&" . "$(G!m(B") + ("*" . "$(G!n(B") ("(" . "$(G!>(B") (")" . "$(G!?(B") + ("-" . "$(G"1(B") ("=" . "$(G"8(B") ("`" . "$(G!j(B") ("\\" . "$(G"b(B") + ("|" . "$(G"^(B") ("_" . "$(G"%(B") ("+" . "$(G"0(B") ("~" . "$(G"D(B") + ("[" . "$(G!b(B") ("]" . "$(G!c(B") ("{" . "$A#{(B") ("}" . "$(G!a(B") + (":" . "$(G!((B") (";" . "$(G!'(B") ("\"" . "$(G!i(B") ("'" . "$(G!k(B") + ("<" . "$(G"6(B") (">" . "$(G"7(B") ("?" . "$(G!)(B") ("/" . "$(G"a(B") + ("," . "$(G!"(B") ("." . "$(G!%(B") + ("a" . "$(G$[(B") ("b" . "$(G$\(B") ("c" . "$(G$](B") ("d" . "$(G$^(B") + ("e" . "$(G$_(B") ("f" . "$(G$`(B") ("g" . "$(G$a(B") ("h" . "$(G$b(B") + ("i" . "$(G$c(B") ("j" . "$(G$d(B") ("k" . "$(G$e(B") ("l" . "$(G$f(B") + ("m" . "$(G$g(B") ("n" . "$(G$h(B") ("o" . "$(G$i(B") ("p" . "$(G$j(B") + ("q" . "$(G$k(B") ("r" . "$(G$l(B") ("s" . "$(G$m(B") ("t" . "$(G$n(B") + ("u" . "$(G$o(B") ("v" . "$(G$p(B") ("w" . "$(G$q(B") ("x" . "$(G$r(B") + ("y" . "$(G$s(B") ("z" . "$(G$t(B") + ("A" . "$(G$A(B") ("B" . "$(G$B(B") ("C" . "$(G$C(B") ("D" . "$(G$D(B") + ("E" . "$(G$E(B") ("F" . "$(G$F(B") ("G" . "$(G$G(B") ("H" . "$(G$H(B") + ("I" . "$(G$I(B") ("J" . "$(G$J(B") ("K" . "$(G$K(B") ("L" . "$(G$L(B") + ("M" . "$(G$M(B") ("N" . "$(G$N(B") ("O" . "$(G$O(B") ("P" . "$(G$P(B") + ("Q" . "$(G$Q(B") ("R" . "$(G$R(B") ("S" . "$(G$S(B") ("T" . "$(G$T(B") + ("U" . "$(G$U(B") ("V" . "$(G$V(B") ("W" . "$(G$W(B") ("X" . "$(G$X(B") + ("Y" . "$(G$Y(B") ("Z" . "$(G$Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule (concat its-banjiao-escape in) in) + (its-defrule (concat its-quanjiao-escape in) out))) + + (its-defrule "," "$(G!"(B") + (its-defrule "." "$(G!$(B") + (its-defrule "/" "$(G!#(B") + (its-defrule ":" "$(G!((B") + (its-defrule ";" "$(G!'(B") + (its-defrule "?" "$(G!)(B") + (its-defrule "!" "$(G!*(B")) + +(define-its-state-machine-append its-erpin-cn-map + (its-defrule "[" its-erpin-cn-open-braket) + (its-defrule "]" its-erpin-cn-close-braket) + + (if its-erpin-cn-enable-quanjioao-alphabet + (progn + (its-defrule "1" "$A#1(B") (its-defrule "2" "$A#2(B") + (its-defrule "3" "$A#3(B") (its-defrule "4" "$A#4(B") + (its-defrule "5" "$A#5(B") (its-defrule "6" "$A#6(B") + (its-defrule "7" "$A#7(B") (its-defrule "8" "$A#8(B") + (its-defrule "9" "$A#9(B") (its-defrule "0" "$A#0(B") + (its-defrule "@" "$A#@(B") + (its-defrule "#" "$A##(B") (its-defrule "$" "$A!g(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") + (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 "_" "$A#_(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") (its-defrule ">" "$A#>(B")) + (progn + (its-defrule "1" "1") (its-defrule "2" "2") + (its-defrule "3" "3") (its-defrule "4" "4") + (its-defrule "5" "5") (its-defrule "6" "6") + (its-defrule "7" "7") (its-defrule "8" "8") + (its-defrule "9" "9") (its-defrule "0" "0") + (its-defrule "@" "@") + (its-defrule "#" "#") (its-defrule "$" "$") + (its-defrule "%" "%") (its-defrule "^" "^") + (its-defrule "&" "&") (its-defrule "*" "*") + (its-defrule "(" "(") (its-defrule ")" ")") + (its-defrule "-" "-") (its-defrule "~" "~") + (its-defrule "=" "=") (its-defrule "`" "`") + (its-defrule "\\" "\\") (its-defrule "|" "|") + (its-defrule "_" "_") (its-defrule "+" "+") + (its-defrule "{" "{") (its-defrule "}" "}") + (its-defrule "\"" "\"") (its-defrule "'" "'") + (its-defrule "<" "<") (its-defrule ">" ">")))) + +(define-its-state-machine-append its-erpin-tw-map + (its-defrule "[" its-erpin-tw-open-braket) + (its-defrule "]" its-erpin-tw-close-braket) + + (if its-erpin-tw-enable-quanjioao-alphabet + (progn + (its-defrule "1" "$(G$"(B") (its-defrule "2" "$(G$#(B") + (its-defrule "3" "$(G$$(B") (its-defrule "4" "$(G$%(B") + (its-defrule "5" "$(G$&(B") (its-defrule "6" "$(G$'(B") + (its-defrule "7" "$(G$((B") (its-defrule "8" "$(G$)(B") + (its-defrule "9" "$(G$*(B") (its-defrule "0" "$(G$!(B") + (its-defrule "@" "$(G"i(B") + (its-defrule "#" "$(G!l(B") (its-defrule "$" "$(G"c(B") + (its-defrule "%" "$(G"h(B") (its-defrule "^" "$(G!T(B") + (its-defrule "&" "$(G!m(B") (its-defrule "*" "$(G!n(B") + (its-defrule "(" "$(G!>(B") (its-defrule ")" "$(G!?(B") + (its-defrule "-" "$(G"1(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"0(B") + (its-defrule "{" "$A#{(B") (its-defrule "}" "$(G!a(B") + (its-defrule "\"" "$(G!i(B") (its-defrule "'" "$(G!k(B") + (its-defrule "<" "$(G"6(B") (its-defrule ">" "$(G"7(B")) + (progn + (its-defrule "1" "1") (its-defrule "2" "2") + (its-defrule "3" "3") (its-defrule "4" "4") + (its-defrule "5" "5") (its-defrule "6" "6") + (its-defrule "7" "7") (its-defrule "8" "8") + (its-defrule "9" "9") (its-defrule "0" "0") + (its-defrule "@" "@") + (its-defrule "#" "#") (its-defrule "$" "$") + (its-defrule "%" "%") (its-defrule "^" "^") + (its-defrule "&" "&") (its-defrule "*" "*") + (its-defrule "(" "(") (its-defrule ")" ")") + (its-defrule "-" "-") (its-defrule "~" "~") + (its-defrule "=" "=") (its-defrule "`" "`") + (its-defrule "\\" "\\") (its-defrule "|" "|") + (its-defrule "_" "_") (its-defrule "+" "+") + (its-defrule "{" "{") (its-defrule "}" "}") + (its-defrule "\"" "\"") (its-defrule "'" "'") + (its-defrule "<" "<") (its-defrule ">" ">")))) + +(provide 'its/erpin) diff --git a/its/hangul.el b/its/hangul.el index a37f32e..888c434 100644 --- a/its/hangul.el +++ b/its/hangul.el @@ -1,15 +1,45 @@ +;;; its/hangul.el --- Hangul Input in Egg Input Method Architecture + +;; Copyright (C) 1997, 1998 Mule Project, +;; Powered by Electrotechnical Laboratory, JAPAN. +;; Project Leader: Satoru Tomura + +;; Author: NIIBE Yutaka +;; KATAYAMA Yoshio + +;; This file will be part of GNU Emacs (in future). + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + (eval-when-compile (require 'its) (require 'cl)) +(defvar its-hangul-enable-jeonkak-alphabet t "*Enable Jeonkak alphabet") +(defvar its-hangul-period ". " "*$(C#.(B") ; ". " "$(C#.(B" +(defvar its-hangul-comma ", " "*$(C#,(B") ; ", " "$(C#,(B" (defvar its-hangul-open-bracket "$(C!8(B" "*[") ; "$(C#[(B" -(defvar its-hangul-close-bracket "$(C!9(B" "*]") ; "$(C#](B" +(defvar its-hangul-close-bracket "$(C!9(B" "*]") ; "$(C#](B" (eval-when-compile - - (defvar its-jeonkak-escape "J") - (defvar its-pankak-escape "B") - (defconst its-hangul-kijuhynbmlopOP (its-make-class+back "[kijuhynbmlopOP]" -2)) (defconst its-hangul-kijuhynbmlopP @@ -51,8 +81,15 @@ (its-defrule-otherwise state output)))) (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") + (defconst its-pankak-escape "X") + + (its-defrule-select-mode-temporally "B" downcase) + (its-defrule-select-mode-temporally "J" jeonkak-downcase) + (its-defrule-hangul "r" "$(C$!(B") (its-defrule-hangul "s" "$(C$$(B") (its-defrule-hangul "e" "$(C$'(B") @@ -2795,70 +2832,82 @@ (its-define-hangul "glt" "$(CH}(B" kijuhynbmlopOP) (its-define-hangul "gld" "$(CH~(B" kijuhynbmlopOP)) - ;;; Jeonkak Symbols - - (its-defrule "1" "$(C#1(B") - (its-defrule "2" "$(C#2(B") - (its-defrule "3" "$(C#3(B") - (its-defrule "4" "$(C#4(B") - (its-defrule "5" "$(C#5(B") - (its-defrule "6" "$(C#6(B") - (its-defrule "7" "$(C#7(B") - (its-defrule "8" "$(C#8(B") - (its-defrule "9" "$(C#9(B") - (its-defrule "0" "$(C#0(B") - - ;;(its-defrule " " "$(C!!(B") - (its-defrule "!" "$(C#!(B") - (its-defrule "@" "$(C#@(B") - (its-defrule "#" "$(C##(B") - (its-defrule "$" "$(C#$(B") - (its-defrule "%" "$(C#%(B") - (its-defrule "^" "$(C#^(B") - (its-defrule "&" "$(C#&(B") - (its-defrule "*" "$(C#*(B") - (its-defrule "(" "$(C#((B") - (its-defrule ")" "$(C#)(B") - (its-defrule "-" "$(C#-(B") - (its-defrule "=" "$(C#=(B") - (its-defrule "`" "$(C#`(B") - (its-defrule "\\" "$(C#\(B") - (its-defrule "|" "$(C#|(B") - (its-defrule "_" "$(C#_(B") - (its-defrule "+" "$(C#+(B") - (its-defrule "~" "$(C#~(B") - (its-defrule "[" "$(C!8(B");;(its-defrule "[" "$(C#[(B") - (its-defrule "]" "$(C!9(B");;(its-defrule "]" "$(C#](B") - (its-defrule "{" "$(C#{(B") - (its-defrule "}" "$(C#}(B") - (its-defrule ":" "$(C#:(B") - (its-defrule ";" "$(C#;(B") - (its-defrule "\"" "$(C#"(B") - (its-defrule "'" "$(C#'(B") - (its-defrule "<" "$(C#<(B") - (its-defrule ">" "$(C#>(B") - (its-defrule "?" "$(C#?(B") - (its-defrule "/" "$(C#/(B") - (its-defrule "," "$(C#,(B") - (its-defrule "." "$(C#.(B") - - (its-defrule (concat its-jeonkak-escape " ") "$(C!!(B") - (let ((i ?!)) - (while (<= i ?~) - (its-defrule (concat its-jeonkak-escape (char-to-string i)) - (char-to-string (+ (- ?$(C#!(B ?!) i))) - (setq i (1+ i)))) - - ;;; pankak - (let ((i ?!)) - (while (<= i ?~) - (its-defrule (concat its-pankak-escape (char-to-string i)) - (char-to-string i)) - (setq i (1+ i))))) + (dolist (ascii '(("1" . "$(C#1(B") ("2" . "$(C#2(B") ("3" . "$(C#3(B") ("4" . "$(C#4(B") + ("5" . "$(C#5(B") ("6" . "$(C#6(B") ("7" . "$(C#7(B") ("8" . "$(C#8(B") + ("9" . "$(C#9(B") ("0" . "$(C#0(B") + (" " . "$(C!!(B") ("!" . "$(C#!(B") ("@" . "$(C#@(B") ("#" . "$(C##(B") + ("$" . "$(C#$(B") ("%" . "$(C#%(B") ("^" . "$(C#^(B") ("&" . "$(C#&(B") + ("*" . "$(C#*(B") ("(" . "$(C#((B") (")" . "$(C#)(B") + ("-" . "$(C#-(B") ("=" . "$(C#=(B") ("`" . "$(C#`(B") ("\\" . "$(C#\(B") + ("|" . "$(C#|(B") ("_" . "$(C#_(B") ("+" . "$(C#+(B") ("~" . "$(C#~(B") + ("[" . "$(C!8(B") ("]" . "$(C!9(B") ("{" . "$(C#{(B") ("}" . "$(C#}(B") + (":" . "$(C#:(B") (";" . "$(C#;(B") ("\"" . "$(C#"(B") ("'" . "$(C#'(B") + ("<" . "$(C#<(B") (">" . "$(C#>(B") ("?" . "$(C#?(B") ("/" . "$(C#/(B") + ("," . "$(C#,(B") ("." . "$(C#.(B") + ("a" . "$(C#a(B") ("b" . "$(C#b(B") ("c" . "$(C#c(B") ("d" . "$(C#d(B") + ("e" . "$(C#e(B") ("f" . "$(C#f(B") ("g" . "$(C#g(B") ("h" . "$(C#h(B") + ("i" . "$(C#i(B") ("j" . "$(C#j(B") ("k" . "$(C#k(B") ("l" . "$(C#l(B") + ("m" . "$(C#m(B") ("n" . "$(C#n(B") ("o" . "$(C#o(B") ("p" . "$(C#p(B") + ("q" . "$(C#q(B") ("r" . "$(C#r(B") ("s" . "$(C#s(B") ("t" . "$(C#t(B") + ("u" . "$(C#u(B") ("v" . "$(C#v(B") ("w" . "$(C#w(B") ("x" . "$(C#x(B") + ("y" . "$(C#y(B") ("z" . "$(C#z(B") + ("A" . "$(C#A(B") ("B" . "$(C#B(B") ("C" . "$(C#C(B") ("D" . "$(C#D(B") + ("E" . "$(C#E(B") ("F" . "$(C#F(B") ("G" . "$(C#G(B") ("H" . "$(C#H(B") + ("I" . "$(C#I(B") ("J" . "$(C#J(B") ("K" . "$(C#K(B") ("L" . "$(C#L(B") + ("M" . "$(C#M(B") ("N" . "$(C#N(B") ("O" . "$(C#O(B") ("P" . "$(C#P(B") + ("Q" . "$(C#Q(B") ("R" . "$(C#R(B") ("S" . "$(C#S(B") ("T" . "$(C#T(B") + ("U" . "$(C#U(B") ("V" . "$(C#V(B") ("W" . "$(C#W(B") ("X" . "$(C#X(B") + ("Y" . "$(C#Y(B") ("Z" . "$(C#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule (concat its-pankak-escape in) in) + (its-defrule (concat its-jeonkak-escape in) out)))) (define-its-state-machine-append its-hangul-map - (its-defrule "[" its-hangul-open-bracket nil t) - (its-defrule "]" its-hangul-close-bracket nil t) - ) + (its-defrule "[" its-hangul-open-bracket) + (its-defrule "]" its-hangul-close-bracket) + (its-defrule "." its-hangul-period) + (its-defrule "," its-hangul-comma) + + (if its-hangul-enable-jeonkak-alphabet + (progn + (its-defrule "1" "$(C#1(B") (its-defrule "2" "$(C#2(B") + (its-defrule "3" "$(C#3(B") (its-defrule "4" "$(C#4(B") + (its-defrule "5" "$(C#5(B") (its-defrule "6" "$(C#6(B") + (its-defrule "7" "$(C#7(B") (its-defrule "8" "$(C#8(B") + (its-defrule "9" "$(C#9(B") (its-defrule "0" "$(C#0(B") + (its-defrule "!" "$(C#!(B") (its-defrule "@" "$(C#@(B") + (its-defrule "#" "$(C##(B") (its-defrule "$" "$(C#$(B") + (its-defrule "%" "$(C#%(B") (its-defrule "^" "$(C#^(B") + (its-defrule "&" "$(C#&(B") (its-defrule "*" "$(C#*(B") + (its-defrule "(" "$(C#((B") (its-defrule ")" "$(C#)(B") + (its-defrule "-" "$(C#-(B") (its-defrule "~" "$(C#~(B") + (its-defrule "=" "$(C#=(B") (its-defrule "`" "$(C#`(B") + (its-defrule "\\" "$(C#\(B") (its-defrule "|" "$(C#|(B") + (its-defrule "_" "$(C#_(B") (its-defrule "+" "$(C#+(B") + (its-defrule "{" "$(C#{(B") (its-defrule "}" "$(C#}(B") + (its-defrule ":" "$(C#:(B") (its-defrule ";" "$(C#;(B") + (its-defrule "\"" "$(C#"(B") (its-defrule "'" "$(C#'(B") + (its-defrule "<" "$(C#<(B") (its-defrule ">" "$(C#>(B") + (its-defrule "?" "$(C#?(B") (its-defrule "/" "$(C#/(B")) + (progn + (its-defrule "1" "1") (its-defrule "2" "2") + (its-defrule "3" "3") (its-defrule "4" "4") + (its-defrule "5" "5") (its-defrule "6" "6") + (its-defrule "7" "7") (its-defrule "8" "8") + (its-defrule "9" "9") (its-defrule "0" "0") + (its-defrule "!" "!") (its-defrule "@" "@") + (its-defrule "#" "#") (its-defrule "$" "$") + (its-defrule "%" "%") (its-defrule "^" "^") + (its-defrule "&" "&") (its-defrule "*" "*") + (its-defrule "(" "(") (its-defrule ")" ")") + (its-defrule "-" "-") (its-defrule "~" "~") + (its-defrule "=" "=") (its-defrule "`" "`") + (its-defrule "\\" "\\") (its-defrule "|" "|") + (its-defrule "_" "_") (its-defrule "+" "+") + (its-defrule "{" "{") (its-defrule "}" "}") + (its-defrule ":" ":") (its-defrule ";" ";") + (its-defrule "\"" "\"") (its-defrule "'" "'") + (its-defrule "<" "<") (its-defrule ">" ">") + (its-defrule "?" "?") (its-defrule "/" "/")))) (provide 'its/hangul) diff --git a/its/hankata.el b/its/hankata.el new file mode 100644 index 0000000..fc51124 --- /dev/null +++ b/its/hankata.el @@ -0,0 +1,291 @@ +;;; its/hankata.el --- Hnakaku Katakana Input in Egg Input Method Architecture + +;; Copyright (C) 1997, 1998 Mule Project, +;; Powered by Electrotechnical Laboratory, JAPAN. +;; Project Leader: Satoru Tomura + +;; Author: Satoru Tomura + +;; This file will be part of GNU Emacs (in future). + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: +;; +;; Symbol input is desined by jiro@math.keio.ac.jp (TANAKA Jiro) +;; This file is based on the rules of its/kata.el in Mule-2.3 distribution. +;; + +;;; Code: + +(eval-when-compile + (require 'its) + (require 'cl)) + +(defvar its-kata-enable-double-n nil "*Enable \"nn\" input for \"$B%s(B\" ") +(defvar its-kata-enable-zenkaku-alphabet t "*Enable Zenkaku alphabet") +(defvar its-kata-period "(I!(B" "*$B%T%j%*%I(B") ; ". " "$B!%(B" +(defvar its-kata-comma "(I$(B" "*$B%3%s%^(B") ; ", " "$B!$(B" +(defvar its-kata-open-bracket "(I"(B" "*[") ; "$B!N(B" +(defvar its-kata-close-bracket "(I#(B" "*]") ; "$B!O(B" +(defvar its-kata-horizontal "(I0(B" "*-") ; "$B!](B" + +(define-its-state-machine its-han-kata-map + "roma-han-kata" "(I11(B" "Japanese" nil + "Map for Romaji-Hankaku-Katakana translation. (Japanese)" + + (defconst its-hankaku-escape "~") ;; Escape character to Hankaku inputs + + (its-defrule-select-mode-temporally "q" downcase) + +;;; k k +;;; kk $B%C(Bk +;;; kka $B%C%+(B +;;; +;;; kkk $B%C(Bk DING! + + (its-defrule "tch" "(I/(B" -2) + +;;; $B!V%s!W$NF~NO(B + + (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")) + + (let ((small '"x" )) + (its-defrule (concat small "a") "(I'(B") + (its-defrule (concat small "i") "(I((B") + (its-defrule (concat small "u") "(I)(B") + (its-defrule (concat small "e") "(I*(B") + (its-defrule (concat small "o") "(I+(B") + (its-defrule (concat small "ya") "(I,(B") + (its-defrule (concat small "yu") "(I-(B") + (its-defrule (concat small "yo") "(I.(B") + (its-defrule (concat small "tu") "(I/(B") + (its-defrule (concat small "tsu") "(I/(B") + (its-defrule (concat small "wa") "(I\(B") + ) + + (its-defrule "a" "(I1(B") + (its-defrule "i" "(I2(B") + (its-defrule "u" "(I3(B") + (its-defrule "e" "(I4(B") + (its-defrule "o" "(I5(B") + + (dolist (k '(("ka" "(I6(B") ("ki" "(I7(B") ("ku" "(I8(B") ("ke" "(I9(B") ("ko" "(I:(B") + ("kya" "(I7,(B") ("kyu" "(I7-(B") ("kye" "(I7*(B") ("kyo" "(I7.(B"))) + (its-defrule (car k) (cadr k)) + (its-defrule (concat "k" (car k)) (concat "(I/(B" (cadr k)))) + (its-defoutput "kk" "(I/(Bk") + (its-defoutput "kky" "(I/(Bky") + + (dolist (s '(("sa" "(I;(B") ("si" "(I<(B") ("su" "(I=(B") ("se" "(I>(B") ("so" "(I?(B") + ("sya" "(I<,(B") ("syu" "(I<-(B") ("sye" "(I<*(B") ("syo" "(I<.(B") + ("sha" "(I<,(B") ("shi" "(I<(B") ("shu" "(I<-(B") ("she" "(I<*(B") + ("sho" "(I<.(B"))) + (its-defrule (car s) (cadr s)) + (its-defrule (concat "s" (car s)) (concat "(I/(B" (cadr s)))) + (its-defoutput "ss" "(I/(Bs") + (its-defoutput "ssy" "(I/(Bsy") + (its-defoutput "ssh" "(I/(Bsh") + + (dolist (T '(("ta" "(I@(B") ("ti" "(IA(B") ("tu" "(IB(B") ("te" "(IC(B") ("to" "(ID(B") + ("tya" "(IA,(B") ("tyi" "(IC((B") ("tyu" "(IA-(B") ("tye" "(IA*(B") + ("tyo" "(IA.(B") ("tsu" "(IB(B"))) + (its-defrule (car T) (cadr T)) + (its-defrule (concat "t" (car T)) (concat "(I/(B" (cadr T)))) + (its-defoutput "tt" "(I/(Bt") + (its-defoutput "tty" "(I/(Bty") + (its-defoutput "tts" "(I/(Bts") + + (dolist (c '(("cha" "(IA,(B") ("chi" "(IA(B") ("chu" "(IA-(B") + ("che" "(IA*(B") ("cho" "(IA.(B"))) + (its-defrule (car c) (cadr c)) + (its-defrule (concat "c" (car c)) (concat "(I/(B" (cadr c)))) + (its-defoutput "cc" "(I/(Bc") + (its-defoutput "cch" "(I/(Bch") + + (dolist (h '(("ha" "(IJ(B") ("hi" "(IK(B") ("hu" "(IL(B") ("he" "(IM(B") ("ho" "(IN(B") + ("hya" "(IK,(B") ("hyu" "(IK-(B") ("hye" "(IK*(B") ("hyo" "(IK.(B"))) + (its-defrule (car h) (cadr h)) + (its-defrule (concat "h" (car h)) (concat "(I/(B" (cadr h)))) + (its-defoutput "hh" "(I/(Bh") + (its-defoutput "hhy" "(I/(Bhy") + + (dolist (f '(("fa" "(IL'(B") ("fi" "(IL((B") ("fu" "(IL(B") ("fe" "(IL*(B") + ("fo" "(IL+(B"))) + (its-defrule (car f) (cadr f)) + (its-defrule (concat "f" (car f)) (concat "(I/(B" (cadr f)))) + (its-defoutput "ff" "(I/(Bf") + + (dolist (r '(("ra" "(IW(B") ("ri" "(IX(B") ("ru" "(IY(B") ("re" "(IZ(B") ("ro" "(I[(B") + ("rya" "(IX,(B") ("ryu" "(IX-(B") ("rye" "(IX*(B") ("ryo" "(IX.(B"))) + (its-defrule (car r) (cadr r)) + (its-defrule (concat "r" (car r)) (concat "(I/(B" (cadr r)))) + (its-defoutput "rr" "(I/(Br") + (its-defoutput "rry" "(I/(Bry") + + (dolist (l '(("la" "(IW(B") ("li" "(IX(B") ("lu" "(IY(B") ("le" "(IZ(B") ("lo" "(I[(B") + ("lya" "(IX,(B") ("lyu" "(IX-(B") ("lye" "(IX*(B") ("lyo" "(IX.(B"))) + (its-defrule (car l) (cadr l)) + (its-defrule (concat "l" (car l)) (concat "(I/(B" (cadr l)))) + (its-defoutput "ll" "(I/(Bl") + (its-defoutput "lly" "(I/(Bly") + + (dolist (g '(("ga" "(I6^(B") ("gi" "(I7^(B") ("gu" "(I8^(B") ("ge" "(I9^(B") ("go" "(I:^(B") + ("gya" "(I7^,(B") ("gyu" "(I7^-(B") ("gye" "(I7^*(B") ("gyo" "(I7^.(B"))) + (its-defrule (car g) (cadr g)) + (its-defrule (concat "g" (car g)) (concat "(I/(B" (cadr g)))) + (its-defoutput "gg" "(I/(Bg") + (its-defoutput "ggy" "(I/(Bgy") + + (dolist (z '(("za" "(I;^(B") ("zi" "(I<^(B") ("zu" "(I=^(B") ("ze" "(I>^(B") ("zo" "(I?^(B") + ("zya" "(I<^,(B") ("zyu" "(I<^-(B") ("zye" "(I<^*(B") ("zyo" "(I<^.(B"))) + (its-defrule (car z) (cadr z)) + (its-defrule (concat "z" (car z)) (concat "(I/(B" (cadr z)))) + (its-defoutput "zz" "(I/(Bz") + (its-defoutput "zzy" "(I/(Bzy") + + (dolist (j '(("ja" "(I<^,(B") ("ji" "(I<^(B") ("ju" "(I<^-(B") ("je" "(I<^*(B") + ("jo" "(I<^.(B") ("jya" "(I<^,(B") ("jyu" "(I<^-(B") ("jye" "(I<^*(B") + ("jyo" "(I<^.(B"))) + (its-defrule (car j) (cadr j)) + (its-defrule (concat "j" (car j)) (concat "(I/(B" (cadr j)))) + (its-defoutput "jj" "(I/(Bj") + (its-defoutput "jjy" "(I/(Bjy") + + (dolist (d '(("da" "(I@^(B") ("di" "(IA^(B") ("du" "(IB^(B") ("de" "(IC^(B") ("do" "(ID^(B") + ("dya" "(IA^,(B") ("dyi" "(IC^((B") ("dyu" "(IA^-(B") ("dye" "(IA^*(B") + ("dyo" "(IA^.(B"))) + (its-defrule (car d) (cadr d)) + (its-defrule (concat "d" (car d)) (concat "(I/(B" (cadr d)))) + (its-defoutput "dd" "(I/(Bd") + (its-defoutput "ddy" "(I/(Bdy") + + (dolist (b '(("ba" "(IJ^(B") ("bi" "(IK^(B") ("bu" "(IL^(B") ("be" "(IM^(B") ("bo" "(IN^(B") + ("bya" "(IK^,(B") ("byu" "(IK^-(B") ("bye" "(IK^*(B") ("byo" "(IK^.(B"))) + (its-defrule (car b) (cadr b)) + (its-defrule (concat "b" (car b)) (concat "(I/(B" (cadr b)))) + (its-defoutput "bb" "(I/(Bb") + (its-defoutput "bby" "(I/(Bby") + + (dolist (p '(("pa" "(IJ_(B") ("pi" "(IK_(B") ("pu" "(IL_(B") ("pe" "(IM_(B") ("po" "(IN_(B") + ("pya" "(IK_,(B") ("pyu" "(IK_-(B") ("pye" "(IK_*(B") ("pyo" "(IK_.(B"))) + (its-defrule (car p) (cadr p)) + (its-defrule (concat "p" (car p)) (concat "(I/(B" (cadr p)))) + (its-defoutput "pp" "(I/(Bp") + (its-defoutput "ppy" "(I/(Bpy") + + (dolist (v '(("va" "(I3^'(B") ("vi" "(I3^((B") ("vu" "(I3^(B") ("ve" "(I3^*(B") + ("vo" "(I3^+(B"))) + (its-defrule (car v) (cadr v)) + (its-defrule (concat "v" (car v)) (concat "(I/(B" (cadr v)))) + (its-defoutput "vv" "(I/(Bv") + + (its-defrule "ma" "(IO(B") + (its-defrule "mi" "(IP(B") + (its-defrule "mu" "(IQ(B") + (its-defrule "me" "(IR(B") + (its-defrule "mo" "(IS(B") + (its-defrule "mya" "(IP,(B") + (its-defrule "myu" "(IP-(B") + (its-defrule "mye" "(IP*(B") + (its-defrule "myo" "(IP.(B") + (its-defrule "ya" "(IT(B") + (its-defrule "yi" "(I2(B") + (its-defrule "yu" "(IU(B") + (its-defrule "yo" "(IV(B") + (its-defrule "ye" "(I2*(B") + (its-defrule "wa" "(I\(B") + (its-defrule "wi" "(I((B") + (its-defrule "wu" "(I3(B") + (its-defrule "we" "(I*(B") + (its-defrule "wo" "(I&(B") + + (its-defrule "kwa" "(I8\(B") + (its-defrule "kwi" "(I8((B") + (its-defrule "kwu" "(I8(B") + (its-defrule "kwe" "(I8*(B") + (its-defrule "kwo" "(I8+(B") + (its-defrule "gwa" "(I8^\(B") + (its-defrule "gwi" "(I8^((B") + (its-defrule "gwu" "(I8^(B") + (its-defrule "gwe" "(I8^*(B") + (its-defrule "gwo" "(I8^+(B") + (its-defrule "tsa" "(IB'(B") + (its-defrule "tsi" "(IB((B") + (its-defrule "tse" "(IB*(B") + (its-defrule "tso" "(IB+(B") + + (its-defrule "na" "(IE(B") + (its-defrule "ni" "(IF(B") + (its-defrule "nu" "(IG(B") + (its-defrule "ne" "(IH(B") + (its-defrule "no" "(II(B") + (its-defrule "nya" "(IF,(B") + (its-defrule "nyu" "(IF-(B") + (its-defrule "nye" "(IF*(B") + (its-defrule "nyo" "(IF.(B") + + (its-defrule "xti" "(IC((B") + (its-defrule "xdi" "(IC^((B") + (its-defrule "xdu" "(ID^)(B") + (its-defrule "xde" "(IC^*(B") + (its-defrule "xdo" "(ID^+(B") + (its-defrule "xwi" "(I3((B") + (its-defrule "xwe" "(I3*(B") + (its-defrule "xwo" "(I3+(B") + +;;; +;;; Symbol inputs +;;; + + (dolist (digit '( "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" )) + (its-defrule (concat its-hankaku-escape digit) digit)) + + (dolist (symbol '( " " "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" + "-" "=" "`" "\\" "|" "_" "+" "~" "[" "]" "{" "}" + ":" ";" "\"" "'" "<" ">" "?" "/" "," "." )) + (its-defrule (concat its-hankaku-escape symbol) symbol)) + + (dolist (downcase '("a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" + "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z")) + (its-defrule (concat its-hankaku-escape downcase) downcase)) + + (dolist (upcase '("A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" + "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z")) + (its-defrule (concat its-hankaku-escape upcase) upcase))) + +(define-its-state-machine-append its-han-kata-map + (if its-kata-enable-double-n + (its-defrule "nn" "(I](B") + (its-defrule "nn" "(I](B" -1)) + + (its-defrule "-" its-kata-horizontal) + (its-defrule "[" its-kata-open-bracket) + (its-defrule "]" its-kata-close-bracket) + (its-defrule "." its-kata-period) + (its-defrule "," its-kata-comma) + ) + +(provide 'its/hankata) +;;; its/kata.el ends here. diff --git a/its/hira.el b/its/hira.el index a08cec9..051dcc6 100644 --- a/its/hira.el +++ b/its/hira.el @@ -47,9 +47,13 @@ (define-its-state-machine its-hira-map "roma-kana" "$B$"(B" "Japanese" nil "Map for Romaji-Hiragana translation. (Japanese)" + (defconst its-zenkaku-escape "Z") ;; Escape character to Zenkaku inputs (defconst its-hankaku-escape "~") ;; Escape character to Hankaku inputs + (its-defrule-select-mode-temporally "q" downcase) + (its-defrule-select-mode-temporally "Q" zenkaku-downcase) + ;;; k k ;;; kk $B$C(Bk ;;; kka $B$C$+(B @@ -434,9 +438,9 @@ (its-defrule "nn" "$B$s(B") (its-defrule "nn" "$B$s(B" -1)) - (its-defrule "-" its-hira-horizontal) - (its-defrule "[" its-hira-open-bracket) - (its-defrule "]" its-hira-close-bracket) + (its-defrule "-" its-hira-horizontal) + (its-defrule "[" its-hira-open-bracket) + (its-defrule "]" its-hira-close-bracket) (its-defrule "." its-hira-period) (its-defrule "," its-hira-comma) @@ -455,13 +459,11 @@ (its-defrule "=" "$B!a(B") (its-defrule "`" "$B!.(B") (its-defrule "\\" "$B!o(B") (its-defrule "|" "$B!C(B") (its-defrule "_" "$B!2(B") (its-defrule "+" "$B!\(B") - (its-defrule "~" "$B!1(B" nil t) - (its-defrule "{" "$B!P(B") - (its-defrule "}" "$B!Q(B") (its-defrule ":" "$B!'(B") - (its-defrule ";" "$B!((B") (its-defrule "\"" "$B!I(B") - (its-defrule "'" "$B!G(B") (its-defrule "<" "$B!c(B") - (its-defrule ">" "$B!d(B") (its-defrule "?" "$B!)(B") - (its-defrule "/" "$B!?(B")) + (its-defrule "{" "$B!P(B") (its-defrule "}" "$B!Q(B") + (its-defrule ":" "$B!'(B") (its-defrule ";" "$B!((B") + (its-defrule "\"" "$B!I(B") (its-defrule "'" "$B!G(B") + (its-defrule "<" "$B!c(B") (its-defrule ">" "$B!d(B") + (its-defrule "?" "$B!)(B") (its-defrule "/" "$B!?(B")) (progn (its-defrule "1" "1") (its-defrule "2" "2") (its-defrule "3" "3") (its-defrule "4" "4") @@ -474,15 +476,13 @@ (its-defrule "&" "&") (its-defrule "*" "*") (its-defrule "(" "(") (its-defrule ")" ")") (its-defrule "=" "=") (its-defrule "`" "`") - (its-defrule "\\" "\\") (its-defrule "|" "|") + (its-defrule "\\" "\\") (its-defrule "|" "|") (its-defrule "_" "_") (its-defrule "+" "+") - (its-defrule "~" "~" nil t) - (its-defrule "{" "{") - (its-defrule "}" "}") (its-defrule ":" ":") - (its-defrule ";" ";") (its-defrule "\"" "\"") - (its-defrule "'" "'") (its-defrule "<" "<") - (its-defrule ">" ">") (its-defrule "?" "?") - (its-defrule "/" "/"))) + (its-defrule "{" "{") (its-defrule "}" "}") + (its-defrule ":" ":") (its-defrule ";" ";") + (its-defrule "\"" "\"") (its-defrule "'" "'") + (its-defrule "<" "<") (its-defrule ">" ">") + (its-defrule "?" "?") (its-defrule "/" "/"))) ) (provide 'its/hira) diff --git a/its/jeonkak.el b/its/jeonkak.el new file mode 100644 index 0000000..2baedfe --- /dev/null +++ b/its/jeonkak.el @@ -0,0 +1,103 @@ +;;; its/jeonkak.el --- Jeonkak ASCII Input in Egg Input Method Architecture + +;; Copyright (C) 1997, 1998 Mule Project, +;; Powered by Electrotechnical Laboratory, JAPAN. +;; Project Leader: Satoru Tomura + +;; Author: KATAYAMA Yoshio + +;; This file will be part of GNU Emacs (in future). + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: +;; +;; Symbol input is desined by jiro@math.keio.ac.jp (TANAKA Jiro) +;; This file is based on the rules of its/hira.el in Mule-2.3 distribution. +;; + +;;; Code: + +(eval-when-compile + (require 'its)) + +(define-its-state-machine its-jeonkak-up-map + "jeonkak-upcase" "$(C#A(B" "Korean" nil + "Map for jeonkak-upcase input." + + (dolist (ascii '(("1" . "$(C#1(B") ("2" . "$(C#2(B") ("3" . "$(C#3(B") ("4" . "$(C#4(B") + ("5" . "$(C#5(B") ("6" . "$(C#6(B") ("7" . "$(C#7(B") ("8" . "$(C#8(B") + ("9" . "$(C#9(B") ("0" . "$(C#0(B") + (" " . "$(C!!(B") ("!" . "$(C#!(B") ("@" . "$(C#@(B") ("#" . "$(C##(B") + ("$" . "$(C#$(B") ("%" . "$(C#%(B") ("^" . "$(C#^(B") ("&" . "$(C#&(B") + ("*" . "$(C#*(B") ("(" . "$(C#((B") (")" . "$(C#)(B") + ("-" . "$(C#-(B") ("=" . "$(C#=(B") ("`" . "$(C#`(B") ("\\" . "$(C#\(B") + ("|" . "$(C#|(B") ("_" . "$(C#_(B") ("+" . "$(C#+(B") ("~" . "$(C#~(B") + ("[" . "$(C!8(B") ("]" . "$(C!9(B") ("{" . "$(C#{(B") ("}" . "$(C#}(B") + (":" . "$(C#:(B") (";" . "$(C#;(B") ("\"" . "$(C#"(B") ("'" . "$(C#'(B") + ("<" . "$(C#<(B") (">" . "$(C#>(B") ("?" . "$(C#?(B") ("/" . "$(C#/(B") + ("," . "$(C#,(B") ("." . "$(C#.(B") + ("a" . "$(C#A(B") ("b" . "$(C#B(B") ("c" . "$(C#C(B") ("d" . "$(C#D(B") + ("e" . "$(C#E(B") ("f" . "$(C#F(B") ("g" . "$(C#G(B") ("h" . "$(C#H(B") + ("i" . "$(C#I(B") ("j" . "$(C#J(B") ("k" . "$(C#K(B") ("l" . "$(C#L(B") + ("m" . "$(C#M(B") ("n" . "$(C#N(B") ("o" . "$(C#O(B") ("p" . "$(C#P(B") + ("q" . "$(C#Q(B") ("r" . "$(C#R(B") ("s" . "$(C#S(B") ("t" . "$(C#T(B") + ("u" . "$(C#U(B") ("v" . "$(C#V(B") ("w" . "$(C#W(B") ("x" . "$(C#X(B") + ("y" . "$(C#Y(B") ("z" . "$(C#Z(B") + ("A" . "$(C#A(B") ("B" . "$(C#B(B") ("C" . "$(C#C(B") ("D" . "$(C#D(B") + ("E" . "$(C#E(B") ("F" . "$(C#F(B") ("G" . "$(C#G(B") ("H" . "$(C#H(B") + ("I" . "$(C#I(B") ("J" . "$(C#J(B") ("K" . "$(C#K(B") ("L" . "$(C#L(B") + ("M" . "$(C#M(B") ("N" . "$(C#N(B") ("O" . "$(C#O(B") ("P" . "$(C#P(B") + ("Q" . "$(C#Q(B") ("R" . "$(C#R(B") ("S" . "$(C#S(B") ("T" . "$(C#T(B") + ("U" . "$(C#U(B") ("V" . "$(C#V(B") ("W" . "$(C#W(B") ("X" . "$(C#X(B") + ("Y" . "$(C#Y(B") ("Z" . "$(C#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule in out)))) + +(define-its-state-machine its-jeonkak-down-map + "jeonkak-downcase" "$(C#a(B" "Korean" nil + "Map for jeonkak-downcase input." + + (dolist (ascii '(("1" . "$(C#1(B") ("2" . "$(C#2(B") ("3" . "$(C#3(B") ("4" . "$(C#4(B") + ("5" . "$(C#5(B") ("6" . "$(C#6(B") ("7" . "$(C#7(B") ("8" . "$(C#8(B") + ("9" . "$(C#9(B") ("0" . "$(C#0(B") + (" " . "$(C!!(B") ("!" . "$(C#!(B") ("@" . "$(C#@(B") ("#" . "$(C##(B") + ("$" . "$(C#$(B") ("%" . "$(C#%(B") ("^" . "$(C#^(B") ("&" . "$(C#&(B") + ("*" . "$(C#*(B") ("(" . "$(C#((B") (")" . "$(C#)(B") + ("-" . "$(C#-(B") ("=" . "$(C#=(B") ("`" . "$(C#`(B") ("\\" . "$(C#\(B") + ("|" . "$(C#|(B") ("_" . "$(C#_(B") ("+" . "$(C#+(B") ("~" . "$(C#~(B") + ("[" . "$(C!8(B") ("]" . "$(C!9(B") ("{" . "$(C#{(B") ("}" . "$(C#}(B") + (":" . "$(C#:(B") (";" . "$(C#;(B") ("\"" . "$(C#"(B") ("'" . "$(C#'(B") + ("<" . "$(C#<(B") (">" . "$(C#>(B") ("?" . "$(C#?(B") ("/" . "$(C#/(B") + ("," . "$(C#,(B") ("." . "$(C#.(B") + ("a" . "$(C#a(B") ("b" . "$(C#b(B") ("c" . "$(C#c(B") ("d" . "$(C#d(B") + ("e" . "$(C#e(B") ("f" . "$(C#f(B") ("g" . "$(C#g(B") ("h" . "$(C#h(B") + ("i" . "$(C#i(B") ("j" . "$(C#j(B") ("k" . "$(C#k(B") ("l" . "$(C#l(B") + ("m" . "$(C#m(B") ("n" . "$(C#n(B") ("o" . "$(C#o(B") ("p" . "$(C#p(B") + ("q" . "$(C#q(B") ("r" . "$(C#r(B") ("s" . "$(C#s(B") ("t" . "$(C#t(B") + ("u" . "$(C#u(B") ("v" . "$(C#v(B") ("w" . "$(C#w(B") ("x" . "$(C#x(B") + ("y" . "$(C#y(B") ("z" . "$(C#z(B") + ("A" . "$(C#A(B") ("B" . "$(C#B(B") ("C" . "$(C#C(B") ("D" . "$(C#D(B") + ("E" . "$(C#E(B") ("F" . "$(C#F(B") ("G" . "$(C#G(B") ("H" . "$(C#H(B") + ("I" . "$(C#I(B") ("J" . "$(C#J(B") ("K" . "$(C#K(B") ("L" . "$(C#L(B") + ("M" . "$(C#M(B") ("N" . "$(C#N(B") ("O" . "$(C#O(B") ("P" . "$(C#P(B") + ("Q" . "$(C#Q(B") ("R" . "$(C#R(B") ("S" . "$(C#S(B") ("T" . "$(C#T(B") + ("U" . "$(C#U(B") ("V" . "$(C#V(B") ("W" . "$(C#W(B") ("X" . "$(C#X(B") + ("Y" . "$(C#Y(B") ("Z" . "$(C#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule in out)))) + +(provide 'its/jeonkak) diff --git a/its/kata.el b/its/kata.el new file mode 100644 index 0000000..b138b66 --- /dev/null +++ b/its/kata.el @@ -0,0 +1,489 @@ +;;; its/kata.el --- Katakana Input in Egg Input Method Architecture + +;; Copyright (C) 1997, 1998 Mule Project, +;; Powered by Electrotechnical Laboratory, JAPAN. +;; Project Leader: Satoru Tomura + +;; Author: Satoru Tomura +;; jiro@math.keio.ac.jp (TANAKA Jiro) + +;; This file will be part of GNU Emacs (in future). + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: +;; +;; Symbol input is desined by jiro@math.keio.ac.jp (TANAKA Jiro) +;; This file is based on the rules of its/kata.el in Mule-2.3 distribution. +;; + +;;; Code: + +(eval-when-compile + (require 'its) + (require 'cl)) + +(defvar its-kata-enable-double-n nil "*Enable \"nn\" input for \"$B%s(B\" ") +(defvar its-kata-enable-zenkaku-alphabet t "*Enable Zenkaku alphabet") +(defvar its-kata-period "$B!#(B" "*$B%T%j%*%I(B") ; ". " "$B!%(B" +(defvar its-kata-comma "$B!"(B" "*$B%3%s%^(B") ; ", " "$B!$(B" +(defvar its-kata-open-bracket "$B!V(B" "*[") ; "$B!N(B" +(defvar its-kata-close-bracket "$B!W(B" "*]") ; "$B!O(B" +(defvar its-kata-horizontal "$B!<(B" "*-") ; "$B!](B" + +(define-its-state-machine its-kata-map + "roma-kata" "$B%"(B" "Japanese" nil + "Map for Romaji-Katakana translation. (Japanese)" + + (defconst its-zenkaku-escape "Z") ;; Escape character to Zenkaku inputs + (defconst its-hankaku-escape "~") ;; Escape character to Hankaku inputs + + (its-defrule-select-mode-temporally "q" downcase) + (its-defrule-select-mode-temporally "Q" zenkaku-downcase) + +;;; k k +;;; kk $B%C(Bk +;;; kka $B%C%+(B +;;; +;;; kkk $B%C(Bk DING! + + (its-defrule "tch" "$B%C(B" -2) + +;;; $B!V%s!W$NF~NO(B + + (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")) + + (let ((small '"x" )) + (its-defrule (concat small "a") "$B%!(B") + (its-defrule (concat small "i") "$B%#(B") + (its-defrule (concat small "u") "$B%%(B") + (its-defrule (concat small "e") "$B%'(B") + (its-defrule (concat small "o") "$B%)(B") + (its-defrule (concat small "ya") "$B%c(B") + (its-defrule (concat small "yu") "$B%e(B") + (its-defrule (concat small "yo") "$B%g(B") + (its-defrule (concat small "tu") "$B%C(B") + (its-defrule (concat small "tsu") "$B%C(B") + (its-defrule (concat small "wa") "$B%n(B") + ) + + (its-defrule "a" "$B%"(B") + (its-defrule "i" "$B%$(B") + (its-defrule "u" "$B%&(B") + (its-defrule "e" "$B%((B") + (its-defrule "o" "$B%*(B") + + (dolist (k '(("ka" "$B%+(B") ("ki" "$B%-(B") ("ku" "$B%/(B") ("ke" "$B%1(B") ("ko" "$B%3(B") + ("kya" "$B%-%c(B") ("kyu" "$B%-%e(B") ("kye" "$B%-%'(B") ("kyo" "$B%-%g(B"))) + (its-defrule (car k) (cadr k)) + (its-defrule (concat "k" (car k)) (concat "$B%C(B" (cadr k)))) + (its-defoutput "kk" "$B%C(Bk") + (its-defoutput "kky" "$B%C(Bky") + + (dolist (s '(("sa" "$B%5(B") ("si" "$B%7(B") ("su" "$B%9(B") ("se" "$B%;(B") ("so" "$B%=(B") + ("sya" "$B%7%c(B") ("syu" "$B%7%e(B") ("sye" "$B%7%'(B") ("syo" "$B%7%g(B") + ("sha" "$B%7%c(B") ("shi" "$B%7(B") ("shu" "$B%7%e(B") ("she" "$B%7%'(B") + ("sho" "$B%7%g(B"))) + (its-defrule (car s) (cadr s)) + (its-defrule (concat "s" (car s)) (concat "$B%C(B" (cadr s)))) + (its-defoutput "ss" "$B%C(Bs") + (its-defoutput "ssy" "$B%C(Bsy") + (its-defoutput "ssh" "$B%C(Bsh") + + (dolist (T '(("ta" "$B%?(B") ("ti" "$B%A(B") ("tu" "$B%D(B") ("te" "$B%F(B") ("to" "$B%H(B") + ("tya" "$B%A%c(B") ("tyi" "$B%F%#(B") ("tyu" "$B%A%e(B") ("tye" "$B%A%'(B") + ("tyo" "$B%A%g(B") ("tsu" "$B%D(B"))) + (its-defrule (car T) (cadr T)) + (its-defrule (concat "t" (car T)) (concat "$B%C(B" (cadr T)))) + (its-defoutput "tt" "$B%C(Bt") + (its-defoutput "tty" "$B%C(Bty") + (its-defoutput "tts" "$B%C(Bts") + + (dolist (c '(("cha" "$B%A%c(B") ("chi" "$B%A(B") ("chu" "$B%A%e(B") + ("che" "$B%A%'(B") ("cho" "$B%A%g(B"))) + (its-defrule (car c) (cadr c)) + (its-defrule (concat "c" (car c)) (concat "$B%C(B" (cadr c)))) + (its-defoutput "cc" "$B%C(Bc") + (its-defoutput "cch" "$B%C(Bch") + + (dolist (h '(("ha" "$B%O(B") ("hi" "$B%R(B") ("hu" "$B%U(B") ("he" "$B%X(B") ("ho" "$B%[(B") + ("hya" "$B%R%c(B") ("hyu" "$B%R%e(B") ("hye" "$B%R%'(B") ("hyo" "$B%R%g(B"))) + (its-defrule (car h) (cadr h)) + (its-defrule (concat "h" (car h)) (concat "$B%C(B" (cadr h)))) + (its-defoutput "hh" "$B%C(Bh") + (its-defoutput "hhy" "$B%C(Bhy") + + (dolist (f '(("fa" "$B%U%!(B") ("fi" "$B%U%#(B") ("fu" "$B%U(B") ("fe" "$B%U%'(B") + ("fo" "$B%U%)(B"))) + (its-defrule (car f) (cadr f)) + (its-defrule (concat "f" (car f)) (concat "$B%C(B" (cadr f)))) + (its-defoutput "ff" "$B%C(Bf") + + (dolist (r '(("ra" "$B%i(B") ("ri" "$B%j(B") ("ru" "$B%k(B") ("re" "$B%l(B") ("ro" "$B%m(B") + ("rya" "$B%j%c(B") ("ryu" "$B%j%e(B") ("rye" "$B%j%'(B") ("ryo" "$B%j%g(B"))) + (its-defrule (car r) (cadr r)) + (its-defrule (concat "r" (car r)) (concat "$B%C(B" (cadr r)))) + (its-defoutput "rr" "$B%C(Br") + (its-defoutput "rry" "$B%C(Bry") + + (dolist (l '(("la" "$B%i(B") ("li" "$B%j(B") ("lu" "$B%k(B") ("le" "$B%l(B") ("lo" "$B%m(B") + ("lya" "$B%j%c(B") ("lyu" "$B%j%e(B") ("lye" "$B%j%'(B") ("lyo" "$B%j%g(B"))) + (its-defrule (car l) (cadr l)) + (its-defrule (concat "l" (car l)) (concat "$B%C(B" (cadr l)))) + (its-defoutput "ll" "$B%C(Bl") + (its-defoutput "lly" "$B%C(Bly") + + (dolist (g '(("ga" "$B%,(B") ("gi" "$B%.(B") ("gu" "$B%0(B") ("ge" "$B%2(B") ("go" "$B%4(B") + ("gya" "$B%.%c(B") ("gyu" "$B%.%e(B") ("gye" "$B%.%'(B") ("gyo" "$B%.%g(B"))) + (its-defrule (car g) (cadr g)) + (its-defrule (concat "g" (car g)) (concat "$B%C(B" (cadr g)))) + (its-defoutput "gg" "$B%C(Bg") + (its-defoutput "ggy" "$B%C(Bgy") + + (dolist (z '(("za" "$B%6(B") ("zi" "$B%8(B") ("zu" "$B%:(B") ("ze" "$B%<(B") ("zo" "$B%>(B") + ("zya" "$B%8%c(B") ("zyu" "$B%8%e(B") ("zye" "$B%8%'(B") ("zyo" "$B%8%g(B"))) + (its-defrule (car z) (cadr z)) + (its-defrule (concat "z" (car z)) (concat "$B%C(B" (cadr z)))) + (its-defoutput "zz" "$B%C(Bz") + (its-defoutput "zzy" "$B%C(Bzy") + + (dolist (j '(("ja" "$B%8%c(B") ("ji" "$B%8(B") ("ju" "$B%8%e(B") ("je" "$B%8%'(B") + ("jo" "$B%8%g(B") ("jya" "$B%8%c(B") ("jyu" "$B%8%e(B") ("jye" "$B%8%'(B") + ("jyo" "$B%8%g(B"))) + (its-defrule (car j) (cadr j)) + (its-defrule (concat "j" (car j)) (concat "$B%C(B" (cadr j)))) + (its-defoutput "jj" "$B%C(Bj") + (its-defoutput "jjy" "$B%C(Bjy") + + (dolist (d '(("da" "$B%@(B") ("di" "$B%B(B") ("du" "$B%E(B") ("de" "$B%G(B") ("do" "$B%I(B") + ("dya" "$B%B%c(B") ("dyi" "$B%G%#(B") ("dyu" "$B%B%e(B") ("dye" "$B%B%'(B") + ("dyo" "$B%B%g(B"))) + (its-defrule (car d) (cadr d)) + (its-defrule (concat "d" (car d)) (concat "$B%C(B" (cadr d)))) + (its-defoutput "dd" "$B%C(Bd") + (its-defoutput "ddy" "$B%C(Bdy") + + (dolist (b '(("ba" "$B%P(B") ("bi" "$B%S(B") ("bu" "$B%V(B") ("be" "$B%Y(B") ("bo" "$B%\(B") + ("bya" "$B%S%c(B") ("byu" "$B%S%e(B") ("bye" "$B%S%'(B") ("byo" "$B%S%g(B"))) + (its-defrule (car b) (cadr b)) + (its-defrule (concat "b" (car b)) (concat "$B%C(B" (cadr b)))) + (its-defoutput "bb" "$B%C(Bb") + (its-defoutput "bby" "$B%C(Bby") + + (dolist (p '(("pa" "$B%Q(B") ("pi" "$B%T(B") ("pu" "$B%W(B") ("pe" "$B%Z(B") ("po" "$B%](B") + ("pya" "$B%T%c(B") ("pyu" "$B%T%e(B") ("pye" "$B%T%'(B") ("pyo" "$B%T%g(B"))) + (its-defrule (car p) (cadr p)) + (its-defrule (concat "p" (car p)) (concat "$B%C(B" (cadr p)))) + (its-defoutput "pp" "$B%C(Bp") + (its-defoutput "ppy" "$B%C(Bpy") + + (dolist (v '(("va" "$B%t%!(B") ("vi" "$B%t%#(B") ("vu" "$B%t(B") ("ve" "$B%t%'(B") + ("vo" "$B%t%)(B"))) + (its-defrule (car v) (cadr v)) + (its-defrule (concat "v" (car v)) (concat "$B%C(B" (cadr v)))) + (its-defoutput "vv" "$B%C(Bv") + + (its-defrule "ma" "$B%^(B") + (its-defrule "mi" "$B%_(B") + (its-defrule "mu" "$B%`(B") + (its-defrule "me" "$B%a(B") + (its-defrule "mo" "$B%b(B") + (its-defrule "mya" "$B%_%c(B") + (its-defrule "myu" "$B%_%e(B") + (its-defrule "mye" "$B%_%'(B") + (its-defrule "myo" "$B%_%g(B") + (its-defrule "ya" "$B%d(B") + (its-defrule "yi" "$B%$(B") + (its-defrule "yu" "$B%f(B") + (its-defrule "yo" "$B%h(B") + (its-defrule "ye" "$B%$%'(B") + (its-defrule "wa" "$B%o(B") + (its-defrule "wi" "$B%p(B") + (its-defrule "wu" "$B%&(B") + (its-defrule "we" "$B%q(B") + (its-defrule "wo" "$B%r(B") + + (its-defrule "kwa" "$B%/%n(B") + (its-defrule "kwi" "$B%/%#(B") + (its-defrule "kwu" "$B%/(B") + (its-defrule "kwe" "$B%/%'(B") + (its-defrule "kwo" "$B%/%)(B") + (its-defrule "gwa" "$B%0%n(B") + (its-defrule "gwi" "$B%0%#(B") + (its-defrule "gwu" "$B%0(B") + (its-defrule "gwe" "$B%0%'(B") + (its-defrule "gwo" "$B%0%)(B") + (its-defrule "tsa" "$B%D%!(B") + (its-defrule "tsi" "$B%D%#(B") + (its-defrule "tse" "$B%D%'(B") + (its-defrule "tso" "$B%D%)(B") + + (its-defrule "na" "$B%J(B") + (its-defrule "ni" "$B%K(B") + (its-defrule "nu" "$B%L(B") + (its-defrule "ne" "$B%M(B") + (its-defrule "no" "$B%N(B") + (its-defrule "nya" "$B%K%c(B") + (its-defrule "nyu" "$B%K%e(B") + (its-defrule "nye" "$B%K%'(B") + (its-defrule "nyo" "$B%K%g(B") + + (its-defrule "xka" "$B%u(B") + (its-defrule "xke" "$B%v(B") + (its-defrule "xti" "$B%F%#(B") + (its-defrule "xdi" "$B%G%#(B") + (its-defrule "xdu" "$B%I%%(B") + (its-defrule "xde" "$B%G%'(B") + (its-defrule "xdo" "$B%I%)(B") + (its-defrule "xwi" "$B%&%#(B") + (its-defrule "xwe" "$B%&%'(B") + (its-defrule "xwo" "$B%&%)(B") + +;;; +;;; Zenkaku inputs +;;; + + (its-defrule (concat its-zenkaku-escape "0") "$B#0(B") + (its-defrule (concat its-zenkaku-escape "1") "$B#1(B") + (its-defrule (concat its-zenkaku-escape "2") "$B#2(B") + (its-defrule (concat its-zenkaku-escape "3") "$B#3(B") + (its-defrule (concat its-zenkaku-escape "4") "$B#4(B") + (its-defrule (concat its-zenkaku-escape "5") "$B#5(B") + (its-defrule (concat its-zenkaku-escape "6") "$B#6(B") + (its-defrule (concat its-zenkaku-escape "7") "$B#7(B") + (its-defrule (concat its-zenkaku-escape "8") "$B#8(B") + (its-defrule (concat its-zenkaku-escape "9") "$B#9(B") + + (its-defrule (concat its-zenkaku-escape "A") "$B#A(B") + (its-defrule (concat its-zenkaku-escape "B") "$B#B(B") + (its-defrule (concat its-zenkaku-escape "C") "$B#C(B") + (its-defrule (concat its-zenkaku-escape "D") "$B#D(B") + (its-defrule (concat its-zenkaku-escape "E") "$B#E(B") + (its-defrule (concat its-zenkaku-escape "F") "$B#F(B") + (its-defrule (concat its-zenkaku-escape "G") "$B#G(B") + (its-defrule (concat its-zenkaku-escape "H") "$B#H(B") + (its-defrule (concat its-zenkaku-escape "I") "$B#I(B") + (its-defrule (concat its-zenkaku-escape "J") "$B#J(B") + (its-defrule (concat its-zenkaku-escape "K") "$B#K(B") + (its-defrule (concat its-zenkaku-escape "L") "$B#L(B") + (its-defrule (concat its-zenkaku-escape "M") "$B#M(B") + (its-defrule (concat its-zenkaku-escape "N") "$B#N(B") + (its-defrule (concat its-zenkaku-escape "O") "$B#O(B") + (its-defrule (concat its-zenkaku-escape "P") "$B#P(B") + (its-defrule (concat its-zenkaku-escape "Q") "$B#Q(B") + (its-defrule (concat its-zenkaku-escape "R") "$B#R(B") + (its-defrule (concat its-zenkaku-escape "S") "$B#S(B") + (its-defrule (concat its-zenkaku-escape "T") "$B#T(B") + (its-defrule (concat its-zenkaku-escape "U") "$B#U(B") + (its-defrule (concat its-zenkaku-escape "V") "$B#V(B") + (its-defrule (concat its-zenkaku-escape "W") "$B#W(B") + (its-defrule (concat its-zenkaku-escape "X") "$B#X(B") + (its-defrule (concat its-zenkaku-escape "Y") "$B#Y(B") + (its-defrule (concat its-zenkaku-escape "Z") "$B#Z(B") + + (its-defrule (concat its-zenkaku-escape "a") "$B#a(B") + (its-defrule (concat its-zenkaku-escape "b") "$B#b(B") + (its-defrule (concat its-zenkaku-escape "c") "$B#c(B") + (its-defrule (concat its-zenkaku-escape "d") "$B#d(B") + (its-defrule (concat its-zenkaku-escape "e") "$B#e(B") + (its-defrule (concat its-zenkaku-escape "f") "$B#f(B") + (its-defrule (concat its-zenkaku-escape "g") "$B#g(B") + (its-defrule (concat its-zenkaku-escape "h") "$B#h(B") + (its-defrule (concat its-zenkaku-escape "i") "$B#i(B") + (its-defrule (concat its-zenkaku-escape "j") "$B#j(B") + (its-defrule (concat its-zenkaku-escape "k") "$B#k(B") + (its-defrule (concat its-zenkaku-escape "l") "$B#l(B") + (its-defrule (concat its-zenkaku-escape "m") "$B#m(B") + (its-defrule (concat its-zenkaku-escape "n") "$B#n(B") + (its-defrule (concat its-zenkaku-escape "o") "$B#o(B") + (its-defrule (concat its-zenkaku-escape "p") "$B#p(B") + (its-defrule (concat its-zenkaku-escape "q") "$B#q(B") + (its-defrule (concat its-zenkaku-escape "r") "$B#r(B") + (its-defrule (concat its-zenkaku-escape "s") "$B#s(B") + (its-defrule (concat its-zenkaku-escape "t") "$B#t(B") + (its-defrule (concat its-zenkaku-escape "u") "$B#u(B") + (its-defrule (concat its-zenkaku-escape "v") "$B#v(B") + (its-defrule (concat its-zenkaku-escape "w") "$B#w(B") + (its-defrule (concat its-zenkaku-escape "x") "$B#x(B") + (its-defrule (concat its-zenkaku-escape "y") "$B#y(B") + (its-defrule (concat its-zenkaku-escape "z") "$B#z(B") + + (its-defrule (concat its-zenkaku-escape " ") "$B!!(B") + (its-defrule (concat its-zenkaku-escape "!") "$B!*(B") + (its-defrule (concat its-zenkaku-escape "@") "$B!w(B") + (its-defrule (concat its-zenkaku-escape "#") "$B!t(B") + (its-defrule (concat its-zenkaku-escape "$") "$B!p(B") + (its-defrule (concat its-zenkaku-escape "%") "$B!s(B") + (its-defrule (concat its-zenkaku-escape "^") "$B!0(B") + (its-defrule (concat its-zenkaku-escape "&") "$B!u(B") + (its-defrule (concat its-zenkaku-escape "*") "$B!v(B") + (its-defrule (concat its-zenkaku-escape "(") "$B!J(B") + (its-defrule (concat its-zenkaku-escape ")") "$B!K(B") + (its-defrule (concat its-zenkaku-escape "-") "$B!](B") + (its-defrule (concat its-zenkaku-escape "=") "$B!a(B") + (its-defrule (concat its-zenkaku-escape "`") "$B!.(B") + (its-defrule (concat its-zenkaku-escape "\\") "$B!o(B") + (its-defrule (concat its-zenkaku-escape "|") "$B!C(B") + (its-defrule (concat its-zenkaku-escape "_") "$B!2(B") + (its-defrule (concat its-zenkaku-escape "+") "$B!\(B") + (its-defrule (concat its-zenkaku-escape "~") "$B!1(B") + (its-defrule (concat its-zenkaku-escape "[") "$B!N(B") + (its-defrule (concat its-zenkaku-escape "]") "$B!O(B") + (its-defrule (concat its-zenkaku-escape "{") "$B!P(B") + (its-defrule (concat its-zenkaku-escape "}") "$B!Q(B") + (its-defrule (concat its-zenkaku-escape ":") "$B!'(B") + (its-defrule (concat its-zenkaku-escape ";") "$B!((B") + (its-defrule (concat its-zenkaku-escape "\"") "$B!I(B") + (its-defrule (concat its-zenkaku-escape "'") "$B!G(B") + (its-defrule (concat its-zenkaku-escape "<") "$B!c(B") + (its-defrule (concat its-zenkaku-escape ">") "$B!d(B") + (its-defrule (concat its-zenkaku-escape "?") "$B!)(B") + (its-defrule (concat its-zenkaku-escape "/") "$B!?(B") + (its-defrule (concat its-zenkaku-escape ",") "$B!$(B") + (its-defrule (concat its-zenkaku-escape ".") "$B!%(B") + +;;; +;;; Hankaku inputs +;;; + + (dolist (digit '( "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" )) + (its-defrule (concat its-hankaku-escape digit) digit)) + + (dolist (symbol '( " " "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" + "-" "=" "`" "\\" "|" "_" "+" "~" "[" "]" "{" "}" + ":" ";" "\"" "'" "<" ">" "?" "/" "," "." )) + (its-defrule (concat its-hankaku-escape symbol) symbol)) + + (dolist (downcase '("a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" + "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z")) + (its-defrule (concat its-hankaku-escape downcase) downcase)) + + (dolist (upcase '("A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" + "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z")) + (its-defrule (concat its-hankaku-escape upcase) upcase)) + +;; SYMBOL Input + (its-defrule "z1" "$B!{(B") (its-defrule "z!" "$B!|(B") + (its-defrule "z2" "$B"&(B") (its-defrule "z@" "$B"'(B") + (its-defrule "z3" "$B"$(B") (its-defrule "z#" "$B"%(B") + (its-defrule "z4" "$B""(B") (its-defrule "z$" "$B"#(B") + (its-defrule "z5" "$B!~(B") (its-defrule "z%" "$B"!(B") + (its-defrule "z6" "$B!y(B") (its-defrule "z^" "$B!z(B") + (its-defrule "z7" "$B!}(B") (its-defrule "z&" "$B!r(B") + (its-defrule "z8" "$B!q(B") (its-defrule "z*" "$B!_(B") + (its-defrule "z9" "$B!i(B") (its-defrule "z(" "$B!Z(B") + (its-defrule "z0" "$B!j(B") (its-defrule "z)" "$B![(B") + (its-defrule "z-" "$B!A(B") (its-defrule "z_" "$B!h(B") + (its-defrule "z=" "$B!b(B") (its-defrule "z+" "$B!^(B") + (its-defrule "z\\" "$B!@(B") (its-defrule "z|" "$B!B(B") + (its-defrule "z`" "$B!-(B") (its-defrule "z~" "$B!/(B") + + (its-defrule "zq" "$B!T(B") (its-defrule "zQ" "$B!R(B") + (its-defrule "zw" "$B!U(B") (its-defrule "zW" "$B!S(B") + ; e + (its-defrule "zr" "$B!9(B") (its-defrule "zR" "$B!8(B") + (its-defrule "zt" "$B!:(B") (its-defrule "zT" "$B!x(B") + ; y u i o + (its-defrule "zp" "$B")(B") (its-defrule "zP" "$B",(B") + (its-defrule "z[" "$B!X(B") (its-defrule "z{" "$B!L(B") + (its-defrule "z]" "$B!Y(B") (its-defrule "z}" "$B!M(B") + + ; a + (its-defrule "zs" "$B!3(B") (its-defrule "zS" "$B!4(B") + (its-defrule "zd" "$B!5(B") (its-defrule "zD" "$B!6(B") + (its-defrule "zf" "$B!7(B") (its-defrule "zF" "$B"*(B") + (its-defrule "zg" "$B!>(B") (its-defrule "zG" "$B!=(B") + (its-defrule "zh" "$B"+(B") + (its-defrule "zj" "$B"-(B") + (its-defrule "zk" "$B",(B") + (its-defrule "zl" "$B"*(B") + (its-defrule "z;" "$B!+(B") (its-defrule "z:" "$B!,(B") + (its-defrule "z\'" "$B!F(B") (its-defrule "z\"" "$B!H(B") + + ; z + (its-defrule "zx" ":-") (its-defrule "zX" ":-)") + (its-defrule "zc" "$B!;(B") (its-defrule "zC" "$B!n(B") + (its-defrule "zv" "$B"((B") (its-defrule "zV" "$B!`(B") + (its-defrule "zb" "$B!k(B") (its-defrule "zB" "$B"+(B") + (its-defrule "zn" "$B!l(B") (its-defrule "zN" "$B"-(B") + (its-defrule "zm" "$B!m(B") (its-defrule "zM" "$B".(B") + (its-defrule "z," "$B!E(B") (its-defrule "z<" "$B!e(B") + (its-defrule "z." "$B!D(B") (its-defrule "z>" "$B!f(B") + (its-defrule "z/" "$B!&(B") (its-defrule "z?" "$B!g(B") + ) + +(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 "-" its-kata-horizontal) + (its-defrule "[" its-kata-open-bracket) + (its-defrule "]" its-kata-close-bracket) + (its-defrule "." its-kata-period) + (its-defrule "," its-kata-comma) + + (if its-kata-enable-zenkaku-alphabet + (progn + (its-defrule "1" "$B#1(B") (its-defrule "2" "$B#2(B") + (its-defrule "3" "$B#3(B") (its-defrule "4" "$B#4(B") + (its-defrule "5" "$B#5(B") (its-defrule "6" "$B#6(B") + (its-defrule "7" "$B#7(B") (its-defrule "8" "$B#8(B") + (its-defrule "9" "$B#9(B") (its-defrule "0" "$B#0(B") + (its-defrule "!" "$B!*(B") (its-defrule "@" "$B!w(B") + (its-defrule "#" "$B!t(B") (its-defrule "$" "$B!p(B") + (its-defrule "%" "$B!s(B") (its-defrule "^" "$B!0(B") + (its-defrule "&" "$B!u(B") (its-defrule "*" "$B!v(B") + (its-defrule "(" "$B!J(B") (its-defrule ")" "$B!K(B") + (its-defrule "=" "$B!a(B") (its-defrule "`" "$B!.(B") + (its-defrule "\\" "$B!o(B") (its-defrule "|" "$B!C(B") + (its-defrule "_" "$B!2(B") (its-defrule "+" "$B!\(B") + (its-defrule "{" "$B!P(B") (its-defrule "}" "$B!Q(B") + (its-defrule ":" "$B!'(B") (its-defrule ";" "$B!((B") + (its-defrule "\"" "$B!I(B") (its-defrule "'" "$B!G(B") + (its-defrule "<" "$B!c(B") (its-defrule ">" "$B!d(B") + (its-defrule "?" "$B!)(B") (its-defrule "/" "$B!?(B")) + (progn + (its-defrule "1" "1") (its-defrule "2" "2") + (its-defrule "3" "3") (its-defrule "4" "4") + (its-defrule "5" "5") (its-defrule "6" "6") + (its-defrule "7" "7") (its-defrule "8" "8") + (its-defrule "9" "9") (its-defrule "0" "0") + (its-defrule "!" "!") (its-defrule "@" "@") + (its-defrule "#" "#") (its-defrule "$" "$") + (its-defrule "%" "%") (its-defrule "^" "^") + (its-defrule "&" "&") (its-defrule "*" "*") + (its-defrule "(" "(") (its-defrule ")" ")") + (its-defrule "=" "=") (its-defrule "`" "`") + (its-defrule "\\" "\\") (its-defrule "|" "|") + (its-defrule "_" "_") (its-defrule "+" "+") + (its-defrule "{" "{") (its-defrule "}" "}") + (its-defrule ":" ":") (its-defrule ";" ";") + (its-defrule "\"" "\"") (its-defrule "'" "'") + (its-defrule "<" "<") (its-defrule ">" ">") + (its-defrule "?" "?") (its-defrule "/" "/"))) + ) + +(provide 'its/kata) +;;; its/kata.el ends here. diff --git a/its/pinyin.el b/its/pinyin.el index 9d3505d..6a32775 100644 --- a/its/pinyin.el +++ b/its/pinyin.el @@ -1,17 +1,46 @@ +;;; its/pinyin.el --- Pinyin Input in Egg Input Method Architecture + +;; Copyright (C) 1997, 1998 Mule Project, +;; Powered by Electrotechnical Laboratory, JAPAN. +;; Project Leader: Satoru Tomura + +;; Author: KATAYAMA Yoshio + +;; This file will be part of GNU Emacs (in future). + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + (eval-when-compile (require 'its) (require 'cl)) +(defvar its-pinyin-cn-enable-quanjioao-alphabet t "*Enable Quanjiao alphabet") (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-open-braket "$(G!V(B" "*[") ; "$(G!b(B " (defvar its-pinyin-tw-close-braket "$(G!W(B" "*]") ; "$(G!c(B" (eval-when-compile - (defvar its-quanjiao-escape "Z") - (defvar its-banjiao-escape "X") - (defconst its-pinyin-term (char-to-string (make-char 'chinese-sisheng ?@))) @@ -65,9 +94,10 @@ state)) (defmacro its-do-sisheng-table (list) - `(progn ,@(mapcar (lambda (syl) - `(its-define-sisheng ,(car syl) ,(cdr syl))) - list))) + `(progn + ,@(mapcar (lambda (syl) + `(its-define-sisheng ,@syl)) + list))) (defmacro its-define-sisheng (shengmu yunmu) `(let ((qing (nth 5 ,yunmu)) (y (car ,yunmu)) @@ -126,51 +156,51 @@ (UO '("uo" "u(0-(B" "u(0.(B" "u(0/(B" "u(00(B" "uo" ))) (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) - ((- B C D F G H K L M N P R S T W Y Z CH SH ZH ) . AN) - ((- B C D F G H K L M N P R S T W Y Z CH SH ZH ) . ANG) - ((- B C D G H K L M N P R S T Y Z CH SH ZH ) . AO) - ((- C D G H K L M N R S T Y Z CH SH ZH ) . E) - ((- B C D F G H K L M N P T W Z SH ZH ) . EI) - ((- B C D F G H K M N P R S W Z CH SH ZH ) . EN) - ((- B C D F G H K L M N P R S T W Z CH SH ZH ) . ENG) - ((- ) . ER) - (( B C D J L M N P Q R S T X Y Z CH SH ZH ) . I) - (( D J L Q X ) . IA) - (( B D J L M N P Q T X ) . IAN) - (( J L N Q X ) . IANG) - (( B D J L M N P Q T X ) . IAO) - (( B D J L M N P Q T X ) . IE) - (( B J L M N P Q X Y ) . IN) - (( B D J L M N P Q T X Y ) . ING) - (( J Q X ) . IONG) - (( D J L M N Q X ) . IU) - ((- B F L M P W Y ) . O) - (( C D G H K L N R S T Y Z CH ZH ) . ONG) - ((- C D F G H K L M N P R S T Y Z CH SH ZH ) . OU) - (( B C D F G H J K L M N P Q R S T W X Y Z CH SH ZH ) . U) - (( L N ) . V) - (( G H K R CH SH ZH ) . UA) - (( G H K CH SH ZH ) . UAI) - (( C D G H J K L N Q R S T X Y Z CH SH ZH ) . UAN) - (( G H K CH SH ZH ) . UANG) - (( J Q X Y ) . UE) - (( L N ) . VE) - (( C D G H K R S T Z CH SH ZH ) . UI) - (( C D G H J K L Q R S T X Y Z CH SH ZH ) . UN) - (( C D G H K L N R S T Z CH SH ZH ) . UO) - - ((J Q X) . (cons "a" (cdr IA ))) - ((J Q X) . (cons "ai" (cdr IA ))) - ((J Q X) . (cons "an" (cdr IAN ))) - ((J Q X) . (cons "ang" (cdr IANG))) - ((J Q X) . (cons "ao" (cdr IAO ))) - ((J Q X) . (cons "e" (cdr IE ))) - ((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 ))))) + (((- 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) + ((- B C D F G H K L M N P R S T W Y Z CH SH ZH ) AN) + ((- B C D F G H K L M N P R S T W Y Z CH SH ZH ) ANG) + ((- B C D G H K L M N P R S T Y Z CH SH ZH ) AO) + ((- C D G H K L M N R S T Y Z CH SH ZH ) E) + ((- B C D F G H K L M N P T W Z SH ZH ) EI) + ((- B C D F G H K M N P R S W Z CH SH ZH ) EN) + ((- B C D F G H K L M N P R S T W Z CH SH ZH ) ENG) + ((- ) ER) + (( B C D J L M N P Q R S T X Y Z CH SH ZH ) I) + (( D J L Q X ) IA) + (( B D J L M N P Q T X ) IAN) + (( J L N Q X ) IANG) + (( B D J L M N P Q T X ) IAO) + (( B D J L M N P Q T X ) IE) + (( B J L M N P Q X Y ) IN) + (( B D J L M N P Q T X Y ) ING) + (( J Q X ) IONG) + (( D J L M N Q X ) IU) + ((- B F L M P W Y ) O) + (( C D G H K L N R S T Y Z CH ZH ) ONG) + ((- C D F G H K L M N P R S T Y Z CH SH ZH ) OU) + (( B C D F G H J K L M N P Q R S T W X Y Z CH SH ZH ) U) + (( L N ) V) + (( G H K R CH SH ZH ) UA) + (( G H K CH SH ZH ) UAI) + (( C D G H J K L N Q R S T X Y Z CH SH ZH ) UAN) + (( G H K CH SH ZH ) UANG) + (( J Q X Y ) UE) + (( L N ) VE) + (( C D G H K R S T Z CH SH ZH ) UI) + (( C D G H J K L Q R S T X Y Z CH SH ZH ) UN) + (( C D G H K L N R S T Z CH SH ZH ) UO) + + ((J Q X) (cons "a" (cdr IA ))) + ((J Q X) (cons "ai" (cdr IA ))) + ((J Q X) (cons "an" (cdr IAN ))) + ((J Q X) (cons "ang" (cdr IANG))) + ((J Q X) (cons "ao" (cdr IAO ))) + ((J Q X) (cons "e" (cdr IE ))) + ((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" "") @@ -185,6 +215,13 @@ (define-its-state-machine its-pinyin-cn-map "pinyin-cn" "$AF4(BG" "Chinese-GB" "Map for Pinyin input. (Chinese-GB)" + + (defconst its-quanjiao-escape "Z") + (defconst its-banjiao-escape "X") + + (its-defrule-select-mode-temporally "B" downcase) + (its-defrule-select-mode-temporally "Q" quanjiao-downcase-cn) + (its-define-pinyin-table) (its-defoutput* "b " "$A2;(B") (its-defoutput* "c " "$A2E(B") @@ -238,29 +275,27 @@ ("U" . "$A#U(B") ("V" . "$A#V(B") ("W" . "$A#W(B") ("X" . "$A#X(B") ("Y" . "$A#Y(B") ("Z" . "$A#Z(B"))) (let ((in (car ascii)) (out (cdr ascii))) - (if (and (or (string< in "a") (string< "z" in)) - (null (equal in " ")) - (null (equal in its-banjiao-escape)) - (null (equal in its-quanjiao-escape))) - (progn - (its-defrule in in) - (its-defrule (concat (downcase its-banjiao-escape) in) in) - (its-defrule (concat (downcase its-quanjiao-escape) in) out))) (its-defrule (concat its-banjiao-escape in) in) (its-defrule (concat its-quanjiao-escape in) out))) - (its-defrule "," "$A#,(B" nil t) - (its-defrule "." "$A!#(B" nil t) - (its-defrule "/" "$A!"(B" nil t) - (its-defrule ":" "$A#:(B" nil t) - (its-defrule ";" "$A#;(B" nil t) - (its-defrule "?" "$A#?(B" nil t) - (its-defrule "!" "$A#!(B" nil t) - (its-defrule "-" "$A!*(B" nil t)) + (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 "!" "$A#!(B")) (define-its-state-machine its-pinyin-tw-map "pinyin-tw" "$(GQ;(BC" "Chinese-CNS" "Map for Pinyin input." + + (defconst its-quanjiao-escape "Z") + (defconst its-banjiao-escape "X") + + (its-defrule-select-mode-temporally "B" downcase) + (its-defrule-select-mode-temporally "Q" quanjiao-downcase-tw) + (its-define-pinyin-table) (its-defoutput* "b " "$(GDb(B") (its-defoutput* "c " "$(GD_(B") @@ -314,34 +349,99 @@ ("U" . "$(G$U(B") ("V" . "$(G$V(B") ("W" . "$(G$W(B") ("X" . "$(G$X(B") ("Y" . "$(G$Y(B") ("Z" . "$(G$Z(B"))) (let ((in (car ascii)) (out (cdr ascii))) - (if (and (or (string< in "a") (string< "z" in)) - (null (equal in " ")) - (null (equal in its-banjiao-escape)) - (null (equal in its-quanjiao-escape))) - (progn - (its-defrule in in) - (its-defrule (concat (downcase its-banjiao-escape) in) in) - (its-defrule (concat (downcase its-quanjiao-escape) in) out))) (its-defrule (concat its-banjiao-escape in) in) (its-defrule (concat its-quanjiao-escape in) out))) - (its-defrule "," "$(G!"(B" nil t) - (its-defrule "." "$(G!$(B" nil t) - (its-defrule "/" "$(G!#(B" nil t) - (its-defrule ":" "$(G!((B" nil t) - (its-defrule ";" "$(G!'(B" nil t) - (its-defrule "?" "$(G!)(B" nil t) - (its-defrule "!" "$(G!*(B" nil t) - (its-defrule "-" "$(G"1(B" nil t) - (its-defrule "[" "$(G!V(B" nil t) - (its-defrule "]" "$(G!W(B" nil t)) + (its-defrule "," "$(G!"(B") + (its-defrule "." "$(G!$(B") + (its-defrule "/" "$(G!#(B") + (its-defrule ":" "$(G!((B") + (its-defrule ";" "$(G!'(B") + (its-defrule "?" "$(G!)(B") + (its-defrule "!" "$(G!*(B")) (define-its-state-machine-append its-pinyin-cn-map - (its-defrule "[" its-pinyin-cn-open-braket nil t) - (its-defrule "]" its-pinyin-cn-close-braket nil t)) + (its-defrule "[" its-pinyin-cn-open-braket) + (its-defrule "]" its-pinyin-cn-close-braket) + + (if its-pinyin-cn-enable-quanjioao-alphabet + (progn + (its-defrule "1" "$A#1(B") (its-defrule "2" "$A#2(B") + (its-defrule "3" "$A#3(B") (its-defrule "4" "$A#4(B") + (its-defrule "5" "$A#5(B") (its-defrule "6" "$A#6(B") + (its-defrule "7" "$A#7(B") (its-defrule "8" "$A#8(B") + (its-defrule "9" "$A#9(B") (its-defrule "0" "$A#0(B") + (its-defrule "@" "$A#@(B") + (its-defrule "#" "$A##(B") (its-defrule "$" "$A!g(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") + (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 "_" "$A#_(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") (its-defrule ">" "$A#>(B")) + (progn + (its-defrule "1" "1") (its-defrule "2" "2") + (its-defrule "3" "3") (its-defrule "4" "4") + (its-defrule "5" "5") (its-defrule "6" "6") + (its-defrule "7" "7") (its-defrule "8" "8") + (its-defrule "9" "9") (its-defrule "0" "0") + (its-defrule "@" "@") + (its-defrule "#" "#") (its-defrule "$" "$") + (its-defrule "%" "%") (its-defrule "^" "^") + (its-defrule "&" "&") (its-defrule "*" "*") + (its-defrule "(" "(") (its-defrule ")" ")") + (its-defrule "-" "-") (its-defrule "~" "~") + (its-defrule "=" "=") (its-defrule "`" "`") + (its-defrule "\\" "\\") (its-defrule "|" "|") + (its-defrule "_" "_") (its-defrule "+" "+") + (its-defrule "{" "{") (its-defrule "}" "}") + (its-defrule "\"" "\"") (its-defrule "'" "'") + (its-defrule "<" "<") (its-defrule ">" ">")))) (define-its-state-machine-append its-pinyin-tw-map - (its-defrule "[" its-pinyin-tw-open-braket nil t) - (its-defrule "]" its-pinyin-tw-close-braket nil t)) + (its-defrule "[" its-pinyin-tw-open-braket) + (its-defrule "]" its-pinyin-tw-close-braket) + + (if its-pinyin-tw-enable-quanjioao-alphabet + (progn + (its-defrule "1" "$(G$"(B") (its-defrule "2" "$(G$#(B") + (its-defrule "3" "$(G$$(B") (its-defrule "4" "$(G$%(B") + (its-defrule "5" "$(G$&(B") (its-defrule "6" "$(G$'(B") + (its-defrule "7" "$(G$((B") (its-defrule "8" "$(G$)(B") + (its-defrule "9" "$(G$*(B") (its-defrule "0" "$(G$!(B") + (its-defrule "@" "$(G"i(B") + (its-defrule "#" "$(G!l(B") (its-defrule "$" "$(G"c(B") + (its-defrule "%" "$(G"h(B") (its-defrule "^" "$(G!T(B") + (its-defrule "&" "$(G!m(B") (its-defrule "*" "$(G!n(B") + (its-defrule "(" "$(G!>(B") (its-defrule ")" "$(G!?(B") + (its-defrule "-" "$(G"1(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"0(B") + (its-defrule "{" "$A#{(B") (its-defrule "}" "$(G!a(B") + (its-defrule "\"" "$(G!i(B") (its-defrule "'" "$(G!k(B") + (its-defrule "<" "$(G"6(B") (its-defrule ">" "$(G"7(B")) + (progn + (its-defrule "1" "1") (its-defrule "2" "2") + (its-defrule "3" "3") (its-defrule "4" "4") + (its-defrule "5" "5") (its-defrule "6" "6") + (its-defrule "7" "7") (its-defrule "8" "8") + (its-defrule "9" "9") (its-defrule "0" "0") + (its-defrule "@" "@") + (its-defrule "#" "#") (its-defrule "$" "$") + (its-defrule "%" "%") (its-defrule "^" "^") + (its-defrule "&" "&") (its-defrule "*" "*") + (its-defrule "(" "(") (its-defrule ")" ")") + (its-defrule "-" "-") (its-defrule "~" "~") + (its-defrule "=" "=") (its-defrule "`" "`") + (its-defrule "\\" "\\") (its-defrule "|" "|") + (its-defrule "_" "_") (its-defrule "+" "+") + (its-defrule "{" "{") (its-defrule "}" "}") + (its-defrule "\"" "\"") (its-defrule "'" "'") + (its-defrule "<" "<") (its-defrule ">" ">")))) (provide 'its/pinyin) diff --git a/its/quanjiao.el b/its/quanjiao.el new file mode 100644 index 0000000..d33205d --- /dev/null +++ b/its/quanjiao.el @@ -0,0 +1,169 @@ +;;; its/quanjiao.el --- Quanjiao ASCII Input in Egg Input Method Architecture + +;; Copyright (C) 1997, 1998 Mule Project, +;; Powered by Electrotechnical Laboratory, JAPAN. +;; Project Leader: Satoru Tomura + +;; Author: KATAYAMA Yoshio + +;; This file will be part of GNU Emacs (in future). + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: +;; +;; Symbol input is desined by jiro@math.keio.ac.jp (TANAKA Jiro) +;; This file is based on the rules of its/hira.el in Mule-2.3 distribution. +;; + +;;; Code: + +(eval-when-compile + (require 'its)) + +(define-its-state-machine its-quanjiao-up-cn-map + "quanjiao-upcase-cn" "$A#A(B" "Chinese-GB" nil + "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") + ("4" . "$A#4(B") ("5" . "$A#5(B") ("6" . "$A#6(B") ("7" . "$A#7(B") + ("8" . "$A#8(B") ("9" . "$A#9(B") + (" " . "$A!!(B") ("!" . "$A#!(B") ("@" . "$A#@(B") ("#" . "$A##(B") + ("$" . "$A!g(B") ("%" . "$A#%(B") ("^" . "$A#^(B") ("&" . "$A#&(B") + ("*" . "$A#*(B") ("(" . "$A#((B") (")" . "$A#)(B") + ("-" . "$A#-(B") ("=" . "$A#=(B") ("`" . "$A#`(B") ("\\" . "$A#\(B") + ("|" . "$A#|(B") ("_" . "$A#_(B") ("+" . "$A#+(B") ("~" . "$A!+(B") + ("[" . "$A#[(B") ("]" . "$A#](B") ("{" . "$A#{(B") ("}" . "$A#}(B") + (":" . "$A#:(B") (";" . "$A#;(B") ("\"" . "$A#"(B") ("'" . "$A#'(B") + ("<" . "$A#<(B") (">" . "$A#>(B") ("?" . "$A#?(B") ("/" . "$A#/(B") + ("," . "$A#,(B") ("." . "$A#.(B") + ("a" . "$A#A(B") ("b" . "$A#B(B") ("c" . "$A#C(B") ("d" . "$A#D(B") + ("e" . "$A#E(B") ("f" . "$A#F(B") ("g" . "$A#G(B") ("h" . "$A#H(B") + ("i" . "$A#I(B") ("j" . "$A#J(B") ("k" . "$A#K(B") ("l" . "$A#L(B") + ("m" . "$A#M(B") ("n" . "$A#N(B") ("o" . "$A#O(B") ("p" . "$A#P(B") + ("q" . "$A#Q(B") ("r" . "$A#R(B") ("s" . "$A#S(B") ("t" . "$A#T(B") + ("u" . "$A#U(B") ("v" . "$A#V(B") ("w" . "$A#W(B") ("x" . "$A#X(B") + ("y" . "$A#Y(B") ("z" . "$A#Z(B") + ("A" . "$A#A(B") ("B" . "$A#B(B") ("C" . "$A#C(B") ("D" . "$A#D(B") + ("E" . "$A#E(B") ("F" . "$A#F(B") ("G" . "$A#G(B") ("H" . "$A#H(B") + ("I" . "$A#I(B") ("J" . "$A#J(B") ("K" . "$A#K(B") ("L" . "$A#L(B") + ("M" . "$A#M(B") ("N" . "$A#N(B") ("O" . "$A#O(B") ("P" . "$A#P(B") + ("Q" . "$A#Q(B") ("R" . "$A#R(B") ("S" . "$A#S(B") ("T" . "$A#T(B") + ("U" . "$A#U(B") ("V" . "$A#V(B") ("W" . "$A#W(B") ("X" . "$A#X(B") + ("Y" . "$A#Y(B") ("Z" . "$A#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule in out)))) + +(define-its-state-machine its-quanjiao-down-cn-map + "quanjiao-downcase-cn" "$A#a(B" "Chinese-GB" nil + "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") + ("4" . "$A#4(B") ("5" . "$A#5(B") ("6" . "$A#6(B") ("7" . "$A#7(B") + ("8" . "$A#8(B") ("9" . "$A#9(B") + (" " . "$A!!(B") ("!" . "$A#!(B") ("@" . "$A#@(B") ("#" . "$A##(B") + ("$" . "$A!g(B") ("%" . "$A#%(B") ("^" . "$A#^(B") ("&" . "$A#&(B") + ("*" . "$A#*(B") ("(" . "$A#((B") (")" . "$A#)(B") + ("-" . "$A#-(B") ("=" . "$A#=(B") ("`" . "$A#`(B") ("\\" . "$A#\(B") + ("|" . "$A#|(B") ("_" . "$A#_(B") ("+" . "$A#+(B") ("~" . "$A!+(B") + ("[" . "$A#[(B") ("]" . "$A#](B") ("{" . "$A#{(B") ("}" . "$A#}(B") + (":" . "$A#:(B") (";" . "$A#;(B") ("\"" . "$A#"(B") ("'" . "$A#'(B") + ("<" . "$A#<(B") (">" . "$A#>(B") ("?" . "$A#?(B") ("/" . "$A#/(B") + ("," . "$A#,(B") ("." . "$A#.(B") + ("a" . "$A#a(B") ("b" . "$A#b(B") ("c" . "$A#c(B") ("d" . "$A#d(B") + ("e" . "$A#e(B") ("f" . "$A#f(B") ("g" . "$A#g(B") ("h" . "$A#h(B") + ("i" . "$A#i(B") ("j" . "$A#j(B") ("k" . "$A#k(B") ("l" . "$A#l(B") + ("m" . "$A#m(B") ("n" . "$A#n(B") ("o" . "$A#o(B") ("p" . "$A#p(B") + ("q" . "$A#q(B") ("r" . "$A#r(B") ("s" . "$A#s(B") ("t" . "$A#t(B") + ("u" . "$A#u(B") ("v" . "$A#v(B") ("w" . "$A#w(B") ("x" . "$A#x(B") + ("y" . "$A#y(B") ("z" . "$A#z(B") + ("A" . "$A#A(B") ("B" . "$A#B(B") ("C" . "$A#C(B") ("D" . "$A#D(B") + ("E" . "$A#E(B") ("F" . "$A#F(B") ("G" . "$A#G(B") ("H" . "$A#H(B") + ("I" . "$A#I(B") ("J" . "$A#J(B") ("K" . "$A#K(B") ("L" . "$A#L(B") + ("M" . "$A#M(B") ("N" . "$A#N(B") ("O" . "$A#O(B") ("P" . "$A#P(B") + ("Q" . "$A#Q(B") ("R" . "$A#R(B") ("S" . "$A#S(B") ("T" . "$A#T(B") + ("U" . "$A#U(B") ("V" . "$A#V(B") ("W" . "$A#W(B") ("X" . "$A#X(B") + ("Y" . "$A#Y(B") ("Z" . "$A#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule in out)))) + +(define-its-state-machine its-quanjiao-up-tw-map + "quanjiao-upcase-tw" "$(G$A(B" "Chinese-CNS" nil + "Map for quanjiao-upcase input. (Chinese-CNS)" + + (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") + ("8" . "$(G$)(B") ("9" . "$(G$*(B") + (" " . "$(G!!(B") ("!" . "$(G!*(B") ("@" . "$(G"i(B") ("#" . "$(G!l(B") + ("$" . "$(G"c(B") ("%" . "$(G"h(B") ("^" . "$(G!T(B") ("&" . "$(G!m(B") + ("*" . "$(G!n(B") ("(" . "$(G!>(B") (")" . "$(G!?(B") + ("-" . "$(G"1(B") ("=" . "$(G"8(B") ("`" . "$(G!j(B") ("\\" . "$(G"b(B") + ("|" . "$(G"^(B") ("_" . "$(G"%(B") ("+" . "$(G"0(B") ("~" . "$(G"D(B") + ("[" . "$(G!b(B") ("]" . "$(G!c(B") ("{" . "$A#{(B") ("}" . "$(G!a(B") + (":" . "$(G!((B") (";" . "$(G!'(B") ("\"" . "$(G!i(B") ("'" . "$(G!k(B") + ("<" . "$(G"6(B") (">" . "$(G"7(B") ("?" . "$(G!)(B") ("/" . "$(G"a(B") + ("," . "$(G!"(B") ("." . "$(G!%(B") + ("a" . "$(G$A(B") ("b" . "$(G$B(B") ("c" . "$(G$C(B") ("d" . "$(G$D(B") + ("e" . "$(G$E(B") ("f" . "$(G$F(B") ("g" . "$(G$G(B") ("h" . "$(G$H(B") + ("i" . "$(G$I(B") ("j" . "$(G$J(B") ("k" . "$(G$K(B") ("l" . "$(G$L(B") + ("m" . "$(G$M(B") ("n" . "$(G$N(B") ("o" . "$(G$O(B") ("p" . "$(G$P(B") + ("q" . "$(G$Q(B") ("r" . "$(G$R(B") ("s" . "$(G$S(B") ("t" . "$(G$T(B") + ("u" . "$(G$U(B") ("v" . "$(G$V(B") ("w" . "$(G$W(B") ("x" . "$(G$X(B") + ("y" . "$(G$Y(B") ("z" . "$(G$Z(B") + ("A" . "$(G$A(B") ("B" . "$(G$B(B") ("C" . "$(G$C(B") ("D" . "$(G$D(B") + ("E" . "$(G$E(B") ("F" . "$(G$F(B") ("G" . "$(G$G(B") ("H" . "$(G$H(B") + ("I" . "$(G$I(B") ("J" . "$(G$J(B") ("K" . "$(G$K(B") ("L" . "$(G$L(B") + ("M" . "$(G$M(B") ("N" . "$(G$N(B") ("O" . "$(G$O(B") ("P" . "$(G$P(B") + ("Q" . "$(G$Q(B") ("R" . "$(G$R(B") ("S" . "$(G$S(B") ("T" . "$(G$T(B") + ("U" . "$(G$U(B") ("V" . "$(G$V(B") ("W" . "$(G$W(B") ("X" . "$(G$X(B") + ("Y" . "$(G$Y(B") ("Z" . "$(G$Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule in out)))) + +(define-its-state-machine its-quanjiao-down-tw-map + "quanjiao-downcase-tw" "$(G$[(B" "Chinese-CNS" nil + "Map for quanjiao-downcase input. (Chinese-CNS)" + + (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") + ("8" . "$(G$)(B") ("9" . "$(G$*(B") + (" " . "$(G!!(B") ("!" . "$(G!*(B") ("@" . "$(G"i(B") ("#" . "$(G!l(B") + ("$" . "$(G"c(B") ("%" . "$(G"h(B") ("^" . "$(G!T(B") ("&" . "$(G!m(B") + ("*" . "$(G!n(B") ("(" . "$(G!>(B") (")" . "$(G!?(B") + ("-" . "$(G"1(B") ("=" . "$(G"8(B") ("`" . "$(G!j(B") ("\\" . "$(G"b(B") + ("|" . "$(G"^(B") ("_" . "$(G"%(B") ("+" . "$(G"0(B") ("~" . "$(G"D(B") + ("[" . "$(G!b(B") ("]" . "$(G!c(B") ("{" . "$A#{(B") ("}" . "$(G!a(B") + (":" . "$(G!((B") (";" . "$(G!'(B") ("\"" . "$(G!i(B") ("'" . "$(G!k(B") + ("<" . "$(G"6(B") (">" . "$(G"7(B") ("?" . "$(G!)(B") ("/" . "$(G"a(B") + ("," . "$(G!"(B") ("." . "$(G!%(B") + ("a" . "$(G$[(B") ("b" . "$(G$\(B") ("c" . "$(G$](B") ("d" . "$(G$^(B") + ("e" . "$(G$_(B") ("f" . "$(G$`(B") ("g" . "$(G$a(B") ("h" . "$(G$b(B") + ("i" . "$(G$c(B") ("j" . "$(G$d(B") ("k" . "$(G$e(B") ("l" . "$(G$f(B") + ("m" . "$(G$g(B") ("n" . "$(G$h(B") ("o" . "$(G$i(B") ("p" . "$(G$j(B") + ("q" . "$(G$k(B") ("r" . "$(G$l(B") ("s" . "$(G$m(B") ("t" . "$(G$n(B") + ("u" . "$(G$o(B") ("v" . "$(G$p(B") ("w" . "$(G$q(B") ("x" . "$(G$r(B") + ("y" . "$(G$s(B") ("z" . "$(G$t(B") + ("A" . "$(G$A(B") ("B" . "$(G$B(B") ("C" . "$(G$C(B") ("D" . "$(G$D(B") + ("E" . "$(G$E(B") ("F" . "$(G$F(B") ("G" . "$(G$G(B") ("H" . "$(G$H(B") + ("I" . "$(G$I(B") ("J" . "$(G$J(B") ("K" . "$(G$K(B") ("L" . "$(G$L(B") + ("M" . "$(G$M(B") ("N" . "$(G$N(B") ("O" . "$(G$O(B") ("P" . "$(G$P(B") + ("Q" . "$(G$Q(B") ("R" . "$(G$R(B") ("S" . "$(G$S(B") ("T" . "$(G$T(B") + ("U" . "$(G$U(B") ("V" . "$(G$V(B") ("W" . "$(G$W(B") ("X" . "$(G$X(B") + ("Y" . "$(G$Y(B") ("Z" . "$(G$Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule in out)))) + +(provide 'its/quanjiao) diff --git a/its/zenkaku.el b/its/zenkaku.el new file mode 100644 index 0000000..d56c1bb --- /dev/null +++ b/its/zenkaku.el @@ -0,0 +1,103 @@ +;;; its/zenkau.el --- Zenkaku ASCII Input in Egg Input Method Architecture + +;; Copyright (C) 1997, 1998 Mule Project, +;; Powered by Electrotechnical Laboratory, JAPAN. +;; Project Leader: Satoru Tomura + +;; Author: KATAYAMA Yoshio + +;; This file will be part of GNU Emacs (in future). + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: +;; +;; Symbol input is desined by jiro@math.keio.ac.jp (TANAKA Jiro) +;; This file is based on the rules of its/hira.el in Mule-2.3 distribution. +;; + +;;; Code: + +(eval-when-compile + (require 'its)) + +(define-its-state-machine its-zenkaku-up-map + "zenkaku-upcase" "$B#A(B" "Japanese" nil + "Map for zenkaku-upcase input." + + (dolist (ascii '(("0" . "$B#0(B") ("1" . "$B#1(B") ("2" . "$B#2(B") ("3" . "$B#3(B") + ("4" . "$B#4(B") ("5" . "$B#5(B") ("6" . "$B#6(B") ("7" . "$B#7(B") + ("8" . "$B#8(B") ("9" . "$B#9(B") + (" " . "$B!!(B") ("!" . "$B!*(B") ("@" . "$B!w(B") ("#" . "$B!t(B") + ("$" . "$B!p(B") ("%" . "$B!s(B") ("^" . "$B!0(B") ("&" . "$B!u(B") + ("*" . "$B!v(B") ("(" . "$B!J(B") (")" . "$B!K(B") + ("-" . "$B!](B") ("=" . "$B!a(B") ("`" . "$B!.(B") ("\\" . "$B!@(B") + ("|" . "$B!C(B") ("_" . "$B!2(B") ("+" . "$B!\(B") ("~" . "$B!A(B") + ("[" . "$B!N(B") ("]" . "$B!O(B") ("{" . "$B!P(B") ("}" . "$B!Q(B") + (":" . "$B!'(B") (";" . "$B!((B") ("\"" . "$B!I(B") ("'" . "$B!-(B") + ("<" . "$B!c(B") (">" . "$B!d(B") ("?" . "$B!)(B") ("/" . "$B!?(B") + ("," . "$B!$(B") ("." . "$B!%(B") + ("a" . "$B#A(B") ("b" . "$B#B(B") ("c" . "$B#C(B") ("d" . "$B#D(B") + ("e" . "$B#E(B") ("f" . "$B#F(B") ("g" . "$B#G(B") ("h" . "$B#H(B") + ("i" . "$B#I(B") ("j" . "$B#J(B") ("k" . "$B#K(B") ("l" . "$B#L(B") + ("m" . "$B#M(B") ("n" . "$B#N(B") ("o" . "$B#O(B") ("p" . "$B#P(B") + ("q" . "$B#Q(B") ("r" . "$B#R(B") ("s" . "$B#S(B") ("t" . "$B#T(B") + ("u" . "$B#U(B") ("v" . "$B#V(B") ("w" . "$B#W(B") ("x" . "$B#X(B") + ("y" . "$B#Y(B") ("z" . "$B#Z(B") + ("A" . "$B#A(B") ("B" . "$B#B(B") ("C" . "$B#C(B") ("D" . "$B#D(B") + ("E" . "$B#E(B") ("F" . "$B#F(B") ("G" . "$B#G(B") ("H" . "$B#H(B") + ("I" . "$B#I(B") ("J" . "$B#J(B") ("K" . "$B#K(B") ("L" . "$B#L(B") + ("M" . "$B#M(B") ("N" . "$B#N(B") ("O" . "$B#O(B") ("P" . "$B#P(B") + ("Q" . "$B#Q(B") ("R" . "$B#R(B") ("S" . "$B#S(B") ("T" . "$B#T(B") + ("U" . "$B#U(B") ("V" . "$B#V(B") ("W" . "$B#W(B") ("X" . "$B#X(B") + ("Y" . "$B#Y(B") ("Z" . "$B#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule in out)))) + +(define-its-state-machine its-zenkaku-down-map + "zenkaku-downcase" "$B#a(B" "Japanese" nil + "Map for zenkaku-downcase input." + + (dolist (ascii '(("0" . "$B#0(B") ("1" . "$B#1(B") ("2" . "$B#2(B") ("3" . "$B#3(B") + ("4" . "$B#4(B") ("5" . "$B#5(B") ("6" . "$B#6(B") ("7" . "$B#7(B") + ("8" . "$B#8(B") ("9" . "$B#9(B") + (" " . "$B!!(B") ("!" . "$B!*(B") ("@" . "$B!w(B") ("#" . "$B!t(B") + ("$" . "$B!p(B") ("%" . "$B!s(B") ("^" . "$B!0(B") ("&" . "$B!u(B") + ("*" . "$B!v(B") ("(" . "$B!J(B") (")" . "$B!K(B") + ("-" . "$B!](B") ("=" . "$B!a(B") ("`" . "$B!.(B") ("\\" . "$B!@(B") + ("|" . "$B!C(B") ("_" . "$B!2(B") ("+" . "$B!\(B") ("~" . "$B!A(B") + ("[" . "$B!N(B") ("]" . "$B!O(B") ("{" . "$B!P(B") ("}" . "$B!Q(B") + (":" . "$B!'(B") (";" . "$B!((B") ("\"" . "$B!I(B") ("'" . "$B!-(B") + ("<" . "$B!c(B") (">" . "$B!d(B") ("?" . "$B!)(B") ("/" . "$B!?(B") + ("," . "$B!$(B") ("." . "$B!%(B") + ("a" . "$B#a(B") ("b" . "$B#b(B") ("c" . "$B#c(B") ("d" . "$B#d(B") + ("e" . "$B#e(B") ("f" . "$B#f(B") ("g" . "$B#g(B") ("h" . "$B#h(B") + ("i" . "$B#i(B") ("j" . "$B#j(B") ("k" . "$B#k(B") ("l" . "$B#l(B") + ("m" . "$B#m(B") ("n" . "$B#n(B") ("o" . "$B#o(B") ("p" . "$B#p(B") + ("q" . "$B#q(B") ("r" . "$B#r(B") ("s" . "$B#s(B") ("t" . "$B#t(B") + ("u" . "$B#u(B") ("v" . "$B#v(B") ("w" . "$B#w(B") ("x" . "$B#x(B") + ("y" . "$B#y(B") ("z" . "$B#z(B") + ("A" . "$B#A(B") ("B" . "$B#B(B") ("C" . "$B#C(B") ("D" . "$B#D(B") + ("E" . "$B#E(B") ("F" . "$B#F(B") ("G" . "$B#G(B") ("H" . "$B#H(B") + ("I" . "$B#I(B") ("J" . "$B#J(B") ("K" . "$B#K(B") ("L" . "$B#L(B") + ("M" . "$B#M(B") ("N" . "$B#N(B") ("O" . "$B#O(B") ("P" . "$B#P(B") + ("Q" . "$B#Q(B") ("R" . "$B#R(B") ("S" . "$B#S(B") ("T" . "$B#T(B") + ("U" . "$B#U(B") ("V" . "$B#V(B") ("W" . "$B#W(B") ("X" . "$B#X(B") + ("Y" . "$B#Y(B") ("Z" . "$B#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule in out)))) + +(provide 'its/zenkaku) diff --git a/its/zhuyin.el b/its/zhuyin.el new file mode 100644 index 0000000..442834b --- /dev/null +++ b/its/zhuyin.el @@ -0,0 +1,288 @@ +;;; its/zhuyin.el --- Zhuyin Input in Egg Input Method Architecture + +;; Copyright (C) 1997, 1998 Mule Project, +;; Powered by Electrotechnical Laboratory, JAPAN. +;; Project Leader: Satoru Tomura + +;; Author: KATAYAMA Yoshio + +;; This file will be part of GNU Emacs (in future). + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + +(eval-when-compile + (require 'its) + (require 'cl)) + +(defvar its-zhuyin-cn-enable-quanjioao-alphabet t "*Enable Quanjiao alphabet") +(defvar its-zhuyin-cn-open-braket "$A!8(B" "*[") ; "$A#[(B" +(defvar its-zhuyin-cn-close-braket "$A!9(B" "*]") ; "$A#](B" + +(defvar its-zhuyin-tw-enable-quanjioao-alphabet t "*Enable Quanjiao alphabet") +(defvar its-zhuyin-tw-open-braket "$(G!V(B" "*[") ; "$(G!b(B " +(defvar its-zhuyin-tw-close-braket "$(G!W(B" "*]") ; "$(G!c(B" + +(eval-when-compile + (defmacro its-do-zhuyin-table (list) + `(progn + ,@(mapcar (lambda (syl) `(its-define-zhuyin ,@syl)) + list))) + + (defmacro its-define-zhuyin (shengmu yunmu1 &optional yunmu2 qing-only) + `(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")) + 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))))) + + (defmacro its-define-zhuyin-table () + '(let ((- '("" "")) + (B '("b" "(0E(B")) (P '("p" "(0F(B")) (M '("m" "(0G(B")) (F '("f" "(0H(B")) + (D '("d" "(0I(B")) (T '("t" "(0J(B")) (N '("n" "(0K(B")) (L '("l" "(0L(B")) + (G '("v" "(0M(B")) (K '("k" "(0N(B")) (H '("h" "(0O(B")) + (J '("g" "(0P(B")) (Q '("7" "(0Q(B")) (X '("c" "(0R(B")) + (ZH '("," "(0S(B")) (CH '("." "(0T(B")) (SH '("/" "(0U(B")) (R '("j" "(0V(B")) + (Z '(";" "(0W(B")) (C '(":" "(0X(B")) (S '("s" "(0Y(B")) + + (A '("a" "(0Z(B")) (O '("o" "(0[(B")) (e '("r" "(0\(B")) (E '("w" "(0](B")) + (AI '("i" "(0^(B")) (EI '("q" "(0_(B")) (AO '("z" "(0`(B")) + (AN '("8" "(0b(B")) (EN '("9" "(0c(B")) (ANG '("0" "(0d(B")) (ENG '("-" "(0e(B")) + (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-do-zhuyin-table + (((- 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 SH Z C ) EI) + ((- B P M D T N L G K H ZH CH SH R Z C S ) AO) + ((- B P M F D T N L G K H ZH CH SH R Z C S ) AN) + ((- B P M F D N G K H ZH CH SH R Z C S ) EN) + ((- B P M F D T N L G K H ZH CH SH R Z C S ) ANG) + ((- 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) + ((- B P M D T N L J Q X ) I E) + ((- B P M D T N L J Q X ) I AO) + ((- M D N L J Q X ) I OU) + ((- B P M D T N L J Q X ) I AN) + ((- B P M N L J Q X ) I EN) + ((- N L J Q X ) I ANG) + ((- B P M D T N L J Q X ) I ENG) + ((- B P M F D T N L G K H ZH CH SH R Z C S ) U) + ((- G K H ZH CH SH R ) U A) + ((- D T N L G K H ZH CH SH R Z C S ) U O) + ((- G K H ZH CH SH ) U AI) + ((- D T G K H ZH CH SH R Z C S ) U EI) + ((- D T N L G K H ZH CH SH R Z C S ) U AN) + ((- D T L G K H ZH CH SH R Z C S ) U EN) + ((- G K H ZH CH SH ) U ANG) + ((- D T N L G K H ZH CH R Z C S ) U ENG) + ((- N L J Q X ) V) + ((- N L J Q X ) V E) + ((- J Q X ) V AN) + ((- J Q X ) V EN) + ((- J Q X ) V ENG) + + ((- H) M nil t) + ((- H) '("@" "@") nil t) + ((- ) N nil t))) + + (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" + "Map for Zhuyin input. (Chinese-GB)" + + (defconst its-quanjiao-escape "Z") + (defconst its-banjiao-escape "X") + + (its-defrule-select-mode-temporally "B" downcase) + (its-defrule-select-mode-temporally "Q" quanjiao-downcase-cn) + + (its-define-zhuyin-table) + (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") + ("8" . "$A#8(B") ("9" . "$A#9(B") + (" " . "$A!!(B") ("!" . "$A#!(B") ("@" . "$A#@(B") ("#" . "$A##(B") + ("$" . "$A!g(B") ("%" . "$A#%(B") ("^" . "$A#^(B") ("&" . "$A#&(B") + ("*" . "$A#*(B") ("(" . "$A#((B") (")" . "$A#)(B") + ("-" . "$A#-(B") ("=" . "$A#=(B") ("`" . "$A#`(B") ("\\" . "$A#\(B") + ("|" . "$A#|(B") ("_" . "$A#_(B") ("+" . "$A#+(B") ("~" . "$A!+(B") + ("[" . "$A#[(B") ("]" . "$A#](B") ("{" . "$A#{(B") ("}" . "$A#}(B") + (":" . "$A#:(B") (";" . "$A#;(B") ("\"" . "$A#"(B") ("'" . "$A#'(B") + ("<" . "$A#<(B") (">" . "$A#>(B") ("?" . "$A#?(B") ("/" . "$A#/(B") + ("," . "$A#,(B") ("." . "$A#.(B") + ("a" . "$A#a(B") ("b" . "$A#b(B") ("c" . "$A#c(B") ("d" . "$A#d(B") + ("e" . "$A#e(B") ("f" . "$A#f(B") ("g" . "$A#g(B") ("h" . "$A#h(B") + ("i" . "$A#i(B") ("j" . "$A#j(B") ("k" . "$A#k(B") ("l" . "$A#l(B") + ("m" . "$A#m(B") ("n" . "$A#n(B") ("o" . "$A#o(B") ("p" . "$A#p(B") + ("q" . "$A#q(B") ("r" . "$A#r(B") ("s" . "$A#s(B") ("t" . "$A#t(B") + ("u" . "$A#u(B") ("v" . "$A#v(B") ("w" . "$A#w(B") ("x" . "$A#x(B") + ("y" . "$A#y(B") ("z" . "$A#z(B") + ("A" . "$A#A(B") ("B" . "$A#B(B") ("C" . "$A#C(B") ("D" . "$A#D(B") + ("E" . "$A#E(B") ("F" . "$A#F(B") ("G" . "$A#G(B") ("H" . "$A#H(B") + ("I" . "$A#I(B") ("J" . "$A#J(B") ("K" . "$A#K(B") ("L" . "$A#L(B") + ("M" . "$A#M(B") ("N" . "$A#N(B") ("O" . "$A#O(B") ("P" . "$A#P(B") + ("Q" . "$A#Q(B") ("R" . "$A#R(B") ("S" . "$A#S(B") ("T" . "$A#T(B") + ("U" . "$A#U(B") ("V" . "$A#V(B") ("W" . "$A#W(B") ("X" . "$A#X(B") + ("Y" . "$A#Y(B") ("Z" . "$A#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule (concat its-banjiao-escape in) in) + (its-defrule (concat its-quanjiao-escape in) out))) + + (its-defrule "<" "$A#,(B") + (its-defrule ">" "$A!#(B") + (its-defrule "?" "$A!"(B")) + +(define-its-state-machine its-zhuyin-tw-map + "zhuyin-tw" "$(GNC(BC" "Chinese-CNS" + "Map for Zhuyin input." + + (defconst its-quanjiao-escape "Z") + (defconst its-banjiao-escape "X") + + (its-defrule-select-mode-temporally "B" downcase) + (its-defrule-select-mode-temporally "Q" quanjiao-downcase-tw) + + (its-define-zhuyin-table) + (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") + ("8" . "$(G$)(B") ("9" . "$(G$*(B") + (" " . "$(G!!(B") ("!" . "$(G!*(B") ("@" . "$(G"i(B") ("#" . "$(G!l(B") + ("$" . "$(G"c(B") ("%" . "$(G"h(B") ("^" . "$(G!T(B") ("&" . "$(G!m(B") + ("*" . "$(G!n(B") ("(" . "$(G!>(B") (")" . "$(G!?(B") + ("-" . "$(G"1(B") ("=" . "$(G"8(B") ("`" . "$(G!j(B") ("\\" . "$(G"b(B") + ("|" . "$(G"^(B") ("_" . "$(G"%(B") ("+" . "$(G"0(B") ("~" . "$(G"D(B") + ("[" . "$(G!b(B") ("]" . "$(G!c(B") ("{" . "$A#{(B") ("}" . "$(G!a(B") + (":" . "$(G!((B") (";" . "$(G!'(B") ("\"" . "$(G!i(B") ("'" . "$(G!k(B") + ("<" . "$(G"6(B") (">" . "$(G"7(B") ("?" . "$(G!)(B") ("/" . "$(G"a(B") + ("," . "$(G!"(B") ("." . "$(G!%(B") + ("a" . "$(G$[(B") ("b" . "$(G$\(B") ("c" . "$(G$](B") ("d" . "$(G$^(B") + ("e" . "$(G$_(B") ("f" . "$(G$`(B") ("g" . "$(G$a(B") ("h" . "$(G$b(B") + ("i" . "$(G$c(B") ("j" . "$(G$d(B") ("k" . "$(G$e(B") ("l" . "$(G$f(B") + ("m" . "$(G$g(B") ("n" . "$(G$h(B") ("o" . "$(G$i(B") ("p" . "$(G$j(B") + ("q" . "$(G$k(B") ("r" . "$(G$l(B") ("s" . "$(G$m(B") ("t" . "$(G$n(B") + ("u" . "$(G$o(B") ("v" . "$(G$p(B") ("w" . "$(G$q(B") ("x" . "$(G$r(B") + ("y" . "$(G$s(B") ("z" . "$(G$t(B") + ("A" . "$(G$A(B") ("B" . "$(G$B(B") ("C" . "$(G$C(B") ("D" . "$(G$D(B") + ("E" . "$(G$E(B") ("F" . "$(G$F(B") ("G" . "$(G$G(B") ("H" . "$(G$H(B") + ("I" . "$(G$I(B") ("J" . "$(G$J(B") ("K" . "$(G$K(B") ("L" . "$(G$L(B") + ("M" . "$(G$M(B") ("N" . "$(G$N(B") ("O" . "$(G$O(B") ("P" . "$(G$P(B") + ("Q" . "$(G$Q(B") ("R" . "$(G$R(B") ("S" . "$(G$S(B") ("T" . "$(G$T(B") + ("U" . "$(G$U(B") ("V" . "$(G$V(B") ("W" . "$(G$W(B") ("X" . "$(G$X(B") + ("Y" . "$(G$Y(B") ("Z" . "$(G$Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule (concat its-banjiao-escape in) in) + (its-defrule (concat its-quanjiao-escape in) out))) + + (its-defrule "<" "$(G!"(B") + (its-defrule ">" "$(G!$(B") + (its-defrule "?" "$(G!#(B")) + +(define-its-state-machine-append its-zhuyin-cn-map + (its-defrule "[" its-zhuyin-cn-open-braket nil t) + (its-defrule "]" its-zhuyin-cn-close-braket nil t) + +(if its-zhuyin-cn-enable-quanjioao-alphabet + (progn + (its-defrule "#" "$A##(B") (its-defrule "$" "$A!g(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") + (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 "{" "$A#{(B") (its-defrule "}" "$A#}(B") + (its-defrule "\"" "$A#"(B") (its-defrule "'" "$A#'(B")) + (progn + (its-defrule "#" "#") (its-defrule "$" "$") + (its-defrule "%" "%") + (its-defrule "&" "&") (its-defrule "*" "*") + (its-defrule "(" "(") (its-defrule ")" ")") + (its-defrule "~" "~") + (its-defrule "=" "=") (its-defrule "`" "`") + (its-defrule "\\" "\\") (its-defrule "|" "|") + (its-defrule "_" "_") (its-defrule "+" "+") + (its-defrule "{" "{") (its-defrule "}" "}") + (its-defrule "\"" "\"") (its-defrule "'" "'")))) + +(define-its-state-machine-append its-zhuyin-tw-map + (its-defrule "[" its-zhuyin-tw-open-braket nil t) + (its-defrule "]" its-zhuyin-tw-close-braket nil t) + + (if its-zhuyin-tw-enable-quanjioao-alphabet + (progn + (its-defrule "#" "$(G!l(B") (its-defrule "$" "$(G"c(B") + (its-defrule "%" "$(G"h(B") + (its-defrule "&" "$(G!m(B") (its-defrule "*" "$(G!n(B") + (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"0(B") + (its-defrule "{" "$A#{(B") (its-defrule "}" "$(G!a(B") + (its-defrule "\"" "$(G!i(B") (its-defrule "'" "$(G!k(B")) + (progn + (its-defrule "#" "#") (its-defrule "$" "$") + (its-defrule "%" "%") + (its-defrule "&" "&") (its-defrule "*" "*") + (its-defrule "(" "(") (its-defrule ")" ")") + (its-defrule "~" "~") + (its-defrule "=" "=") (its-defrule "`" "`") + (its-defrule "\\" "\\") (its-defrule "|" "|") + (its-defrule "_" "_") (its-defrule "+" "+") + (its-defrule "{" "{") (its-defrule "}" "}") + (its-defrule "\"" "\"") (its-defrule "'" "'")))) + +(provide 'its/zhuyin)