wnn7egg-1.02.orig/0040755000764400003210000000000007474174160014150 5ustar ishikawaishikawawnn7egg-1.02.orig/elisp/0040755000764400003210000000000007474174160015264 5ustar ishikawaishikawawnn7egg-1.02.orig/elisp/emacs20/0040755000764400003210000000000007474174160016516 5ustar ishikawaishikawawnn7egg-1.02.orig/elisp/emacs20/wnn7egg-cnv.el0100644000764400003210000023000307474174160021173 0ustar ishikawaishikawa;; Wnn7Egg is Egg modified for Wnn7, and the current maintainer ;; is OMRON SOFTWARE Co., Ltd. ;; ;; This file is part of Wnn7Egg. (base code is wnn-egg.el (eggV3.09)) ;; ;;; ------------------------------------------------------------------ ;;; ;;; Wnn7Egg $B!J(BWnn "$B$J$J(B"$B$?$^$4!K(B--- Wnn7 Emacs Client ;;; ;;; Wnn7Egg $B$O!"!V$?$^$4Bh#3HG!W(Bv3.09 $B$r%Y!<%9$K(B $B!V$?$^$4Bh#4HG!W$NDL?.!"(B ;;; $B%i%$%V%i%jIt$rAH$_9~$s$@!"(BWnn7 $B$N0Y$N@lMQ%/%i%$%"%s%H$G$9!#(B ;;; ;;; $B$9$Y$F$N%=!<%9$,(B Emacs Lisp $B$G5-=R$5$l$F$$$k$N$G!"(BWnn SDK/Library $B$rI,MW(B ;;; $B$H$;$:!"(BGNU Emacs $B5Z$S(B XEmacs $B4D6-$G;HMQ$9$k$3$H$,$G$-$^$9!#;HMQ5vBz>r7o(B ;;; $B$O(B GPL $B$G$9!#(B ;;; ;;; GNU Emacs 20.3 $B0J9_!"(BXEmacs 21.x $B0J9_$GF0:n3NG'$7$F$$$^$9!#(B ;;; ;;; ;;; Wnn7Egg $B$O(B Wnn7 $B$N5!G=$G$"$k3Z!9F~NO!JF~NOM=B,!K!"O"A[JQ49$r%5%]!<%H(B ;;; $B$7$F$$$^$9!#(B ;;; ;;; $B!V$?$^$4!W$HFHN)!?6&B8$G$-$k$h$&$K!"1F6A$9$k$r(B ;;; "wnn7..." $B$H$$$&7A$KJQ99$7$F$$$^$9!#(B ;;; ;;; ------------------------------------------------------------------ ;;; wnn-egg.el --- a inputting method communicating with [jck]server ;; Author: Satoru Tomura (tomura@etl.go.jp), and ;; Toshiaki Shingu (shingu@cpr.canon.co.jp) ;; Keywords: inputting method ;; This file is part of Egg on Mule (Multilingual Environment) ;; Egg is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; Egg is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the Free ;; Software Foundation Inc., 59 Temple Place - Suite 330, Boston, ;; MA 02111-1307, USA. ;;; Commentary: ;;; Modified for Wnn V4 and Wnn6 by Satoru Tomura(tomura@etl.go.jp) ;;; Modified for Wnn6 by OMRON ;;; Written by Toshiaki Shingu (shingu@cpr.canon.co.jp) ;;; Modified for Wnn V4 library on wnn4v3-egg.el ;;; $B$?$^$4!V$?$+$J!W%P!<%8%g%s(B ;;; $B!V$?$+$J!W$H$ODR$1J*$N$?$+$J$G$O$"$j$^$;$s!#(B ;;; $B!V$?$^$4$h!?$+$7$3$/!?$J!$7$^$7$?!#(B ;;; Wnn V4 $B$N(B jl $B%i%$%V%i%j$r;H$$$^$9!#(B ;;; $B%i%$%V%i%j$H$N%$%s%?!<%U%'!<%9$O(B wnnfns.c $B$GDj5A$5$l$F$$$^$9!#(B ;;; $B=$@5%a%b(B ;;; 02/5/16 $B>.J8;z$R$i$,$J!J$!$#$%!K$NJQ498e$N(B M-k, M-h $BF0:n$N=$@5(B ;;; 02/5/16 skip-wnn-setenv-if-env-exist $B$r(B t $B$KJQ99(B ;;; 01/9/30 bug fix by OMRON SOFTWARE Co.,Ltd. ;;; 94/2/3 kWnn support by H.Kuribayashi ;;; 93/11/24 henkan-select-kouho: bug fixed ;;; 93/7/22 hinsi-from-menu updated ;;; 93/5/12 remove-regexp-in-string ;;; fixed by Shuji NARAZAKI ;;; 93/4/22 set-wnn-host-name, set-cwnn-host-name ;;; 93/4/5 EGG:open-wnn, close-wnn modified by tsuiki. ;;; 93/4/2 wnn-param-set ;;; 93/4/2 modified along with wnn4fns.c ;;; 93/3/3 edit-dict-item: bug fixed ;;; 93/1/8 henkan-help-command modified. ;;; 92/12/1 buffer local 'wnn-server-type' and 'cwnn-zhuyin' ;;; so as to support individual its mode with multiple buffers. ;;; 92/11/26 set-cserver-host-name fixed. ;;; 92/11/26 its:{previous,next}-mode by ;;; 92/11/25 set-wnn-host-name was changed to set-{j,c}server-host-name. ;;; 92/11/25 redefined its:select-mode and its:select-mode-from-menu ;;; defined in egg.el to run hook with its mode selection. ;;; 92/11/20 bug fixed related to henkan mode attribute. ;;; 92/11/12 get-wnn-host-name and set-wnn-host-name were changed. ;;; 92/11/10 (set-dict-comment) bug fixed ;;; 92/10/27 (henkan-region-internal) display message if error occurs. ;;; 92/9/28 completely modified for chinese trandlation. ;;; 92/9/28 diced-{use,hindo-set} bug fixed ;;; 92/9/22 touroku-henkan-mode by ;;; 92/9/18 rewrite wnn-dict-add to support password files. ;;; 92/9/8 henkan-region-internal was modified. ;;; 92/9/8 henkan-mode-map " " 'henkan-next-kouho-dai -> 'henkan-next-kouho ;;; 92/9/7 henkan-mode-map "\C-h" 'help-command -> 'henkan-help-command (Shuji Narazaki) ;;; 92/9/3 wnn-server-get-msg without wnn-error-code. ;;; 92/9/3 get-wnn-lang-name was modified. ;;; 92/8/19 get-wnn-lang-name $B$NJQ99(B (by T.Matsuzawa) ;;; 92/8/5 Bug in henkan-kakutei-first-char fixed. (by Y.Kasai) ;;; 92/7/17 set-egg-henkan-format $B$NJQ99(B ;;; 92/7/17 egg:error $B$N0z?t$r(B format &rest args $B$KJQ99(B ;;; 92/7/17 henkan/gyaku-henkan-word $B$N=$@5(B ;;; 92/7/17 henkan/gyaku-henkan-paragraph/sentence/word $B$G!"(B ;;; $BI=<($,Mp$l$k$N$r=$@5!J(Bsave-excursion $B$r$O$:$9!K(B ;;; 92.7.14 Unnecessary '*' in comments of variables deleted. (by T.Ito) ;;; 92/7/10 henkan-kakutei-first-char $B$rDI2C!"(BC-@ $B$K3d$jEv$F!#(B(by K.Handa) ;;; 92/7/8 overwrite-mode $B$N%5%]!<%H(B(by K. Handa) ;;; 92/6/30 startup file $B<~$j$NJQ99(B ;;; 92/6/30 $BJQ49%b!<%I$N%"%H%j%S%e!<%H$K(B bold $B$rDI2C(B ;;; (by ITO Toshiyuki ) ;;; 92/6/22 $B6uJ8;zNs$rJQ49$9$k$HMn$A$k%P%0$r=$@5(B ;;; 92/5/20 set-egg-henkan-mode-format $B$N(B bug fix ;;; 92/5/20 egg:set-bunsetu-attribute $B$,BgJ8@a$G@5$7$/F0$/$h$&$KJQ99(B ;;; 92/5/19 version 0 ;;; ---------------------------------------------------------------- ;;; Code: ;;; Last modified date: 2002/5/16 ;;; wnn7egg-cnv.el version 1.02 (require 'wnn7egg-lib) (defvar egg:*sho-bunsetu-face* nil "*$B>.J8@aI=<($KMQ$$$k(B face $B$^$?$O(B nil") (defvar egg:*sho-bunsetu-kugiri* "-" "*$B>.J8@a$N6h@Z$j$r<($9J8;zNs(B") (defvar egg:*dai-bunsetu-face* nil "*$BBgJ8@aI=<($KMQ$$$k(B face $B$^$?$O(B nil") (defvar egg:*dai-bunsetu-kugiri* " " "*$BBgJ8@a$N6h@Z$j$r<($9J8;zNs(B") (defvar egg:*henkan-face* nil "*$BJQ49NN0h$rI=<($9$k(B face $B$^$?$O(B nil") (if (featurep 'xemacs) (progn (make-variable-buffer-local (defvar egg:*sho-bunsetu-extent* nil "$B>.J8@a$NI=<($K;H$&(B extent")) (make-variable-buffer-local (defvar egg:*dai-bunsetu-extent* nil "$BBgJ8@a$NI=<($K;H$&(B extent")) (make-variable-buffer-local (defvar egg:*henkan-extent* nil "$BJQ49NN0h$NI=<($K;H$&(B extent"))) (make-variable-buffer-local (defvar egg:*sho-bunsetu-overlay* nil "$B>.J8@a$NI=<($K;H$&(B overlay")) (make-variable-buffer-local (defvar egg:*dai-bunsetu-overlay* nil "$BBgJ8@a$NI=<($K;H$&(B overlay")) (make-variable-buffer-local (defvar egg:*henkan-overlay* nil "$BJQ49NN0h$NI=<($K;H$&(B overlay"))) (defvar egg:*henkan-open* "|" "*$BJQ49$N;OE@$r<($9J8;zNs(B") (defvar egg:*henkan-close* "|" "*$BJQ49$N=*E@$r<($9J8;zNs(B") (make-variable-buffer-local (defvar wnn7-henkan-mode-in-use nil "buffer $B$,JQ49Cf$N;~(B t")) ;;; ---------------------------------------------------------------- ;;; $B0J2<$N(B its mode $B4X78$N4X?t$O!"(Begg.el $B$GDj5A$5$l$F$$$k$,!"(B ;;; $B$?$+$J$G$O(B its mode $B$N@ZBX$($KF14|$7$F!"(Bjserver/cserver, ;;; pinyin/zhuyin $B$N@ZBX$($b9T$J$$$?$$$N$G!":FDj5A$7$F$$$k!#(B ;;; $B=>$C$F!"(Begg.el, wnn-egg.el $B$N=g$K%m!<%I$7$J$1$l$P$J$i$J$$!#(B (defun its:select-mode (name) (interactive (list (completing-read "ITS mode: " its:*mode-alist*))) (if (its:get-mode-map name) (progn (setq its:*current-map* (its:get-mode-map name)) (egg:mode-line-display) (run-hooks 'its:select-mode-hook)) (beep))) (defun its:select-mode-from-menu () (interactive) (setcar (nthcdr 2 its:*select-mode-menu*) its:*mode-alist*) (setq its:*current-map* (menu:select-from-menu its:*select-mode-menu*)) (egg:mode-line-display) (run-hooks 'its:select-mode-hook)) (defvar its:select-mode-hook nil) (defun its:next-mode () (interactive) (let ((pos (its:find its:*current-map* its:*standard-modes*))) (setq its:*current-map* (nth (% (1+ pos) (length its:*standard-modes*)) its:*standard-modes*)) (egg:mode-line-display) (run-hooks 'its:select-mode-hook))) (defun its:previous-mode () (interactive) (let ((pos (its:find its:*current-map* its:*standard-modes*))) (setq its:*current-map* (nth (1- (if (= pos 0) (length its:*standard-modes*) pos)) its:*standard-modes*)) (egg:mode-line-display) (run-hooks 'its:select-mode-hook))) (defun read-current-its-string (prompt &optional initial-input henkan) (let ((egg:fence-buffer (window-buffer (minibuffer-window))) (old-its-map its:*current-map*)) (save-excursion (set-buffer egg:fence-buffer) (setq egg:*input-mode* t egg:*mode-on* t its:*current-map* old-its-map) (mode-line-egg-mode-update (nth 1 (its:get-mode-indicator its:*current-map*))) (read-from-minibuffer prompt initial-input (if henkan nil egg:*minibuffer-local-hiragana-map*))))) ;;;---------------------------------------------------------------------- ;;; ;;; Kana Kanji Henkan ;;; ;;;---------------------------------------------------------------------- (defvar wnn7-server-list nil "Wnn7 jserver host list") (defvar wnn7-server-name nil "Wnn7 jserver host name") (defvar egg:*sai-henkan-start* nil) (defvar egg:*sai-henkan-end* nil) (defvar egg:*old-bunsetu-suu* nil) (add-hook 'kill-emacs-hook 'close-wnn7) ;;; ;;; Entry functions for egg-startup-file ;;; (defvar skip-wnn-setenv-if-env-exist t "skip wnn environment setting when the same name environment exists") (defmacro push-end (val loc) (list 'push-end-internal val (list 'quote loc))) (defun push-end-internal (val loc) (set loc (if (eval loc) (nconc (eval loc) (cons val nil)) (cons val nil)))) ;; ;; for parameter operation ;; (defun wnn7-set-reverse (arg) (wnn7-server-set-rev arg)) (defun wnn7-set-param (&rest param) "based upon set-wnn-param" (interactive) (let ((current-param (append (wnn7-server-get-param) nil)) (new-param) (message (wnn7-msg-get 'param))) (while current-param (setq new-param (cons (if (or (null param) (null (car param))) (string-to-int (read-from-minibuffer (concat (car message) ": ") (int-to-string (car current-param)))) (car param)) new-param)) (setq current-param (cdr current-param) message (cdr message) param (if param (cdr param) nil))) (wnn7-server-set-param (vconcat (nreverse new-param))))) (defun wnn7-add-dict (dfile hfile priority dmode hmode &optional dpaswd hpaswd) "based upon add-wnn-dict" (wnn7-server-dict-add (substitute-in-file-name dfile) (substitute-in-file-name hfile) priority dmode hmode dpaswd hpaswd)) (defun wnn7-set-fuzokugo (ffile) "based upon set-wnn-fuzokugo" (wnn7-server-fuzokugo-set (substitute-in-file-name ffile))) (defun wnn7-add-fisys-dict (dfile hfile hmode &optional hpaswd) "based upon add-wnn-fisys-dict" (wnn7-server-fisys-dict-add (substitute-in-file-name dfile) (substitute-in-file-name hfile) hmode hpaswd)) (defun wnn7-add-fiusr-dict (dfile hfile dmode hmode &optional dpaswd hpaswd) "based upon add-wnn-fiusr-dict" (wnn7-server-fiusr-dict-add (substitute-in-file-name dfile) (substitute-in-file-name hfile) dmode hmode dpaswd hpaswd)) (defun wnn7-add-notrans-dict (dfile priority dmode &optional dpaswd) "based upon add-wnn-notrans-dict" (wnn7-server-notrans-dict-add (substitute-in-file-name dfile) priority dmode dpaswd)) (defun wnn7-add-bmodify-dict (dfile priority dmode &optional dpaswd) "based upon add-wnn7-bmodify-dict" (wnn7-server-bmodify-dict-add (substitute-in-file-name dfile) priority dmode dpaswd)) (defun wnn7-set-last-is-first-mode (mode) "based upon set-last-is-first-mode" (let ((result (wnn7-server-set-last-is-first mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-complex-conv-mode (mode) "based upon set-complex-conv-mode" (let ((result (wnn7-server-set-complex-conv-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-okuri-learn-mode (mode) "based upon set-okuri-learn-mode" (let ((result (wnn7-server-set-okuri-learn-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-okuri-flag (mode) "based upon set-okuri-flag" (let ((result (wnn7-server-set-okuri-flag mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-prefix-learn-mode (mode) "based upon set-prefix-learn-mode" (let ((result (wnn7-server-set-prefix-learn-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-prefix-flag (mode) "based upon set-prefix-flag" (let ((result (wnn7-server-set-prefix-flag mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-suffix-learn-mode (mode) "based upon set-suffix-learn-mode" (let ((result (wnn7-server-set-suffix-learn-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-common-learn-mode (mode) "based upon set-common-learn-mode" (let ((result (wnn7-server-set-common-learn-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-freq-func-mode (mode) "based upon set-freq-func-mode" (let ((result (wnn7-server-set-freq-func-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-numeric-mode (mode) "based upon set-numeric-mode" (let ((result (wnn7-server-set-numeric-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-alphabet-mode (mode) "based upon set-alphabet-mode" (let ((result (wnn7-server-set-alphabet-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-symbol-mode (mode) "based upon set-symbol-mode" (let ((result (wnn7-server-set-symbol-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-yuragi-mode (mode) "based upon set-yuragi-mode" (let ((result (wnn7-server-set-yuragi-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-rendaku-mode (mode) "based upon set-rendaku-mode" (let ((result (wnn7-server-set-rendaku-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-yosoku-learn (mode) (let ((result (wnn7-server-set-yosoku-learn-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-yosoku-max-disp (max) (let ((result (wnn7-server-set-yosoku-max-disp max))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-yosoku-last-is-first (mode) (let ((result (wnn7-server-set-yosoku-last-is-first-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-boin-kabusoku (mode) (let ((result (wnn7-server-set-boin-kabusoku mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-shiin-choka (mode) (let ((result (wnn7-server-set-shiin-choka mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-n-choka (mode) (let ((result (wnn7-server-set-n-choka mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-nihongo-kosei (mode) (let ((result (wnn7-server-set-nihongo-kosei mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) ;;; ;;; WNN interface ;;; (defmacro make-host-list (name list) `(cons ,name (delete ,name ,list))) (defun set-wnn7-host-name (name) (interactive "sHost name: ") (close-wnn7) (setq wnn7-server-list (make-host-list name (or wnn7-server-list (list (or wnn7-server-name (getenv "JSERVER"))))))) (fset 'set-jserver-host-name (symbol-function 'set-wnn7-host-name)) (defvar wnn7egg-default-startup-file "eggrc-wnn7" "*Wnn7Egg startup file name (system default)") (defvar wnn7egg-startup-file ".eggrc-wnn7" "*Wnn7Egg startup file name.") ;;; 92/6/30, by K.Handa (defvar egg-startup-file-search-path '("~" ".") "*List of directories to search for egg-startup-file whose name defaults to .eggrc.") (defun egg:search-file (filename searchpath) (if (file-name-directory filename) (let ((file (substitute-in-file-name (expand-file-name filename)))) (if (file-exists-p file) file nil)) (catch 'answer (while searchpath (let ((path (car searchpath))) (if (stringp path) (let ((file (substitute-in-file-name (expand-file-name filename path)))) (if (file-exists-p file) (throw 'answer file))))) (setq searchpath (cdr searchpath))) nil))) ;;; ;;; Entry functions for wnn7egg-startup-file ;;; (defun open-wnn7 () (if (null (wnn7-server-isconnect)); as wnn-search-environment (eggV4) (let ((hostlist (or wnn7-server-list (list (or wnn7-server-name (getenv "JSERVER") "localhost")))) (loginname (user-login-name)) result) (catch 'success (while hostlist (let ((hostname (car hostlist)) poffset pabs) (setq wnn7-active-server-port wnn7-server-default-port) (if (or (setq poffset (string-match ":" hostname)) (setq pabs (string-match "/" hostname))) (if poffset (progn (setq wnn7-active-server-port (+ wnn7-active-server-port (string-to-number (substring hostname (match-end 0))))) (setq hostname (substring hostname 0 (match-beginning 0)))) (setq wnn7-active-server-port (string-to-number (substring hostname (1+ pabs) nil))) (setq hostname (substring hostname 0 pabs)))) (if (or (not hostname) (equal hostname "")) (setq hostname "localhost")) (if (setq wnn7-process (wnn7-server-start hostname)) (progn (and (= 0 (setq result (wnn7-server-open wnn7-process hostname loginname))) (<= 0 (setq result (wnn7-server-connect wnn7-process loginname))) (setq loginname (concat loginname "R")) (<= 0 (setq result (wnn7-server-connect wnn7-process loginname t))) (setq wnn7-active-server-name hostname) (throw 'success hostname)) (setq hostlist (cdr hostlist))) (setq hostlist (cdr hostlist)))))) (cond ((and result (<= 0 result)) ;; connected (notify (wnn7-msg-get 'open-wnn) wnn7-active-server-name) ;; parameter set (wnn7-param-set) ;; re-init input-predict, when jserver restarted. (if (and (wnn7-p) egg-yosoku-mode) (egg-use-input-predict))) ((and result (> 0 result)) ;; server error (egg:error (wnn7rpc-get-error-message (- result)))) ((not result) ;; cannot connect (egg:error (wnn7-msg-get 'cannot-connect))) )))) (defun wnn7-param-set () (let* ((path (append egg-startup-file-search-path load-path)) (eggrc (or (egg:search-file wnn7egg-startup-file path) (egg:search-file wnn7egg-default-startup-file load-path)))) (if (or (null skip-wnn-setenv-if-env-exist) (null (wnn7-server-dict-list))) (if eggrc (load-file eggrc) (wnn7-server-close) (egg:error (wnn7-msg-get 'no-rcfile) path))) (run-hooks 'egg:open-wnn-hook))) (defun disconnect-wnn7 () (interactive) (if (wnn7-server-isconnect) (wnn7-server-close))) (defun close-wnn7 () (interactive) (if (wnn7-server-isconnect) (progn (wnn7-server-set-rev nil) (wnn7-server-dict-save) (message (wnn7-msg-get 'file-saved)) (sit-for 0) (when egg-predict-status (wnn7-server-predict-save-data) (wnn7-server-predict-free)) (wnn7-server-set-rev t) (wnn7-server-dict-save) (message (wnn7-msg-get 'file-saved)) (sit-for 0) (wnn7-server-close) (run-hooks 'egg:close-wnn7-hook)))) ;;; ;;; Kanji henkan ;;; (defvar wnn7-rensou-touroku nil) (defvar egg:*kanji-kanabuff* nil) (defvar egg:*dai* t) (defvar *bunsetu-number* nil) (defvar *zenkouho-suu* nil) (defvar *zenkouho-offset* nil) (defun wnn7-bunsetu-length-sho (number) (length (wnn7-server-bunsetu-yomi number))) (defun wnn7-bunsetu-length (number) (let ((max (wnn7-server-dai-end number)) (i (1+ number)) (l (wnn7-bunsetu-length-sho number))) (while (< i max) (setq l (+ l (wnn7-bunsetu-length-sho i))) (setq i (1+ i))) l)) (defun wnn7-bunsetu-position (number) (let ((pos egg:*region-start*) (i 0)) (while (< i number) (setq pos (+ pos (length (wnn7-server-bunsetu-kanji i)) (if (wnn7-server-dai-top (1+ i)) (length egg:*dai-bunsetu-kugiri*) (length egg:*sho-bunsetu-kugiri*)))) (setq i (1+ i))) pos)) (defun wnn7-bunsetu-kouho-suu (bunsetu-number init) (let ((cand)) (when (or init (null (wnn7-server-zenkouho-bun-p bunsetu-number))) (setq cand (wnn7-server-zenkouho bunsetu-number egg:*dai*))) (setq cand (wnn7-server-get-zenkouho bunsetu-number) *zenkouho-suu* (length cand)))) (defun wnn7-bunsetu-kouho-list (bunsetu-number init) (let ((cand)) (when (or init (null (wnn7-server-zenkouho-bun-p bunsetu-number))) (setq cand (wnn7-server-zenkouho bunsetu-number egg:*dai*)) (setq *zenkouho-offset* (car cand))) (setq cand (wnn7-server-get-zenkouho bunsetu-number) *zenkouho-suu* (length cand)) cand)) (defun wnn7-bunsetu-kouho-number (bunsetu-number init) (let ((cand)) (when (or init (null (wnn7-server-zenkouho-bun-p bunsetu-number))) (setq cand (wnn7-server-zenkouho bunsetu-number egg:*dai*)) (setq *zenkouho-offset* (car cand))) *zenkouho-offset*)) ;;;; ;;;; User entry : henkan-region, henkan-paragraph, henkan-sentence ;;;; (defun egg:henkan-face-on () ;; Make an overlay if henkan overlay does not exist. ;; Move henkan overlay to henkan region. (if egg:*henkan-face* (if (featurep 'xemacs) (progn (if (extentp egg:*henkan-extent*) (set-extent-endpoints egg:*henkan-extent* egg:*region-start* egg:*region-end*) (setq egg:*henkan-extent* (make-extent egg:*region-start* egg:*region-end*)) (set-extent-property egg:*henkan-extent* 'start-open nil) (set-extent-property egg:*henkan-extent* 'end-open nil) (set-extent-property egg:*henkan-extent* 'detachable nil)) (set-extent-face egg:*henkan-extent* egg:*henkan-face*)) (progn (if (overlayp egg:*henkan-overlay*) nil (setq egg:*henkan-overlay* (make-overlay 1 1 nil nil t)) (overlay-put egg:*henkan-overlay* 'face egg:*henkan-face*)) (move-overlay egg:*henkan-overlay* egg:*region-start* egg:*region-end*))))) (defun egg:henkan-face-off () ;; detach henkan overlay from the current buffer. (if (featurep 'xemacs) (and egg:*henkan-face* (extentp egg:*henkan-extent*) (detach-extent egg:*henkan-extent*)) (and egg:*henkan-face* (overlayp egg:*henkan-overlay*) (delete-overlay egg:*henkan-overlay*)))) (defun wnn7-henkan-region (start end) "Convert a text in the region between START and END from kana to kanji." (interactive "r") (if (interactive-p) (set-mark (point))) ;;; to be fixed (wnn7-henkan-region-internal start end)) (defun wnn7-gyaku-henkan-region (start end) "Convert a text in the region between START and END from kanji to kana." (interactive "r") (if (interactive-p) (set-mark (point))) ;;; to be fixed (wnn7-henkan-region-internal start end t)) (defun wnn7-henkan-region-internal (start end &optional rev) ;; region $B$r$+$J4A;zJQ49$9$k(B (if wnn7-henkan-mode-in-use nil (let ((finished nil)) (unwind-protect (progn (setq wnn7-henkan-mode-in-use t) (if (null (wnn7-server-isconnect)) (open-wnn7)) (setq egg:*kanji-kanabuff* (buffer-substring start end)) (setq *bunsetu-number* 0) (setq egg:*dai* t) ; 92.9.8 by T.shingu (wnn7-server-set-rev rev) (let ((result (wnn7-server-henkan-begin egg:*kanji-kanabuff*))) (if (and result (> (car result) 0)) (progn (mode-line-egg-mode-update (wnn7-msg-get 'henkan-mode-indicator)) (goto-char start) (or (markerp egg:*region-start*) (setq egg:*region-start* (make-marker))) (or (markerp egg:*region-end*) (progn (setq egg:*region-end* (make-marker)) (set-marker-insertion-type egg:*region-end* t))) (if (null (marker-position egg:*region-start*)) (progn (delete-region start end) (suspend-undo) (goto-char start) (insert egg:*henkan-open*) (set-marker egg:*region-start* (point)) (insert egg:*henkan-close*) (set-marker egg:*region-end* egg:*region-start*) (goto-char egg:*region-start*) ) (progn (egg:fence-face-off) (delete-region (- egg:*region-start* (length egg:*fence-open*)) egg:*region-start*) (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*fence-close*))) (goto-char egg:*region-start*) (insert egg:*henkan-open*) (set-marker egg:*region-start* (point)) (goto-char egg:*region-end*) (let ((point (point))) (insert egg:*henkan-close*) (set-marker egg:*region-end* point)) (goto-char start) (delete-region start end) )) (wnn7-henkan-insert-kouho 0 (car result)) (egg:henkan-face-on) (wnn7-bunsetu-face-on) (wnn7-henkan-goto-bunsetu 0) (run-hooks 'egg:henkan-start-hook)))) (setq finished t)) (or finished (setq wnn7-henkan-mode-in-use nil) (resume-undo-list))))) ) (defun wnn7-henkan-paragraph () "Convert the current paragraph from kana to kanji." (interactive) (forward-paragraph) (let ((end (point))) (backward-paragraph) (wnn7-henkan-region-internal (point) end))) (defun wnn7-gyaku-henkan-paragraph () "Convert the current paragraph from kanji to kana." (interactive) (forward-paragraph) (let ((end (point))) (backward-paragraph) (wnn7-henkan-region-internal (point) end t))) (defun wnn7-henkan-sentence () "Convert the current sentence from kana to kanji." (interactive) (forward-sentence) (let ((end (point))) (backward-sentence) (wnn7-henkan-region-internal (point) end))) (defun wnn7-gyaku-henkan-sentence () "Convert the current sentence from kanji to kana." (interactive) (forward-sentence) (let ((end (point))) (backward-sentence) (wnn7-henkan-region-internal (point) end t))) (defun wnn7-henkan-word () "Convert the current word from kana to kanji." (interactive) (re-search-backward "\\<" nil t) (let ((start (point))) (re-search-forward "\\>" nil t) (wnn7-henkan-region-internal start (point)))) (defun wnn7-gyaku-henkan-word () "Convert the current word from kanji to kana." (interactive) (re-search-backward "\\<" nil t) (let ((start (point))) (re-search-forward "\\>" nil t) (wnn7-henkan-region-internal start (point) t))) ;;; ;;; Kana Kanji Henkan Henshuu mode ;;; (defun set-egg-henkan-mode-format (open close kugiri-dai kugiri-sho &optional henkan-face dai-bunsetu-face sho-bunsetu-face) "$BJQ49(B mode $B$NI=<(J}K!$r@_Dj$9$k!#(BOPEN $B$OJQ49$N;OE@$r<($9J8;zNs$^$?$O(B nil$B!#(B CLOSE$B$OJQ49$N=*E@$r<($9J8;zNs$^$?$O(B nil$B!#(B KUGIRI-DAI$B$OBgJ8@a$N6h@Z$j$rI=<($9$kJ8;zNs$^$?$O(B nil$B!#(B KUGIRI-SHO$B$O>.J8@a$N6h@Z$j$rI=<($9$kJ8;zNs$^$?$O(B nil$B!#(B optional HENKAN-FACE $B$OJQ496h4V$rI=<($9$k(B face $B$^$?$O(B nil optional DAI-BUNSETU-FACE $B$OBgJ8@a6h4V$rI=<($9$k(B face $B$^$?$O(B nil optional SHO-BUNSETU-FACE $B$O>.J8@a6h4V$rI=<($9$k(B face $B$^$?$O(B nil" (interactive (list (read-string (wnn7-msg-get 'begin-henkan)) (read-string (wnn7-msg-get 'end-henkan)) (read-string (wnn7-msg-get 'kugiri-dai)) (read-string (wnn7-msg-get 'kugiri-sho)) (cdr (assoc (completing-read (wnn7-msg-get 'face-henkan) egg:*face-alist*) egg:*face-alist*)) (cdr (assoc (completing-read (wnn7-msg-get 'face-dai) egg:*face-alist*) egg:*face-alist*)) (cdr (assoc (completing-read (wnn7-msg-get 'face-sho) egg:*face-alist*) egg:*face-alist*)) )) (if (or (stringp open) (null open)) (setq egg:*henkan-open* (or open "")) (egg:error "Wrong type of arguments(open): %s" open)) (if (or (stringp close) (null close)) (setq egg:*henkan-close* (or close "")) (egg:error "Wrong type of arguments(close): %s" close)) (if (or (stringp kugiri-dai) (null kugiri-dai)) (setq egg:*dai-bunsetu-kugiri* (or kugiri-dai "")) (egg:error "Wrong type of arguments(kugiri-dai): %s" kugiri-dai)) (if (or (stringp kugiri-sho) (null kugiri-sho)) (setq egg:*sho-bunsetu-kugiri* (or kugiri-sho "")) (egg:error "Wrong type of arguments(kugiri-sho): %s" kugiri-sho)) (if (or (null henkan-face) (memq henkan-face (face-list))) (progn (setq egg:*henkan-face* henkan-face) (if (featurep 'xemacs) (if (extentp egg:*henkan-extent*) (set-extent-property egg:*henkan-extent* 'face egg:*henkan-face*)) (if (overlayp egg:*henkan-overlay*) (overlay-put egg:*henkan-overlay* 'face egg:*henkan-face*)))) (egg:error "Wrong type of arguments(henkan-face): %s" henkan-face)) (if (or (null dai-bunsetu-face) (memq dai-bunsetu-face (face-list))) (progn (setq egg:*dai-bunsetu-face* dai-bunsetu-face) (if (featurep 'xemacs) (if (extentp egg:*dai-bunsetu-extent*) (set-extent-property egg:*dai-bunsetu-extent* 'face egg:*dai-bunsetu-face*)) (if (overlayp egg:*dai-bunsetu-overlay*) (overlay-put egg:*dai-bunsetu-overlay* 'face egg:*dai-bunsetu-face*)))) (egg:error "Wrong type of arguments(dai-bunsetu-face): %s" dai-bunsetu-face)) (if (or (null sho-bunsetu-face) (memq sho-bunsetu-face (face-list))) (progn (setq egg:*sho-bunsetu-face* sho-bunsetu-face) (if (featurep 'xemacs) (if (extentp egg:*sho-bunsetu-extent*) (set-extent-property egg:*sho-bunsetu-extent* 'face egg:*sho-bunsetu-face*)) (if (overlayp egg:*sho-bunsetu-overlay*) (overlay-put egg:*sho-bunsetu-overlay* 'face egg:*sho-bunsetu-face*)))) (egg:error "Wrong type of arguments(sho-bunsetu-face): %s" sho-bunsetu-face)) ) (defun wnn7-henkan-insert-kouho (startno number) (let ((i startno)) (while (< i number) (insert (wnn7-server-bunsetu-kanji i) ;; $B$3$3$OBgJ8@a!)(B (if (= (1+ i) number) "" (if (wnn7-server-dai-top (1+ i)) ;;; (if (wnn7-server-dai-top i) egg:*dai-bunsetu-kugiri* egg:*sho-bunsetu-kugiri*))) (setq i (1+ i))))) (defun wnn7-henkan-kakutei () (interactive) (egg:bunsetu-face-off) (egg:henkan-face-off) (setq wnn7-henkan-mode-in-use nil) (setq egg:*in-fence-mode* nil) (delete-region (- egg:*region-start* (length egg:*henkan-open*)) egg:*region-start*) (delete-region egg:*region-start* egg:*region-end*) (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*henkan-close*))) (goto-char egg:*region-start*) (setq egg:*sai-henkan-start* (point)) (when egg-predict-status (egg-predict-clear)) (resume-undo-list) (let ((i 0) (max (wnn7-server-bunsetu-suu))) (setq egg:*old-bunsetu-suu* max) (while (< i max) (insert (wnn7-server-bunsetu-kanji i)) (if (not overwrite-mode) (undo-boundary)) (setq i (1+ i)) )) (setq egg:*sai-henkan-end* (point)) (wnn7-server-hindo-update) (when egg-predict-status (egg-predict-inc-kakutei-length) (if (not wnn7-rensou-touroku) (egg-predict-toroku))) (setq wnn7-rensou-touroku nil) (egg:quit-egg-mode) (run-hooks 'egg:henkan-end-hook) ) ;; 92.7.10 by K.Handa (defun wnn7-henkan-kakutei-first-char () "$B3NDjJ8;zNs$N:G=i$N0lJ8;z$@$1A^F~$9$k!#(B" (interactive) (egg:bunsetu-face-off) (egg:henkan-face-off) (setq wnn7-henkan-mode-in-use nil) (setq egg:*in-fence-mode* nil) (delete-region (- egg:*region-start* (length egg:*henkan-open*)) egg:*region-start*) (delete-region egg:*region-start* egg:*region-end*) (delete-region egg:*region-end* (+ egg:*region-end* ;; 92.8.5 by Y.Kasai (length egg:*henkan-close*))) (goto-char egg:*region-start*) (resume-undo-list) (insert (wnn7-server-bunsetu-kanji 0)) (if (not overwrite-mode) (undo-boundary)) (goto-char egg:*region-start*) (forward-char 1) (delete-region (point) egg:*region-end*) (wnn7-server-hindo-update) (egg:quit-egg-mode) ) ;; end of patch (defun wnn7-henkan-kakutei-before-point () (interactive) (egg:bunsetu-face-off) (egg:henkan-face-off) (delete-region egg:*region-start* egg:*region-end*) (goto-char egg:*region-start*) (let ((i 0) (max *bunsetu-number*)) (while (< i max) (insert (wnn7-server-bunsetu-kanji i )) (if (not overwrite-mode) (undo-boundary)) (setq i (1+ i)) )) (wnn7-server-hindo-update) (delete-region (- egg:*region-start* (length egg:*henkan-open*)) egg:*region-start*) (insert egg:*fence-open*) (set-marker egg:*region-start* (point)) (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*henkan-close*))) (goto-char egg:*region-end*) (let ((point (point))) (insert egg:*fence-close*) (set-marker egg:*region-end* point)) (goto-char egg:*region-start*) (egg:fence-face-on) (let ((point (point)) (i *bunsetu-number*) (max (wnn7-server-bunsetu-suu))) (while (< i max) (insert (wnn7-server-bunsetu-yomi i)) (setq i (1+ i))) ;;;(insert "|") ;;;(insert egg:*fence-close*) ;;;(set-marker egg:*region-end* (point)) (goto-char point)) (setq egg:*mode-on* t) (setq wnn7-henkan-mode-in-use nil) (egg:mode-line-display)) (defun wnn7-sai-henkan () (interactive) (if wnn7-henkan-mode-in-use nil (let ((finished nil)) (unwind-protect (progn (setq wnn7-henkan-mode-in-use t) (mode-line-egg-mode-update (wnn7-msg-get 'henkan-mode-indicator)) (goto-char egg:*sai-henkan-start*) (delete-region egg:*sai-henkan-start* egg:*sai-henkan-end*) (suspend-undo) (goto-char egg:*sai-henkan-start*) (insert egg:*henkan-open*) (set-marker egg:*region-start* (point)) (insert egg:*henkan-close*) (set-marker egg:*region-end* egg:*region-start*) (goto-char egg:*region-start*) (wnn7-henkan-insert-kouho 0 egg:*old-bunsetu-suu*) (egg:henkan-face-on) (wnn7-bunsetu-face-on) (wnn7-henkan-goto-bunsetu 0) (setq finished t)) (or finished (setq wnn7-henkan-mode-in-use nil) (resume-undo-list))))) ) (defun wnn7-bunsetu-face-on () ;; make dai-bunsetu overlay and sho-bunsetu overlay if they do not exist. ;; put thier faces to overlays and move them to each bunsetu. (let* ((bunsetu-begin *bunsetu-number*) (bunsetu-end)) ; (bunsetu-suu (wnn7-server-bunsetu-suu))) ; dai bunsetu (if egg:*dai-bunsetu-face* (if (featurep 'xemacs) (progn (if (extentp egg:*dai-bunsetu-extent*) nil (setq egg:*dai-bunsetu-extent* (make-extent 1 1)) (set-extent-property egg:*dai-bunsetu-extent* 'face egg:*dai-bunsetu-face*)) (setq bunsetu-end (wnn7-server-dai-end *bunsetu-number*)) (while (not (wnn7-server-dai-top bunsetu-begin)) (setq bunsetu-begin (1- bunsetu-begin))) (set-extent-endpoints egg:*dai-bunsetu-extent* (wnn7-bunsetu-position bunsetu-begin) (+ (wnn7-bunsetu-position (1- bunsetu-end)) (length (wnn7-server-bunsetu-kanji (if (>= 0 bunsetu-end) 0 (1- bunsetu-end))))))) (progn (if (overlayp egg:*dai-bunsetu-overlay*) nil (setq egg:*dai-bunsetu-overlay* (make-overlay 1 1)) (overlay-put egg:*dai-bunsetu-overlay* 'face egg:*dai-bunsetu-face*)) (setq bunsetu-end (wnn7-server-dai-end *bunsetu-number*)) (while (not (wnn7-server-dai-top bunsetu-begin)) (setq bunsetu-begin (1- bunsetu-begin))) (move-overlay egg:*dai-bunsetu-overlay* (wnn7-bunsetu-position bunsetu-begin) (+ (wnn7-bunsetu-position (1- bunsetu-end)) (length (wnn7-server-bunsetu-kanji (if (>= 0 bunsetu-end) 0 (1- bunsetu-end))))))))) ; sho bunsetu (if egg:*sho-bunsetu-face* (if (featurep 'xemacs) (progn (if (extentp egg:*sho-bunsetu-extent*) nil (setq egg:*sho-bunsetu-extent* (make-extent 1 1)) (set-extent-property egg:*sho-bunsetu-extent* 'face egg:*sho-bunsetu-face*)) (setq bunsetu-end (1+ *bunsetu-number*)) (set-extent-endpoints egg:*sho-bunsetu-extent* (let ((point (wnn7-bunsetu-position *bunsetu-number*))) (if (eq egg:*sho-bunsetu-face* 'modeline) (+ point 1) point)) (+ (wnn7-bunsetu-position (1- bunsetu-end)) (length (wnn7-server-bunsetu-kanji (1- bunsetu-end)))))) (progn (if (overlayp egg:*sho-bunsetu-overlay*) nil (setq egg:*sho-bunsetu-overlay* (make-overlay 1 1)) (overlay-put egg:*sho-bunsetu-overlay* 'face egg:*sho-bunsetu-face*)) (setq bunsetu-end (1+ *bunsetu-number*)) (move-overlay egg:*sho-bunsetu-overlay* (let ((point (wnn7-bunsetu-position *bunsetu-number*))) (if (eq egg:*sho-bunsetu-face* 'modeline) (1+ point) point)) (+ (wnn7-bunsetu-position (1- bunsetu-end)) (length (wnn7-server-bunsetu-kanji (1- bunsetu-end)))))))))) (defun egg:bunsetu-face-off () (if (featurep 'xemacs) (progn (and egg:*dai-bunsetu-face* (extentp egg:*dai-bunsetu-extent*) (detach-extent egg:*dai-bunsetu-extent*)) (and egg:*sho-bunsetu-face* (extentp egg:*sho-bunsetu-extent*) (detach-extent egg:*sho-bunsetu-extent*))) (and egg:*dai-bunsetu-face* (overlayp egg:*dai-bunsetu-overlay*) (delete-overlay egg:*dai-bunsetu-overlay*)) (and egg:*sho-bunsetu-face* (overlayp egg:*sho-bunsetu-overlay*) (delete-overlay egg:*sho-bunsetu-overlay*)))) (defun wnn7-henkan-goto-bunsetu (number) (setq *bunsetu-number* (check-number-range number 0 (1- (wnn7-server-bunsetu-suu)))) (goto-char (wnn7-bunsetu-position *bunsetu-number*)) ; (egg:move-bunsetu-overlay) (wnn7-bunsetu-face-on)) (defun wnn7-henkan-forward-bunsetu () (interactive) (wnn7-henkan-goto-bunsetu (1+ *bunsetu-number*))) (defun wnn7-henkan-backward-bunsetu () (interactive) (wnn7-henkan-goto-bunsetu (1- *bunsetu-number*))) (defun wnn7-henkan-first-bunsetu () (interactive) (wnn7-henkan-goto-bunsetu 0)) (defun wnn7-henkan-last-bunsetu () (interactive) (wnn7-henkan-goto-bunsetu (1- (wnn7-server-bunsetu-suu)))) (defun check-number-range (i min max) (cond((< i min) max) ((< max i) min) (t i))) (defun wnn7-henkan-hiragana () (interactive) (if (= 2 (wnn7-bunsetu-kouho-suu *bunsetu-number* nil)) (wnn7-henkan-goto-kouho (- (wnn7-bunsetu-kouho-suu *bunsetu-number* nil) 2)) (wnn7-henkan-goto-kouho (- (wnn7-bunsetu-kouho-suu *bunsetu-number* nil) 1)))) (defun wnn7-henkan-katakana () (interactive) (if (= 2 (wnn7-bunsetu-kouho-suu *bunsetu-number* nil)) (wnn7-henkan-goto-kouho (- (wnn7-bunsetu-kouho-suu *bunsetu-number* nil) 1)) (wnn7-henkan-goto-kouho (- (wnn7-bunsetu-kouho-suu *bunsetu-number* nil) 2)))) (defun wnn7-henkan-next-kouho () (interactive) (wnn7-henkan-goto-kouho (1+ (wnn7-bunsetu-kouho-number *bunsetu-number* nil)))) (defun wnn7-henkan-next-kouho-dai () (interactive) (let ((init (not egg:*dai*))) (setq egg:*dai* t) (wnn7-henkan-goto-kouho (1+ (wnn7-bunsetu-kouho-number *bunsetu-number* init))))) (defun wnn7-henkan-next-kouho-sho () (interactive) (let ((init egg:*dai*)) (setq egg:*dai* nil) (wnn7-henkan-goto-kouho (1+ (wnn7-bunsetu-kouho-number *bunsetu-number* init))))) (defun wnn7-henkan-previous-kouho () (interactive) (wnn7-henkan-goto-kouho (1- (wnn7-bunsetu-kouho-number *bunsetu-number* nil)))) (defun wnn7-henkan-previous-kouho-dai () (interactive) (let ((init (not egg:*dai*))) (setq egg:*dai* t) (wnn7-henkan-goto-kouho (1- (wnn7-bunsetu-kouho-number *bunsetu-number* init))))) (defun wnn7-henkan-previous-kouho-sho () (interactive) (let ((init (setq egg:*dai* nil))) ;;(setq egg:*dai* nil) (wnn7-henkan-goto-kouho (1- (wnn7-bunsetu-kouho-number *bunsetu-number* init))))) (defun wnn7-henkan-goto-kouho (kouho-number) ; (egg:bunsetu-face-off) (let ((point (point)) ; (yomi (wnn7-server-bunsetu-yomi *bunsetu-number*)) (max) (min)) (setq kouho-number (check-number-range kouho-number 0 (1- (length (wnn7-bunsetu-kouho-list *bunsetu-number* nil))))) (setq *zenkouho-offset* kouho-number) ;; (wnn-server-henkan-kakutei kouho-number egg:*dai*) (if egg:*dai* (wnn7-server-henkan-kakutei *bunsetu-number* kouho-number) (wnn7-server-henkan-kakutei-sho *bunsetu-number* kouho-number)) (setq max (wnn7-server-bunsetu-suu)) (setq min (max 0 (1- *bunsetu-number*))) (delete-region (wnn7-bunsetu-position min) egg:*region-end*) (goto-char (wnn7-bunsetu-position min)) (wnn7-henkan-insert-kouho min max) (goto-char point)) ; (egg:move-bunsetu-overlay) (wnn7-bunsetu-face-on) (egg:henkan-face-on) ) (defun wnn7-henkan-bunsetu-chijime-dai () (interactive) (setq egg:*dai* t) (or (= (wnn7-bunsetu-length *bunsetu-number*) 1) (wnn7-bunsetu-length-henko (1- (wnn7-bunsetu-length *bunsetu-number*))))) (defun wnn7-henkan-bunsetu-chijime-sho () (interactive) (setq egg:*dai* nil) (or (= (wnn7-bunsetu-length-sho *bunsetu-number*) 1) (wnn7-bunsetu-length-henko (1- (wnn7-bunsetu-length-sho *bunsetu-number*))))) (defun wnn7-henkan-bunsetu-nobasi-dai () (interactive) (setq egg:*dai* t) (let ((i *bunsetu-number*) (max (wnn7-server-bunsetu-suu)) (len (wnn7-bunsetu-length *bunsetu-number*)) (maxlen 0)) (while (< i max) (setq maxlen (+ maxlen (length (wnn7-server-bunsetu-yomi i)))) (setq i (1+ i))) (if (not (= len maxlen)) (wnn7-bunsetu-length-henko (1+ len))))) (defun wnn7-henkan-bunsetu-nobasi-sho () (interactive) (setq egg:*dai* nil) (let ((i *bunsetu-number*) (max (wnn7-server-bunsetu-suu)) (len (wnn7-bunsetu-length-sho *bunsetu-number*)) (maxlen 0)) (while (< i max) (setq maxlen (+ maxlen (length (wnn7-server-bunsetu-yomi i)))) (setq i (1+ i))) (if (not (= len maxlen)) (wnn7-bunsetu-length-henko (1+ len))))) (defun wnn7-henkan-saishou-bunsetu () (interactive) (wnn7-bunsetu-length-henko 1)) (defun henkan-saichou-bunsetu () (interactive) (let ((max (wnn7-server-bunsetu-suu)) (i *bunsetu-number*) (l 0)) (while (< i max) (setq l (+ l (wnn7-bunsetu-length-sho i))) (setq i (1+ i))) (wnn7-bunsetu-length-henko l))) (defun wnn7-bunsetu-length-henko (length) (let (r (start (max 0 (1- *bunsetu-number*)))) (setq r (wnn7-server-bunsetu-henkou *bunsetu-number* length egg:*dai*)) (cond((> (car r) 0) (setq wnn7-bun-list (cdr r)) ; (egg:henkan-face-off) ; (egg:bunsetu-face-off) (delete-region (wnn7-bunsetu-position start) egg:*region-end*) (goto-char (wnn7-bunsetu-position start)) (wnn7-henkan-insert-kouho start (car r)) (wnn7-henkan-goto-bunsetu *bunsetu-number*))))) (defun wnn7-henkan-quit () (interactive) (egg:bunsetu-face-off) (egg:henkan-face-off) (delete-region (- egg:*region-start* (length egg:*henkan-open*)) egg:*region-start*) (delete-region egg:*region-start* egg:*region-end*) (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*henkan-close*))) (goto-char egg:*region-start*) (insert egg:*fence-open*) (set-marker egg:*region-start* (point)) (insert egg:*kanji-kanabuff*) (let ((point (point))) (insert egg:*fence-close*) (set-marker egg:*region-end* point)) (goto-char egg:*region-end*) (egg:fence-face-on) (setq egg:*mode-on* t) (setq wnn7-henkan-mode-in-use nil) (setq egg:*in-fence-mode* t) (egg:mode-line-display)) (defun wnn7-henkan-select-kouho (init) (if (not (eq (selected-window) (minibuffer-window))) (let ((kouho-list (wnn7-bunsetu-kouho-list *bunsetu-number* init)) menu) (setq menu (list 'menu (wnn7-msg-get 'jikouho) (let ((l kouho-list) (r nil) (i 0)) (while l (setq r (cons (cons (car l) i) r)) (setq i (1+ i)) (setq l (cdr l))) (reverse r)))) (wnn7-henkan-goto-kouho (menu:select-from-menu menu (wnn7-bunsetu-kouho-number *bunsetu-number* nil)))) (beep))) (defun wnn7-henkan-select-kouho-dai () (interactive) (let ((init (not egg:*dai*))) (setq egg:*dai* t) (wnn7-henkan-select-kouho init))) (defun wnn7-henkan-select-kouho-sho () (interactive) (let ((init egg:*dai*)) (setq egg:*dai* nil) (wnn7-henkan-select-kouho init))) ;; $BJ]N1(B ;;(defun henkan-word-off () ;; (interactive) ;; (let ((info (wnn7-server-inspect *bunsetu-number*))) ;; (if (null info) ;; (notify (wnn-server-get-msg)) ;; (progn ;; (let* ((kanji (nth 0 info)) ;; (yomi (nth 1 info)) ;; (serial (nth 3 info)) ;; (jisho-no (nth 2 info)) ;; (jisho-name (nth 10 info))) ;; (if (wnn-server-word-use jisho-no serial) ;; (notify (wnn7-msg-get 'off-msg) ;; kanji yomi jisho-name serial) ;; (egg:error (wnn-server-get-msg))))))))))) (defun wnn7-henkan-kakutei-and-self-insert () (interactive) (setq unread-command-events (list last-command-event)) (wnn7-henkan-kakutei)) (if (featurep 'xemacs) (progn (defvar wnn7-henkan-mode-map (make-sparse-keymap)) (set-keymap-default-binding wnn7-henkan-mode-map 'undefined)) (defvar wnn7-henkan-mode-map (append '(keymap (t . undefined) (?\C-x keymap (t . undefined))) function-key-map)) (define-prefix-command 'wnn7-henkan-mode-esc-map) (define-key wnn7-henkan-mode-map "\e" wnn7-henkan-mode-esc-map) (define-key wnn7-henkan-mode-map [escape] wnn7-henkan-mode-esc-map) (define-key wnn7-henkan-mode-esc-map [t] 'undefined)) (substitute-key-definition 'egg-self-insert-command 'wnn7-henkan-kakutei-and-self-insert wnn7-henkan-mode-map global-map) (define-key wnn7-henkan-mode-map "\ei" 'wnn7-henkan-bunsetu-chijime-sho) (define-key wnn7-henkan-mode-map "\eo" 'wnn7-henkan-bunsetu-nobasi-sho) (define-key wnn7-henkan-mode-map "\es" 'wnn7-henkan-select-kouho-dai) (define-key wnn7-henkan-mode-map "\eh" 'wnn7-henkan-hiragana) (define-key wnn7-henkan-mode-map "\ek" 'wnn7-henkan-katakana) (define-key wnn7-henkan-mode-map "\er" 'wnn7-henkan-synonym) (define-key wnn7-henkan-mode-map "\ez" 'wnn7-henkan-select-kouho-sho) (define-key wnn7-henkan-mode-map "\e<" 'wnn7-henkan-saishou-bunsetu) (define-key wnn7-henkan-mode-map "\e>" 'wnn7-henkan-saichou-bunsetu) (define-key wnn7-henkan-mode-map " " 'wnn7-henkan-next-kouho) ; 92.7.10 by K.Handa (define-key wnn7-henkan-mode-map "\C-@" 'wnn7-henkan-kakutei-first-char) (define-key wnn7-henkan-mode-map [?\C-\ ] 'wnn7-henkan-kakutei-first-char) (define-key wnn7-henkan-mode-map "\C-a" 'wnn7-henkan-first-bunsetu) (define-key wnn7-henkan-mode-map "\C-b" 'wnn7-henkan-backward-bunsetu) (define-key wnn7-henkan-mode-map "\C-c" 'wnn7-henkan-quit) (define-key wnn7-henkan-mode-map "\C-e" 'wnn7-henkan-last-bunsetu) (define-key wnn7-henkan-mode-map "\C-f" 'wnn7-henkan-forward-bunsetu) (define-key wnn7-henkan-mode-map "\C-g" 'wnn7-henkan-quit) (define-key wnn7-henkan-mode-map "\C-h" 'wnn7-henkan-help-command) (define-key wnn7-henkan-mode-map "\C-i" 'wnn7-henkan-bunsetu-chijime-dai) (define-key wnn7-henkan-mode-map "\C-k" 'wnn7-henkan-kakutei-before-point) (define-key wnn7-henkan-mode-map "\C-l" 'wnn7-henkan-kakutei) (define-key wnn7-henkan-mode-map "\C-m" 'wnn7-henkan-kakutei) (define-key wnn7-henkan-mode-map "\C-n" 'wnn7-henkan-next-kouho) (define-key wnn7-henkan-mode-map "\C-o" 'wnn7-henkan-bunsetu-nobasi-dai) (define-key wnn7-henkan-mode-map "\C-p" 'wnn7-henkan-previous-kouho) (define-key wnn7-henkan-mode-map "\C-t" 'wnn7-toroku-henkan-mode) (define-key wnn7-henkan-mode-map "\C-v" 'wnn7-henkan-inspect-bunsetu) (define-key wnn7-henkan-mode-map "\C-w" 'wnn7-henkan-next-kouho-dai) (define-key wnn7-henkan-mode-map "\C-z" 'wnn7-henkan-next-kouho-sho) (define-key wnn7-henkan-mode-map "\177" 'wnn7-henkan-quit) (define-key wnn7-henkan-mode-map [backspace] 'wnn7-henkan-quit) (define-key wnn7-henkan-mode-map [clear] 'wnn7-henkan-quit) (define-key wnn7-henkan-mode-map [delete] 'wnn7-henkan-quit) (define-key wnn7-henkan-mode-map [down] 'wnn7-henkan-next-kouho) (define-key wnn7-henkan-mode-map [help] 'wnn7-henkan-help-command) (define-key wnn7-henkan-mode-map [kp-enter] 'wnn7-henkan-kakutei) (define-key wnn7-henkan-mode-map [kp-down] 'wnn7-henkan-next-kouho) (define-key wnn7-henkan-mode-map [kp-left] 'wnn7-henkan-backward-bunsetu) (define-key wnn7-henkan-mode-map [kp-right] 'wnn7-henkan-forward-bunsetu) (define-key wnn7-henkan-mode-map [kp-up] 'wnn7-henkan-previous-kouho) (define-key wnn7-henkan-mode-map [left] 'wnn7-henkan-backward-bunsetu) (define-key wnn7-henkan-mode-map [next] 'wnn7-henkan-next-kouho) (define-key wnn7-henkan-mode-map [prior] 'wnn7-henkan-previous-kouho) (define-key wnn7-henkan-mode-map [return] 'wnn7-henkan-kakutei) (define-key wnn7-henkan-mode-map [right] 'wnn7-henkan-forward-bunsetu) (define-key wnn7-henkan-mode-map [up] 'wnn7-henkan-previous-kouho) (unless (assq 'wnn7-henkan-mode-in-use minor-mode-map-alist) (setq minor-mode-map-alist (cons (cons 'wnn7-henkan-mode-in-use wnn7-henkan-mode-map) minor-mode-map-alist))) (defun wnn7-henkan-help-command () "Display documentation for henkan-mode." (interactive) (let ((buf "*Help*")) (if (eq (get-buffer buf) (current-buffer)) (wnn7-henkan-quit) (with-output-to-temp-buffer buf ;;(princ (substitute-command-keys henkan-mode-document-string)) (princ (substitute-command-keys (wnn7-msg-get 'henkan-help))) (print-help-return-message))))) ;;;---------------------------------------------------------------------- ;;; ;;; Dictionary management Facility ;;; ;;;---------------------------------------------------------------------- ;;; ;;; $B<-=qEPO?(B ;;; ;;;; ;;;; User entry: toroku-region ;;;; (defun remove-regexp-in-string (regexp string) (cond((not(string-match regexp string)) string) (t(let ((str nil) (ostart 0) (oend (match-beginning 0)) (nstart (match-end 0))) (setq str (concat str (substring string ostart oend))) (while (string-match regexp string nstart) (setq ostart nstart) (setq oend (match-beginning 0)) (setq nstart (match-end 0)) (setq str (concat str (substring string ostart oend)))) (concat str (substring string nstart)))))) (defun wnn-hinshi-select (env dic-id) (menu:select-from-menu (wnn-make-hinshi-menu env dic-id "/" (wnn7-msg-get 'hinsimei)))) (defun wnn-make-hinshi-menu (env dic-id hinshi prompt) (let ((hinshi-list (wnn7rpc-get-hinshi-list env dic-id hinshi))) (if (numberp hinshi-list) (egg:error "%s" (wnn7rpc-get-error-message (- hinshi-list))) (list 'menu (format (if (equal hinshi "/") "%s:" "%s[%s]:") prompt (substring hinshi 0 (1- (length hinshi)))) (mapcar (lambda (h) (if (= (aref h (1- (length h))) ?/) (cons h (wnn-make-hinshi-menu env dic-id h prompt)) h)) hinshi-list))))) (defun wnn-find-dictionary-by-id (id dic-list) (catch 'return (while dic-list (let ((dic (car dic-list))) (if (= (wnndic-get-id dic) id) (throw 'return dic) (setq dic-list (cdr dic-list))))))) (defun wnn-dict-name (dic-info) (let ((comment (wnndic-get-comment dic-info)) (name (wnndic-get-dictname dic-info))) (cond ((null (string= comment "")) comment) ((wnn7-client-file-p name) name) (t (file-name-nondirectory name))))) (defun wnn-list-writable-dictionaries-byname (env) (let ((dic-list (wnn7-get-dictionary-list-with-environment env)) (w-id-list (wnn7rpc-get-writable-dictionary-id-list env))) (cond ((numberp w-id-list) (egg:error "%s" (wnn7rpc-get-error-message (- w-id-list)))) ((null w-id-list) (egg:error 'wnn-no-writable-d)) (t (delq nil (mapcar (lambda (id) (let ((dic (wnn-find-dictionary-by-id id dic-list))) (and dic (cons (wnn-dict-name dic) dic)))) w-id-list)))))) (defun wnn-dictionary-select (env) (menu:select-from-menu (list 'menu (wnn7-msg-get 'touroku-jishomei) (wnn-list-writable-dictionaries-byname env)))) (defun wnn7-toroku-word (yomi kanji interactive) (let* ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (dic (wnn-dictionary-select env)) (dic-id (wnndic-get-id dic)) (hinshi (wnn-hinshi-select env dic-id)) (result (wnn7rpc-hinshi-number (wnn7env-get-proc env) hinshi))) (if (or (not interactive) (notify-yes-or-no-p (wnn7-msg-get 'register-notify) kanji yomi hinshi (wnn-dict-name dic))) (progn (or (< result 0) (setq result (wnn7rpc-add-word env dic-id yomi kanji "" result 0))) (if (>= result 0) (notify (wnn7-msg-get 'registerd) kanji yomi hinshi (wnn-dict-name dic)) ;;; (list hinshi (wnn-dict-name dic)) (egg:error (wnn7rpc-get-error-message (- result)))))))) (defun wnn7-toroku-region (start end) (interactive "r") (if (null (wnn7-server-isconnect)) (open-wnn7)) (wnn7-server-set-rev nil) (let*((kanji (remove-regexp-in-string "[\0-\37]" (buffer-substring start end))) (yomi (read-current-its-string (format (wnn7-msg-get 'jishotouroku-yomi) kanji)))) (wnn7-toroku-word yomi kanji nil))) (defun delete-space (string) (let ((len (length string))) (if (eq len 0) "" (if (or (char-equal (aref string 0) ? ) (char-equal (aref string 0) ?-)) (delete-space (substring string 1)) (concat (substring string 0 1) (delete-space (substring string 1))))))) (defun wnn7-toroku-henkan-mode () (interactive) (let*((kanji (read-current-its-string (wnn7-msg-get 'kanji) (delete-space (buffer-substring (point) egg:*region-end* )))) (yomi (read-current-its-string (format (wnn7-msg-get 'jishotouroku-yomi) kanji) (let ((str "") (i *bunsetu-number*) (max (wnn7-server-bunsetu-suu))) (while (< i max) (setq str (concat str (wnn7-server-bunsetu-yomi i))) (setq i (1+ i))) str)))) (wnn7-toroku-word yomi kanji nil))) ;;; ;;; $B<-=qJT=87O(B DicEd ;;; ;;; Sorry, not ported yet. Please, use wnndictutil. ;;; ;;; Pure inspect facility ;;; (defun wnn7-henkan-inspect-bunsetu () (interactive) (notify (wnn7-server-inspect *bunsetu-number*))) ;;; ;;; ;;; input predict command ;;; ;;; (defvar yosoku-select nil "$B8uJdA*Br$5$l$F$$$k$+(B") (defvar through-yosoku nil "$B8uJd$r0l;~A*Br$7$?$+(B") (defvar yosoku-input 0 "$BF~NOM=B,%-!(B") (defconst egg-yosoku-window-size 5 "$BM=B,8uJdI=<(%&%#%s%I%&$NBg$-$5(B") (defvar egg-win-previous-config nil "$BM=B,8uJdI=<($N(B window configuration") (defvar egg-win-previous-point nil "$BM=B,8uJdI=<($N(B current buffer point") ;; for inline-predict (defvar egg-predict-original-position nil "$B%U%'%s%9Fb$N$NLa$j0LCV(B") (defvar egg-predict-start-position nil "$B8uJdI=<(3+;O$N%^!<%+!<(B") (defvar egg-predict-end-position nil "$B8uJdI=<(=*N;$N%^!<%+!<(B") (defvar egg-predict-inline-pos 0 "$B%$%s%i%$%sI=<(8uJdA*Br0LCV(B") (defun egg-predict-realtime-p () (and (wnn7-server-isconnect) egg-predict-realtime egg-yosoku-mode)) (defun egg-predict-inline-p () (string= egg-predict-mode 'inline)) (defun egg-use-input-predict () (interactive) (if (not (wnn7-p)) (error (wnn7-msg-get 'no-wnn7egg)) (setq egg-yosoku-mode t) (if (null (wnn7-server-isconnect)) (open-wnn7)) (when (wnn7-server-isconnect) (wnn7-server-set-rev nil) (wnn7-server-predict-init) (egg:mode-line-display) (if (not (egg-predict-inline-p)) (egg-predict-open-window))))) (defun egg-unuse-input-predict () (interactive) (if (not (wnn7-p)) (error (wnn7-msg-get 'no-wnn7egg)) (setq egg-yosoku-mode nil) (egg:mode-line-display) (if (not (egg-predict-inline-p)) (egg-predict-close-window)) (when egg-predict-status (wnn7-server-predict-save-data) (wnn7-server-predict-free)))) (defun egg-predict-toggle-realtime-mode () (interactive) (if egg-predict-realtime (setq egg-predict-realtime nil) (setq egg-predict-realtime t)) (eval egg-predict-realtime)) (defun egg-predict-toggle-candidate-mode () (interactive) (if (string= egg-predict-mode 'inline) (setq egg-predict-mode 'window) (setq egg-predict-mode 'inline)) (if (egg-predict-inline-p) (egg-predict-close-window))) (defun egg-predict-start-realtime () (interactive) (when (and egg-yosoku-mode (wnn7-server-isconnect) (not (window-minibuffer-p (selected-window)))) (if (string= egg-predict-mode 'inline) (egg-predict-start-internal-inline egg:*region-start* egg:*region-end*) (setq egg-win-previous-point (point)) (egg-predict-open-window) (egg-predict-start-internal-window egg:*region-start* egg:*region-end*)))) (defun egg-predict-start-parttime () (interactive) (when (and (wnn7-p) egg-yosoku-mode (wnn7-server-isconnect) (not (window-minibuffer-p (selected-window)))) (if (string= egg-predict-mode 'inline) (progn (if (egg-predict-start-internal-inline egg:*region-start* egg:*region-end*) (egg-predict-mode-in-inline))) (setq egg-win-previous-point (point)) (egg-predict-open-window) (if (egg-predict-start-internal-window egg:*region-start* egg:*region-end*) (egg-predict-mode-in-window))))) (defun egg-predict-check-reset-connective () (when (and egg-yosoku-mode egg-predict-status (wnn7-server-isconnect)) (if (and (not (eq last-command 'fence-exit-mode)) (not (eq last-command 'egg-predict-select)) (not (eq last-command 'wnn7-henkan-kakutei))) (wnn7-server-predict-reset-connective)))) (defun egg-delete-backward-char (arg &optional killp) (interactive "*p\nP") (when (and (wnn7-p) (wnn7-server-isconnect) egg-yosoku-mode egg-predict-status) (if (or (eq last-command 'fence-exit-mode) (eq last-command 'wnn7-henkan-kakutei) (eq last-command 'egg-predict-select)) (wnn7-server-predict-cancel-toroku))) (delete-backward-char arg killp)) (defun egg-predict-toroku (&optional kakutei-str) (when (and (wnn7-server-isconnect) egg-yosoku-mode) (wnn7-server-set-rev nil) (if (null egg-predict-status) (wnn7-server-predict-init)) ;;; (egg-predict-inc-kakutei-length) ;; move to wnn7-henkan-kakutei (wnn7-server-predict-toroku kakutei-str))) (defun egg-backward-delete-char-untabify (arg &optional killp) (interactive "*p\nP") (when (and (wnn7-p) (wnn7-server-isconnect) egg-yosoku-mode egg-predict-status) (if (or (eq last-command 'fence-exit-mode) (eq last-command 'wnn7-henkan-kakutei) (eq last-command 'egg-predict-select)) (wnn7-server-predict-cancel-toroku))) (backward-delete-char-untabify arg killp)) (defun egg-predict-select () (interactive) (if (egg-predict-inline-p) (egg-predict-select-inline) (egg-predict-select-window))) (defun egg-predict-next-candidate () (interactive) (if (egg-predict-inline-p) (egg-predict-next-candidate-inline) (when (equal (buffer-name) egg-yosoku-buffer-name) (egg-predict-inc-input-length) ; key input count (forward-line 1) (beginning-of-line) (if (eobp) (goto-char (point-min)))))) (defun egg-predict-prev-candidate () (interactive) (if (egg-predict-inline-p) (egg-predict-prev-candidate-inline) (when (equal (buffer-name) egg-yosoku-buffer-name) (egg-predict-inc-input-length) ; key input count (forward-line -1) (beginning-of-line)))) (defun egg-predict-delete () (interactive) (if (egg-predict-inline-p) (when (numberp egg-predict-inline-pos) (wnn7-server-predict-delete-cand egg-predict-inline-pos) (egg-predict-cancel) (egg-predict-start-parttime)) (when (equal (buffer-name) egg-yosoku-buffer-name) (let (pos) (save-excursion (setq pos (count-lines 1 (point)))) (wnn7-server-predict-delete-cand pos) (egg-predict-cancel) (egg-predict-start-parttime))))) (defun egg-predict-clear () (if (egg-predict-inline-p) (egg-predict-clear-inline) (when (get-buffer egg-yosoku-buffer-name) (with-current-buffer (get-buffer egg-yosoku-buffer-name) (progn (setq buffer-read-only nil) (erase-buffer) (setq buffer-read-only t)))))) (defun egg-predict-cancel () (interactive) (if (egg-predict-inline-p) (progn (egg-predict-inc-input-length) ; key input count (egg-predict-mode-out-inline) (egg-predict-clear-inline)) (if (equal (buffer-name) egg-yosoku-buffer-name) (progn (egg-predict-inc-input-length) ; key input count (setq buffer-read-only nil) (erase-buffer) (setq buffer-read-only t))) (egg-predict-mode-out-window) (goto-char egg-win-previous-point))) (defun egg-predict-save-data () (interactive) (when egg-predict-status (wnn7-server-predict-save-data))) (if (featurep 'xemacs) (progn (defvar egg-predict-mode-map (make-sparse-keymap)) (set-keymap-default-binding egg-predict-mode-map 'undefined)) (defvar egg-predict-mode-map (append '(keymap (t . undefined) (?\C-x keymap (t . undefined))) function-key-map)) (defvar egg-predict-mode-esc-map nil) (define-prefix-command 'egg-predict-mode-esc-map) (define-key egg-predict-mode-map "\C-x" egg-predict-mode-esc-map) (define-key egg-predict-mode-esc-map [t] 'undefined)) (define-key egg-predict-mode-map " " 'egg-predict-next-candidate) (define-key egg-predict-mode-map [tab] 'egg-predict-next-candidate) (define-key egg-predict-mode-map "\C-i" 'egg-predict-next-candidate) (define-key egg-predict-mode-map "n" 'egg-predict-next-candidate) (define-key egg-predict-mode-map "\C-n" 'egg-predict-next-candidate) (define-key egg-predict-mode-map "f" 'egg-predict-next-candidate) (define-key egg-predict-mode-map "\C-f" 'egg-predict-next-candidate) (define-key egg-predict-mode-map "b" 'egg-predict-prev-candidate) (define-key egg-predict-mode-map "\C-b" 'egg-predict-prev-candidate) (define-key egg-predict-mode-map "p" 'egg-predict-prev-candidate) (define-key egg-predict-mode-map "\C-p" 'egg-predict-prev-candidate) (define-key egg-predict-mode-map [return] 'egg-predict-select) (define-key egg-predict-mode-map "\C-m" 'egg-predict-select) (define-key egg-predict-mode-map "q" 'egg-predict-cancel) (define-key egg-predict-mode-map "\C-g" 'egg-predict-cancel) (define-key egg-predict-mode-map "\C-xo" 'egg-predict-other-window) (define-key egg-predict-mode-map "\C-d" 'egg-predict-delete) (make-variable-buffer-local (defvar egg-predict-candidate-inline nil)) (unless (assq 'egg-predict-candidate-inline minor-mode-map-alist) (setq minor-mode-map-alist (cons (cons 'egg-predict-candidate-inline egg-predict-mode-map) minor-mode-map-alist))) (defun egg-predict-other-window () (interactive) (if (equal (buffer-size) 0) (other-window 1) (beep))) (defun egg-predict-candidate-mode () (use-local-map egg-predict-mode-map) (setq mode-name "egg-predict") (setq major-mode 'egg-predict-candidate-mode) (buffer-disable-undo egg-yosoku-buffer-name)) ;;; window mode (defun egg-predict-open-window () (get-buffer-create egg-yosoku-buffer-name) (if (get-buffer-window egg-yosoku-buffer-name) (display-buffer egg-yosoku-buffer-name) (let ((parent-win (selected-window))) (split-window-vertically (- egg-yosoku-window-size)) (set-window-buffer (other-window 1) egg-yosoku-buffer-name) (select-window parent-win)))) (defun egg-predict-close-window () (delete-windows-on egg-yosoku-buffer-name)) (defun egg-predict-mode-in-window () (interactive) (egg-predict-open-window) (if (not egg-win-previous-config) (setq egg-win-previous-config (current-window-configuration))) (select-window (get-buffer-window egg-yosoku-buffer-name)) (setq through-yosoku t) (or (eq major-mode 'egg-predict-candidate-mode) (egg-predict-candidate-mode))) (defun egg-predict-mode-out-window () (interactive) (when (window-configuration-p egg-win-previous-config) (set-window-configuration egg-win-previous-config) (setq egg-win-previous-config nil))) (defun egg-predict-start-internal-window (start end) (let (predict-string result) (wnn7-server-set-rev nil) (if (null egg-predict-status) (wnn7-server-predict-init)) (setq predict-string (buffer-substring start end)) (setq result (wnn7-server-predict-start predict-string)) (cond ((null result) (let ((cur-buf (current-buffer))) (set-buffer egg-yosoku-buffer-name) (setq buffer-read-only nil) (erase-buffer) (setq buffer-read-only t) (set-buffer cur-buf) nil)) ((eq result -3011) (if (not egg-predict-realtime) (egg:error "%s" (wnn7rpc-get-error-message (- result))))) (t (let ((cur-buf (current-buffer)) (count 0)) (set-buffer egg-yosoku-buffer-name) (setq buffer-read-only nil) (erase-buffer) (while result (insert (format "%d: %s\n" count (car result))) (setq count (1+ count) result (cdr result))) (setq buffer-read-only t) (goto-char (point-min)) (set-buffer cur-buf) t))))) (defun egg-predict-select-window () (when (equal (buffer-name) egg-yosoku-buffer-name) (let ((cur-point (point)) start end kakutei-string pos result) (save-excursion (goto-char (point-min)) (beginning-of-line) (setq start (point)) (goto-char cur-point) (beginning-of-line) (setq pos (count-lines 1 (point))) (setq start (point)) (end-of-line) (setq end (point)) (setq kakutei-string (buffer-substring (+ start 3) end))) (setq result (wnn7-server-predict-selected-cand pos)) (when result (setq yosoku-kouho-len (+ yosoku-kouho-len result)) (setq yosoku-select t) (egg-predict-inc-kakutei-length) ;;; (egg-predict-cancel) (egg:fence-face-off) (setq egg:*in-fence-mode* nil) (delete-region (- egg:*region-start* (length egg:*fence-open*)) egg:*region-start*) (delete-region egg:*region-start* egg:*region-end*) (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*fence-close*))) (goto-char egg:*region-start*) (resume-undo-list) (insert kakutei-string))) (if its:*previous-map* (setq its:*current-map* its:*previous-map* its:*previous-map* nil)) (egg:quit-egg-mode))) ;;; inline version (defvar egg-ud-face nil "underline face") (if (not egg-ud-face) (progn (setq egg-ud-face (make-face 'egg-ud-face)) (set-face-underline-p egg-ud-face t))) (defun egg-predict-mode-in-inline () (interactive) (setq through-yosoku t) (setq egg-predict-inline-pos 0) (setq egg-predict-original-position (point)) (goto-char (next-overlay-change (marker-position egg-predict-start-position))) (setq egg-predict-candidate-inline t)) (defun egg-predict-mode-out-inline () (interactive) (setq egg-predict-candidate-inline nil) (goto-char egg-predict-original-position)) (defun egg-predict-next-candidate-inline () (interactive) (let (pos overlay-list) (setq pos (next-overlay-change (point))) (setq overlay-list (overlays-at (point))) (egg-predict-inc-input-length) ; key input count (while overlay-list (if (and (string= (overlay-get (car overlay-list) 'face) 'egg-ud-face) (= pos (overlay-end (car overlay-list)))) (setq pos (next-overlay-change pos))) (setq overlay-list (cdr overlay-list))) (if (or (not pos) (not (marker-position egg-predict-end-position)) (<= (marker-position egg-predict-end-position) pos)) ;; goto top (progn (goto-char (next-overlay-change (marker-position egg-predict-start-position))) (setq egg-predict-inline-pos 0)) (goto-char pos) (setq egg-predict-inline-pos (1+ egg-predict-inline-pos))))) (defun egg-predict-prev-candidate-inline () (interactive) (let (pos overlay-list) (setq pos (previous-overlay-change (point))) (setq overlay-list (overlays-at (1- pos))) (egg-predict-inc-input-length) ; key input count (while overlay-list (if (and (string= (overlay-get (car overlay-list) 'face) 'egg-ud-face) (= pos (overlay-end (car overlay-list)))) (setq pos (previous-overlay-change pos))) (setq overlay-list (cdr overlay-list))) (if (and pos (marker-position egg-predict-start-position) (>= (marker-position egg-predict-start-position) pos)) ;; goto top (progn (goto-char (next-overlay-change (marker-position egg-predict-start-position))) (setq egg-predict-inline-pos 0)) (goto-char pos) (setq egg-predict-inline-pos (1- egg-predict-inline-pos))))) (defun egg-predict-select-inline () (interactive) (let (start end kakutei-string result) (save-excursion (setq start (point)) (setq end (next-overlay-change (point))) (setq kakutei-string (buffer-substring start end))) (setq result (wnn7-server-predict-selected-cand egg-predict-inline-pos)) (when result (setq yosoku-kouho-len (+ yosoku-kouho-len result)) (setq yosoku-select t) (egg-predict-inc-kakutei-length) ;;; (egg-predict-clear-inline) (goto-char egg-predict-original-position) (setq egg-predict-candidate-inline nil) (egg:fence-face-off) (setq egg:*in-fence-mode* nil) (delete-region (- egg:*region-start* (length egg:*fence-open*)) egg:*region-start*) (delete-region egg:*region-start* egg:*region-end*) (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*fence-close*))) (goto-char egg:*region-start*) (resume-undo-list) (insert kakutei-string))) (if its:*previous-map* (setq its:*current-map* its:*previous-map* its:*previous-map* nil)) (egg:quit-egg-mode)) (defun egg-predict-start-internal-inline (start end) (let (predict-string result st recenter-pos) (wnn7-server-set-rev nil) (if (null egg-predict-status) (wnn7-server-predict-init)) (setq predict-string (buffer-substring start end)) (setq result (wnn7-server-predict-start predict-string)) (cond ((null result) (egg-predict-clear-inline) nil) ((eq result -3011) (if (not egg-predict-realtime) (egg:error "%s" (wnn7rpc-get-error-message (- result))))) (t (egg-predict-clear-inline) (save-excursion (end-of-line) (setq egg-predict-start-position (point-marker)) (set-marker-insertion-type egg-predict-start-position nil) (insert "\n------------------------------------------------------------\n") (while result (setq st (point)) (insert (format "[%s]" (car result))) (overlay-put (make-overlay (1+ st) (1- (point))) 'face egg-ud-face) (setq result (cdr result))) (insert "\n------------------------------------------------------------\n") (setq recenter-pos (point)) (setq egg-predict-end-position (point-marker))) (if (not (pos-visible-in-window-p recenter-pos)) (recenter)) t)))) (defun egg-predict-clear-inline () (if (or egg-predict-start-position egg-predict-end-position) (let ((pos (marker-position egg-predict-start-position)) overlay-list overlay) (while pos (setq overlay-list (overlays-at pos)) (while overlay-list (setq overlay (overlay-get (car overlay-list) 'face)) (setq pos (overlay-end (car overlay-list))) (if (string= overlay 'egg-ud-face) (delete-overlay (car overlay-list))) (setq overlay-list (cdr overlay-list))) (if (= pos (next-overlay-change pos)) (setq pos nil) (setq pos (next-overlay-change pos))) (if (or (not pos) (not (marker-position egg-predict-end-position)) (<= (marker-position egg-predict-end-position) pos)) (setq pos nil))) (save-excursion (delete-region (marker-position egg-predict-start-position) (marker-position egg-predict-end-position)) (setq egg-predict-start-position nil egg-predict-end-position nil))))) ;;; ;;; input efficiency ;;; ;;; (defun egg-predict-check-end () (when (and egg-yosoku-mode egg-predict-status) (egg-predict-check-end-input) (egg-predict-check-end-time))) (defun egg-predict-check-start-time () (let ((time (decode-time (current-time)))) (setq yosoku-sec-start (+ (nth 0 time) (* 60 (nth 1 time)))) (setq yosoku-select nil through-yosoku nil count-start t))) (defun egg-predict-check-end-time () (let ((time (decode-time (current-time))) endtime timediff) (setq endtime (+ (nth 0 time) (* 60 (nth 1 time)))) (when count-start (if (< endtime yosoku-sec-start) (setq endtime (+ endtime 3600))) (setq timediff (- endtime yosoku-sec-start)) (if (> yosoku-kakutei 0) (wnn7-server-predict-set-timeinfo (if yosoku-select 1 0) (if through-yosoku 1 0) timediff yosoku-kakutei)) (setq count-start nil)))) (defun egg-predict-check-start-input () (setq yosoku-input 0 yosoku-kakutei 0 yosoku-kouho-len 0)) (defun egg-predict-check-end-input () (when count-start (wnn7-server-predict-set-user-inputinfo yosoku-kakutei yosoku-input yosoku-select))) (defun egg-predict-inc-input-length () (setq yosoku-input (1+ yosoku-input))) (defun egg-predict-inc-kakutei-length () (if yosoku-select (setq yosoku-kakutei (+ yosoku-kakutei yosoku-kouho-len)) (setq yosoku-kakutei yosoku-input))) (defvar predict-average-mode-map nil "") (if predict-average-mode-map () (setq predict-average-mode-map (make-keymap)) (suppress-keymap predict-average-mode-map t) (if (featurep 'xemacs) (define-key predict-average-mode-map "q" 'Buffer-menu-quit) (define-key predict-average-mode-map "q" 'quit-window))) (defun predict-average-mode () (kill-all-local-variables) (use-local-map predict-average-mode-map) (setq major-mode 'predict-average-mode) (setq mode-name "Input Efficiency") (setq buffer-read-only t)) (defun egg-show-predict-average () (interactive) (let ((standard-output standard-output) status) (if (or (not (wnn7-p)) (not egg-yosoku-mode)) (error (wnn7-msg-get 'no-predict)) (save-excursion (set-buffer (get-buffer-create "*input efficiency*")) (setq buffer-read-only nil) (erase-buffer) (setq standard-output (current-buffer)) (wnn7-server-set-rev nil) (if (null egg-predict-status) (wnn7-server-predict-init)) (setq status (wnn7-server-predict-status)) (when (vectorp status) (princ (format "$B:o8:$5$l$?F~NO%-!O$N%-!O$N?dDjF~NO;~4V(B %d $BIC!K(B\n" (aref status 4))) (princ (format " $B!J$"$J$?$,F~NO$7$?;~4V(B %d $BIC!K(B\n" (aref status 5))) (princ (format "$BM=B,F~NO$r;H$C$?3d9g(B %d $B!s(B\n" (aref status 12))) (princ (format " $B!JM=B,F~NO$GF~NO$7$?J8$N%-!A0$N3NDj$7$?J8$N%-!>\n" (aref status 20)))) (predict-average-mode) (display-buffer (current-buffer)))))) ;; ;; associate translation ;; (defun wnn7-henkan-synonym () (interactive) (let (kouho-number) (setq wnn7-rensou-touroku t) (setq kouho-number (wnn7-bunsetu-kouho-number *bunsetu-number* nil)) (setq *zenkouho-offset* kouho-number) (if (wnn7-server-synonym *bunsetu-number* kouho-number egg:*dai*) (wnn7-henkan-select-kouho-dai) (notify (wnn7-msg-get 'no-rensou))))) (provide 'wnn7egg-cnv) ;;; wnn7egg-cnv.el ends here wnn7egg-1.02.orig/elisp/emacs20/wnn7egg-com.el0100644000764400003210000003116007474174160021166 0ustar ishikawaishikawa;; Wnn7Egg is Egg modified for Wnn7, and the current maintainer ;; is OMRON SOFTWARE Co., Ltd. ;; ;; This file is part of Wnn7Egg. (base code is egg-com.el (eggV4)) ;; ;;; ------------------------------------------------------------------ ;;; ;;; Wnn7Egg (Wnn "なな"たまご)--- Wnn7 Emacs Client ;;; ;;; Wnn7Egg は、「たまご第3版」v3.09 をベースに 「たまご第4版」の通信、 ;;; ライブラリ部を組み込んだ、Wnn7 の為の専用クライアントです。 ;;; ;;; すべてのソースが Emacs Lisp で記述されているので、Wnn SDK/Library を必要 ;;; とせず、GNU Emacs 及び XEmacs 環境で使用することができます。使用許諾条件 ;;; は GPL です。 ;;; ;;; GNU Emacs 20.3 以降、XEmacs 21.x 以降で動作確認しています。 ;;; ;;; ;;; Wnn7Egg は Wnn7 の機能である楽々入力(入力予測)、連想変換をサポート ;;; しています。 ;;; ;;; 「たまご」と独立/共存できるように、影響する主要な関数/変数名を ;;; "wnn7..." という形に変更しています。 ;;; ;;; ------------------------------------------------------------------ ;;; egg-com.el --- Communication Routines in Egg Input Method Architecture ;; Copyright (C) 1999, 2000 Free Software Foundation, Inc ;; Author: Hisashi Miyashita ;; NIIBE Yutaka ;; KATAYAMA Yoshio ; Korean, Chinese support. ;; Maintainer: TOMURA Satoru ;; Keywords: mule, multilingual, input method ;; This file is part of EGG. ;; EGG is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; EGG is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;;; Code: (require 'wnn7egg-edep) ;;(require 'wnn7egg-cnv) (defvar egg-fixed-euc '(fixed-euc-jp)) (make-variable-buffer-local 'egg-fixed-euc) (put 'egg-fixed-euc 'permanent-local t) (defvar egg-mb-euc 'euc-japan) (make-variable-buffer-local 'egg-mb-euc) (put 'egg-mb-euc 'permanent-local t) ;; Japanese (eval-and-compile (define-ccl-program ccl-decode-fixed-euc-jp `(2 ((r2 = ,(charset-id 'japanese-jisx0208)) (r3 = ,(charset-id 'japanese-jisx0212)) (r4 = ,(charset-id 'katakana-jisx0201)) (read r0) (loop (read r1) (if (r0 < ?\x80) ((r0 = r1) (if (r1 < ?\x80) (write-read-repeat r0)) (write r4) (write-read-repeat r0)) ((if (r1 > ?\x80) ((write r2 r0) (r0 = r1) (write-read-repeat r0)) ((write r3 r0) (r0 = (r1 | ?\x80)) (write-read-repeat r0))))))))) (define-ccl-program ccl-encode-fixed-euc-jp `(2 ((read r0) (loop (if (r0 == ,(charset-id 'latin-jisx0201)) ; Unify ((read r0) (r0 &= ?\x7f))) (if (r0 < ?\x80) ;G0 ((write 0) (write-read-repeat r0))) (r6 = (r0 == ,(charset-id 'japanese-jisx0208))) (r6 |= (r0 == ,(charset-id 'japanese-jisx0208-1978))) (if r6 ;G1 ((read r0) (write r0) (read r0) (write-read-repeat r0))) (if (r0 == ,(charset-id 'katakana-jisx0201)) ;G2 ((read r0) (write 0) (write-read-repeat r0))) (if (r0 == ,(charset-id 'japanese-jisx0212)) ;G3 ((read r0) (write r0) (read r0) (r0 &= ?\x7f) (write-read-repeat r0))) (read r0) (repeat))))) ) (if (not (coding-system-p 'fixed-euc-jp)) (make-coding-system 'fixed-euc-jp 4 ?W "Coding System for fixed EUC Japanese" (cons ccl-decode-fixed-euc-jp ccl-encode-fixed-euc-jp))) ;; Binary data (eval-and-compile (define-ccl-program ccl-decode-egg-binary `(1 ((read r0) (loop (if (r0 == ?\xff) (read r1)) ; toss out (write-read-repeat r0))))) (define-ccl-program ccl-encode-egg-binary `(2 ((read r0) (loop (if (r0 == ?\xff) ((write r0) (r0 = 0))) (write-read-repeat r0)))))) (if (not (coding-system-p 'egg-binary)) (make-coding-system 'egg-binary 4 ?W "Coding System for binary data" (cons ccl-decode-egg-binary ccl-encode-egg-binary))) (defun comm-format-u32c (uint32c) (insert-char (logand (lsh (car uint32c) -8) 255) 1) (insert-char (logand (car uint32c) 255) 1) (insert-char (logand (lsh (nth 1 uint32c) -8) 255) 1) (insert-char (logand (nth 1 uint32c) 255) 1)) (defun comm-format-u32 (uint32) (insert-char (logand (lsh uint32 -24) 255) 1) (insert-char (logand (lsh uint32 -16) 255) 1) (insert-char (logand (lsh uint32 -8) 255) 1) (insert-char (logand uint32 255) 1)) (defun comm-format-i32 (int32) (insert-char (logand (ash int32 -24) 255) 1) (insert-char (logand (ash int32 -16) 255) 1) (insert-char (logand (ash int32 -8) 255) 1) (insert-char (logand int32 255) 1)) (defun comm-format-u16 (uint16) (insert-char (logand (lsh uint16 -8) 255) 1) (insert-char (logand uint16 255) 1)) (defun comm-format-u8 (uint8) (insert-char (logand uint8 255) 1)) (defun comm-format-truncate-after-null (s) (if (string-match "\0" s) (substring s 0 (match-beginning 0)) s)) (defun comm-format-u16-string (s) (insert (encode-coding-string (comm-format-truncate-after-null s) egg-fixed-euc)) (insert-char 0 2)) (defun comm-format-mb-string (s) (insert (encode-coding-string (comm-format-truncate-after-null s) egg-mb-euc)) (insert-char 0 1)) (defun comm-format-u8-string (s) (insert (comm-format-truncate-after-null s)) (insert-char 0 1)) (defun comm-format-binary-data (s) (insert (encode-coding-string s 'egg-binary)) (insert-char ?\377 2)) (defun comm-format-fixlen-string (s len) (setq s (comm-format-truncate-after-null s)) (insert (if (< (length s) len) s (substring s 0 (1- len)))) (insert-char 0 (max (- len (length s)) 1))) (defun comm-format-vector (s len) (setq s (concat s)) (insert (if (<= (length s) len) s (substring s 0 len))) (insert-char 0 (- len (length s)))) (defmacro comm-format (format &rest args) "Format a string out of a control-list and arguments into the buffer. The formated datas are network byte oder (i.e. big endian).. U: 32-bit integer. The argument is 2 element 16-bit unsigned integer list. u: 32-bit integer. The argument is treat as unsigned integer. (Note: Elisp's integer may be less than 32 bits) i: 32-bit integer. w: 16-bit integer. b: 8-bit integer. S: 16-bit wide-character EUC string (0x0000 terminated). E: Multibyte EUC string (0x00 terminated). s: 8-bit string (0x00 terminated). B: Binary data (0xff terminated). v: 8-bit vector (no terminator). This takes 2 args (data length). V: Fixed length string (0x00 terminated). This takes 2 args (data length)." (let ((p args) (form format) (result (list 'progn)) f arg) (while (and form p) (setq f (car form) arg (car p)) (nconc result (list (cond ((eq f 'U) (list 'comm-format-u32c arg)) ((eq f 'u) (list 'comm-format-u32 arg)) ((eq f 'i) (list 'comm-format-i32 arg)) ((eq f 'w) (list 'comm-format-u16 arg)) ((eq f 'b) (list 'comm-format-u8 arg)) ((eq f 'S) (list 'comm-format-u16-string arg)) ((eq f 'E) (list 'comm-format-mb-string arg)) ((eq f 's) (list 'comm-format-u8-string arg)) ((eq f 'B) (list 'comm-format-binary-data arg)) ((eq f 'V) (setq p (cdr p)) (list 'comm-format-fixlen-string arg (car p))) ((eq f 'v) (setq p (cdr p)) (list 'comm-format-vector arg (car p)))))) (setq form (cdr form) p (cdr p))) (if (or form p) (error "comm-format %s: arguments mismatch" format)) result)) (defvar comm-accept-timeout nil) ;; Assume PROC is bound to the process of current buffer ;; Do not move the point, leave it where it was. (defmacro comm-accept-process-output () `(let ((p (point))) (if (null (accept-process-output proc comm-accept-timeout)) (error "backend timeout")) (goto-char p))) (defmacro comm-require-process-output (n) `(if (< (point-max) (+ (point) ,n)) (comm-wait-for-space proc ,n))) (defun comm-wait-for-space (proc n) (let ((p (point)) (r (+ (point) n))) (while (< (point-max) r) (if (null (accept-process-output proc comm-accept-timeout)) (error "backend timeout")) (goto-char p)))) (defmacro comm-following+forward-char () `(prog1 (following-char) (forward-char 1))) (defun comm-unpack-u32c () (progn (comm-require-process-output 4) (list (+ (lsh (comm-following+forward-char) 8) (comm-following+forward-char)) (+ (lsh (comm-following+forward-char) 8) (comm-following+forward-char))))) (defun comm-unpack-u32 () (progn (comm-require-process-output 4) (+ (lsh (comm-following+forward-char) 24) (lsh (comm-following+forward-char) 16) (lsh (comm-following+forward-char) 8) (comm-following+forward-char)))) (defun comm-unpack-u16 () (progn (comm-require-process-output 2) (+ (lsh (comm-following+forward-char) 8) (comm-following+forward-char)))) (defun comm-unpack-u8 () (progn (comm-require-process-output 1) (comm-following+forward-char))) (defun comm-unpack-u16-string () (let ((start (point))) (while (not (search-forward "\0\0" nil t)) (comm-accept-process-output)) (decode-coding-string (buffer-substring start (- (point) 2)) egg-fixed-euc))) (defun comm-unpack-mb-string () (let ((start (point))) (while (not (search-forward "\0" nil t)) (comm-accept-process-output)) (decode-coding-string (buffer-substring start (1- (point))) egg-mb-euc))) (defun comm-unpack-u8-string () (let ((start (point))) (while (not (search-forward "\0" nil 1)) (comm-accept-process-output)) (buffer-substring start (1- (point))))) (defun comm-unpack-binary-data () (let ((start (point))) (while (not (search-forward "\377\377" nil 1)) (comm-accept-process-output)) (string-as-unibyte (decode-coding-string (buffer-substring start (- (point) 2)) 'egg-binary)))) (defun comm-unpack-fixlen-string (len) (let (s) (comm-require-process-output len) (goto-char (+ (point) len)) (setq s (buffer-substring (- (point) len) (point))) (if (string-match "\0" s) (setq s (substring s 0 (match-beginning 0)))) s)) (defun comm-unpack-vector (len) (progn (comm-require-process-output len) (goto-char (+ (point) len)) (buffer-substring (- (point) len) (point)))) (defmacro comm-unpack (format &rest args) "Unpack a string out of a control-string and set arguments. See `comm-format' for FORMAT." (let ((p args) (form format) (result (list 'progn)) arg f) (while (and form p) (setq f (car form) arg (car p)) (nconc result (list (cond ((eq f 'U) `(setq ,arg (comm-unpack-u32c))) ((eq f 'u) `(setq ,arg (comm-unpack-u32))) ((eq f 'i) `(setq ,arg (comm-unpack-u32))) ((eq f 'w) `(setq ,arg (comm-unpack-u16))) ((eq f 'b) `(setq ,arg (comm-unpack-u8))) ((eq f 'S) `(setq ,arg (comm-unpack-u16-string))) ((eq f 'E) `(setq ,arg (comm-unpack-mb-string))) ((eq f 's) `(setq ,arg (comm-unpack-u8-string))) ((eq f 'B) `(setq ,arg (comm-unpack-binary-data))) ((eq f 'V) (setq p (cdr p)) `(setq ,arg (comm-unpack-fixlen-string ,(car p)))) ((eq f 'v) (setq p (cdr p)) `(setq ,arg (comm-unpack-vector ,(car p))))))) (setq form (cdr form) p (cdr p))) (if (or form p) (error "comm-unpack %s: arguments mismatch" format)) result)) (defmacro comm-call-with-proc (proc vlist send-expr &rest receive-exprs) (let ((euc-select (and (eq (car-safe (car vlist)) 'zhuyin) '((egg-fixed-euc (nth (if zhuyin 1 0) egg-fixed-euc)))))) `(let* ((proc ,proc) (buffer (process-buffer proc)) ,@vlist) (if (and (eq (process-status proc) 'open) (buffer-live-p buffer)) (save-excursion (set-buffer buffer) (let ,euc-select (erase-buffer) ,send-expr (goto-char (point-max)) (process-send-region proc (point-min) (point-max)) ,@receive-exprs)) (error "process %s was killed" proc))))) (defmacro comm-call-with-proc-1 (proc vlist send-expr &rest receive-exprs) `(let ,vlist (erase-buffer) ,send-expr (goto-char (point-max)) (process-send-region proc (point-min) (point-max)) ,@receive-exprs)) (provide 'wnn7egg-com) ;;; wnn7egg-com.el ends here. wnn7egg-1.02.orig/elisp/emacs20/wnn7egg-edep.el0100644000764400003210000000554207474174160021332 0ustar ishikawaishikawa;; Wnn7Egg is Egg modified for Wnn7, and the current maintainer ;; is OMRON SOFTWARE Co., Ltd. ;; ;; This file is part of Wnn7Egg. (base code is egg-edep.el (eggV4)) ;; ;;; ------------------------------------------------------------------ ;;; ;;; Wnn7Egg (Wnn "なな"たまご)--- Wnn7 Emacs Client ;;; ;;; Wnn7Egg は、「たまご第3版」v3.09 をベースに 「たまご第4版」の通信、 ;;; ライブラリ部を組み込んだ、Wnn7 の為の専用クライアントです。 ;;; ;;; すべてのソースが Emacs Lisp で記述されているので、Wnn SDK/Library を必要 ;;; とせず、GNU Emacs 及び XEmacs 環境で使用することができます。使用許諾条件 ;;; は GPL です。 ;;; ;;; GNU Emacs 20.3 以降、XEmacs 21.x 以降で動作確認しています。 ;;; ;;; ;;; Wnn7Egg は Wnn7 の機能である楽々入力(入力予測)、連想変換をサポート ;;; しています。 ;;; ;;; 「たまご」と独立/共存できるように、影響する主要な関数/変数名を ;;; "wnn7..." という形に変更しています。 ;;; ;;; ------------------------------------------------------------------ ;; egg-edep.el --- This file serves Emacs version dependent definitions ;; Copyright (C) 1999,2000 PFU LIMITED ;; Author: NIIBE Yutaka ;; KATAYAMA Yoshio ;; Maintainer: TOMURA Satoru ;; Keywords: mule, multilingual, input method ;; This file is part of EGG. ;; EGG is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; EGG is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;;; Code: (if (featurep 'xemacs) (progn (defun set-buffer-multibyte (flag) (setq enable-multibyte-characters flag)) (defun egg-chars-in-period (str pos len) len) (defalias 'string-as-unibyte 'identity) (defalias 'string-as-multibyte 'identity);; (defalias 'coding-system-put 'put));; (if (fboundp 'set-buffer-multibyte) (if (subrp (symbol-function 'set-buffer-multibyte)) ;; Emacs 20.3 (progn (defun egg-chars-in-period (str pos len) len)) ;; Emacs 20.2 (defun set-buffer-multibyte (flag) (setq enable-multibyte-characters flag)) (defalias 'string-as-unibyte 'identity) (defalias 'string-as-multibyte 'identity) (defalias 'coding-system-put 'put) (defun egg-chars-in-period (str pos len) (chars-in-string (substring str pos (+ pos len))))))) (provide 'wnn7egg-edep) ;;; wnn7egg-edep.el ends here wnn7egg-1.02.orig/elisp/emacs20/wnn7egg-jsymbol.el0100644000764400003210000006426007474174160022076 0ustar ishikawaishikawa;; Japanese Character Input Package for Egg ;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) ;; This file is part of Egg on Mule (Multilingal Environment) ;; Egg is distributed in the forms of patches to GNU ;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC ;; LICENSE which is distributed along with GNU Emacs by the ;; Free Software Foundation. ;; Egg is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. See the GNU EMACS GENERAL PUBLIC LICENSE for ;; more details. ;; You should have received a copy of the GNU EMACS GENERAL ;; PUBLIC LICENSE along with Nemacs; see the file COPYING. ;; If not, write to the Free Software Foundation, 675 Mass ;; Ave, Cambridge, MA 02139, USA. ;;; 92.10.18 modified for Mule Ver.0.9.6 by K.Handa ;;; Moved from egg.el ;;; 92.12.26 modified for Mule Ver.0.9.7 by T.Shingu ;;; JIS Hojo Kanji support. (provide 'wnn7egg-jsymbol) (defvar *ku1-alist* '( ( "$B!!(B" . "$B!!(B") ( "$B!"(B" . "$B!"(B") ( "$B!#(B" . "$B!#(B") ( "$B!$(B" . "$B!$(B") ( "$B!%(B" . "$B!%(B") ( "$B!&(B" . "$B!&(B") ( "$B!'(B" . "$B!'(B") ( "$B!((B" . "$B!((B") ( "$B!)(B" . "$B!)(B") ( "$B!*(B" . "$B!*(B") ( "$B!+(B" . "$B!+(B") ( "$B!,(B" . "$B!,(B") ( "$B!-(B" . "$B!-(B") ( "$B!.(B" . "$B!.(B") ( "$B!/(B" . "$B!/(B") ( "$B!0(B" . "$B!0(B") ( "$B!1(B" . "$B!1(B") ( "$B!2(B" . "$B!2(B") ( "$B!3(B" . "$B!3(B") ( "$B!4(B" . "$B!4(B") ( "$B!5(B" . "$B!5(B") ( "$B!6(B" . "$B!6(B") ( "$B!7(B" . "$B!7(B") ( "$B!8(B" . "$B!8(B") ( "$B!9(B" . "$B!9(B") ( "$B!:(B" . "$B!:(B") ( "$B!;(B" . "$B!;(B") ( "$B!<(B" . "$B!<(B") ( "$B!=(B" . "$B!=(B") ( "$B!>(B" . "$B!>(B") ( "$B!?(B" . "$B!?(B") ( "$B!@(B" . "$B!@(B") ( "$B!A(B" . "$B!A(B") ( "$B!B(B" . "$B!B(B") ( "$B!C(B" . "$B!C(B") ( "$B!D(B" . "$B!D(B") ( "$B!E(B" . "$B!E(B") ( "$B!F(B" . "$B!F(B") ( "$B!G(B" . "$B!G(B") ( "$B!H(B" . "$B!H(B") ( "$B!I(B" . "$B!I(B") ( "$B!J(B" . "$B!J(B") ( "$B!K(B" . "$B!K(B") ( "$B!L(B" . "$B!L(B") ( "$B!M(B" . "$B!M(B") ( "$B!N(B" . "$B!N(B") ( "$B!O(B" . "$B!O(B") ( "$B!P(B" . "$B!P(B") ( "$B!Q(B" . "$B!Q(B") ( "$B!R(B" . "$B!R(B") ( "$B!S(B" . "$B!S(B") ( "$B!T(B" . "$B!T(B") ( "$B!U(B" . "$B!U(B") ( "$B!V(B" . "$B!V(B") ( "$B!W(B" . "$B!W(B") ( "$B!X(B" . "$B!X(B") ( "$B!Y(B" . "$B!Y(B") ( "$B!Z(B" . "$B!Z(B") ( "$B![(B" . "$B![(B") ( "$B!\(B" . "$B!\(B") ( "$B!](B" . "$B!](B") ( "$B!^(B" . "$B!^(B") ( "$B!_(B" . "$B!_(B") ( "$B!`(B" . "$B!`(B") ( "$B!a(B" . "$B!a(B") ( "$B!b(B" . "$B!b(B") ( "$B!c(B" . "$B!c(B") ( "$B!d(B" . "$B!d(B") ( "$B!e(B" . "$B!e(B") ( "$B!f(B" . "$B!f(B") ( "$B!g(B" . "$B!g(B") ( "$B!h(B" . "$B!h(B") ( "$B!i(B" . "$B!i(B") ( "$B!j(B" . "$B!j(B") ( "$B!k(B" . "$B!k(B") ( "$B!l(B" . "$B!l(B") ( "$B!m(B" . "$B!m(B") ( "$B!n(B" . "$B!n(B") ( "$B!o(B" . "$B!o(B") ( "$B!p(B" . "$B!p(B") ( "$B!q(B" . "$B!q(B") ( "$B!r(B" . "$B!r(B") ( "$B!s(B" . "$B!s(B") ( "$B!t(B" . "$B!t(B") ( "$B!u(B" . "$B!u(B") ( "$B!v(B" . "$B!v(B") ( "$B!w(B" . "$B!w(B") ( "$B!x(B" . "$B!x(B") ( "$B!y(B" . "$B!y(B") ( "$B!z(B" . "$B!z(B") ( "$B!{(B" . "$B!{(B") ( "$B!|(B" . "$B!|(B") ( "$B!}(B" . "$B!}(B") ( "$B!~(B" . "$B!~(B") )) (defvar *ku2-alist* '( ( "$B"!(B" . "$B"!(B") ( "$B""(B" . "$B""(B") ( "$B"#(B" . "$B"#(B") ( "$B"$(B" . "$B"$(B") ( "$B"%(B" . "$B"%(B") ( "$B"&(B" . "$B"&(B") ( "$B"'(B" . "$B"'(B") ( "$B"((B" . "$B"((B") ( "$B")(B" . "$B")(B") ( "$B"*(B" . "$B"*(B") ( "$B"+(B" . "$B"+(B") ( "$B",(B" . "$B",(B") ( "$B"-(B" . "$B"-(B") ( "$B".(B" . "$B".(B") ; ( "$B"/(B" . "$B"/(B") ; ( "$B"0(B" . "$B"0(B") ; ( "$B"1(B" . "$B"1(B") ; ( "$B"2(B" . "$B"2(B") ; ( "$B"3(B" . "$B"3(B") ; ( "$B"4(B" . "$B"4(B") ; ( "$B"5(B" . "$B"5(B") ; ( "$B"6(B" . "$B"6(B") ; ( "$B"7(B" . "$B"7(B") ; ( "$B"8(B" . "$B"8(B") ; ( "$B"9(B" . "$B"9(B") ( "$B":(B" . "$B":(B") ( "$B";(B" . "$B";(B") ( "$B"<(B" . "$B"<(B") ( "$B"=(B" . "$B"=(B") ( "$B">(B" . "$B">(B") ( "$B"?(B" . "$B"?(B") ( "$B"@(B" . "$B"@(B") ( "$B"A(B" . "$B"A(B") ; ( "$B"B(B" . "$B"B(B") ; ( "$B"C(B" . "$B"C(B") ; ( "$B"D(B" . "$B"D(B") ; ( "$B"E(B" . "$B"E(B") ; ( "$B"F(B" . "$B"F(B") ; ( "$B"G(B" . "$B"G(B") ; ( "$B"H(B" . "$B"H(B") ; ( "$B"I(B" . "$B"I(B") ( "$B"J(B" . "$B"J(B") ( "$B"K(B" . "$B"K(B") ( "$B"L(B" . "$B"L(B") ( "$B"M(B" . "$B"M(B") ( "$B"N(B" . "$B"N(B") ( "$B"O(B" . "$B"O(B") ( "$B"P(B" . "$B"P(B") ; ( "$B"Q(B" . "$B"Q(B") ; ( "$B"R(B" . "$B"R(B") ; ( "$B"S(B" . "$B"S(B") ; ( "$B"T(B" . "$B"T(B") ; ( "$B"U(B" . "$B"U(B") ; ( "$B"V(B" . "$B"V(B") ; ( "$B"W(B" . "$B"W(B") ; ( "$B"X(B" . "$B"X(B") ; ( "$B"Y(B" . "$B"Y(B") ; ( "$B"Z(B" . "$B"Z(B") ; ( "$B"[(B" . "$B"[(B") ( "$B"\(B" . "$B"\(B") ( "$B"](B" . "$B"](B") ( "$B"^(B" . "$B"^(B") ( "$B"_(B" . "$B"_(B") ( "$B"`(B" . "$B"`(B") ( "$B"a(B" . "$B"a(B") ( "$B"b(B" . "$B"b(B") ( "$B"c(B" . "$B"c(B") ( "$B"d(B" . "$B"d(B") ( "$B"e(B" . "$B"e(B") ( "$B"f(B" . "$B"f(B") ( "$B"g(B" . "$B"g(B") ( "$B"h(B" . "$B"h(B") ( "$B"i(B" . "$B"i(B") ( "$B"j(B" . "$B"j(B") ; ( "$B"k(B" . "$B"k(B") ; ( "$B"l(B" . "$B"l(B") ; ( "$B"m(B" . "$B"m(B") ; ( "$B"n(B" . "$B"n(B") ; ( "$B"o(B" . "$B"o(B") ; ( "$B"p(B" . "$B"p(B") ; ( "$B"q(B" . "$B"q(B") ( "$B"r(B" . "$B"r(B") ( "$B"s(B" . "$B"s(B") ( "$B"t(B" . "$B"t(B") ( "$B"u(B" . "$B"u(B") ( "$B"v(B" . "$B"v(B") ( "$B"w(B" . "$B"w(B") ( "$B"x(B" . "$B"x(B") ( "$B"y(B" . "$B"y(B") ; ( "$B"z(B" . "$B"z(B") ; ( "$B"{(B" . "$B"{(B") ; ( "$B"|(B" . "$B"|(B") ; ( "$B"}(B" . "$B"}(B") ( "$B"~(B" . "$B"~(B") )) (defvar egg:*symbol-alist* (append *ku1-alist* *ku2-alist*)) (defvar *ku3-alist* '( ;I ( "$B#!(B" . "$B#!(B") ;II ( "$B#"(B" . "$B#"(B") ;III ( "$B##(B" . "$B##(B") ;IV ( "$B#$(B" . "$B#$(B") ;V ( "$B#%(B" . "$B#%(B") ;VI ( "$B#&(B" . "$B#&(B") ;VII ( "$B#'(B" . "$B#'(B") ;VIII ( "$B#((B" . "$B#((B") ;IX ( "$B#)(B" . "$B#)(B") ;X ( "$B#*(B" . "$B#*(B") ;XI ( "$B#+(B" . "$B#+(B") ;XII ( "$B#,(B" . "$B#,(B") ;XIII ( "$B#-(B" . "$B#-(B") ;XIV ( "$B#.(B" . "$B#.(B") ;XV ( "$B#/(B" . "$B#/(B") ( "$B#0(B" . "$B#0(B") ( "$B#1(B" . "$B#1(B") ( "$B#2(B" . "$B#2(B") ( "$B#3(B" . "$B#3(B") ( "$B#4(B" . "$B#4(B") ( "$B#5(B" . "$B#5(B") ( "$B#6(B" . "$B#6(B") ( "$B#7(B" . "$B#7(B") ( "$B#8(B" . "$B#8(B") ( "$B#9(B" . "$B#9(B") ;1/2 ( "$B#:(B" . "$B#:(B") ;1/3 ( "$B#;(B" . "$B#;(B") ;1/4 ( "$B#<(B" . "$B#<(B") ;2/3 ( "$B#=(B" . "$B#=(B") ;3/4 ( "$B#>(B" . "$B#>(B") ; ( "$B#?(B" . "$B#?(B") ; ( "$B#@(B" . "$B#@(B") ( "$B#A(B" . "$B#A(B") ( "$B#B(B" . "$B#B(B") ( "$B#C(B" . "$B#C(B") ( "$B#D(B" . "$B#D(B") ( "$B#E(B" . "$B#E(B") ( "$B#F(B" . "$B#F(B") ( "$B#G(B" . "$B#G(B") ( "$B#H(B" . "$B#H(B") ( "$B#I(B" . "$B#I(B") ( "$B#J(B" . "$B#J(B") ( "$B#K(B" . "$B#K(B") ( "$B#L(B" . "$B#L(B") ( "$B#M(B" . "$B#M(B") ( "$B#N(B" . "$B#N(B") ( "$B#O(B" . "$B#O(B") ( "$B#P(B" . "$B#P(B") ( "$B#Q(B" . "$B#Q(B") ( "$B#R(B" . "$B#R(B") ( "$B#S(B" . "$B#S(B") ( "$B#T(B" . "$B#T(B") ( "$B#U(B" . "$B#U(B") ( "$B#V(B" . "$B#V(B") ( "$B#W(B" . "$B#W(B") ( "$B#X(B" . "$B#X(B") ( "$B#Y(B" . "$B#Y(B") ( "$B#Z(B" . "$B#Z(B") ; ( "$B#[(B" . "$B#[(B") ; ( "$B#\(B" . "$B#\(B") ; ( "$B#](B" . "$B#](B") ; ( "$B#^(B" . "$B#^(B") ; ( "$B#_(B" . "$B#_(B") ; ( "$B#`(B" . "$B#`(B") ( "$B#a(B" . "$B#a(B") ( "$B#b(B" . "$B#b(B") ( "$B#c(B" . "$B#c(B") ( "$B#d(B" . "$B#d(B") ( "$B#e(B" . "$B#e(B") ( "$B#f(B" . "$B#f(B") ( "$B#g(B" . "$B#g(B") ( "$B#h(B" . "$B#h(B") ( "$B#i(B" . "$B#i(B") ( "$B#j(B" . "$B#j(B") ( "$B#k(B" . "$B#k(B") ( "$B#l(B" . "$B#l(B") ( "$B#m(B" . "$B#m(B") ( "$B#n(B" . "$B#n(B") ( "$B#o(B" . "$B#o(B") ( "$B#p(B" . "$B#p(B") ( "$B#q(B" . "$B#q(B") ( "$B#r(B" . "$B#r(B") ( "$B#s(B" . "$B#s(B") ( "$B#t(B" . "$B#t(B") ( "$B#u(B" . "$B#u(B") ( "$B#v(B" . "$B#v(B") ( "$B#w(B" . "$B#w(B") ( "$B#x(B" . "$B#x(B") ( "$B#y(B" . "$B#y(B") ( "$B#z(B" . "$B#z(B") ; ( "$B#{(B" . "$B#{(B") ; ( "$B#|(B" . "$B#|(B") ; ( "$B#}(B" . "$B#}(B") ; ( "$B#~(B" . "$B#~(B") )) (defvar egg:*alphanumeric-alist* *ku3-alist*) (defvar *ku4-alist* '( ( "$B$!(B" . "$B$!(B") ( "$B$"(B" . "$B$"(B") ( "$B$#(B" . "$B$#(B") ( "$B$$(B" . "$B$$(B") ( "$B$%(B" . "$B$%(B") ( "$B$&(B" . "$B$&(B") ( "$B$'(B" . "$B$'(B") ( "$B$((B" . "$B$((B") ( "$B$)(B" . "$B$)(B") ( "$B$*(B" . "$B$*(B") ( "$B$+(B" . "$B$+(B") ( "$B$,(B" . "$B$,(B") ( "$B$-(B" . "$B$-(B") ( "$B$.(B" . "$B$.(B") ( "$B$/(B" . "$B$/(B") ( "$B$0(B" . "$B$0(B") ( "$B$1(B" . "$B$1(B") ( "$B$2(B" . "$B$2(B") ( "$B$3(B" . "$B$3(B") ( "$B$4(B" . "$B$4(B") ( "$B$5(B" . "$B$5(B") ( "$B$6(B" . "$B$6(B") ( "$B$7(B" . "$B$7(B") ( "$B$8(B" . "$B$8(B") ( "$B$9(B" . "$B$9(B") ( "$B$:(B" . "$B$:(B") ( "$B$;(B" . "$B$;(B") ( "$B$<(B" . "$B$<(B") ( "$B$=(B" . "$B$=(B") ( "$B$>(B" . "$B$>(B") ( "$B$?(B" . "$B$?(B") ( "$B$@(B" . "$B$@(B") ( "$B$A(B" . "$B$A(B") ( "$B$B(B" . "$B$B(B") ( "$B$C(B" . "$B$C(B") ( "$B$D(B" . "$B$D(B") ( "$B$E(B" . "$B$E(B") ( "$B$F(B" . "$B$F(B") ( "$B$G(B" . "$B$G(B") ( "$B$H(B" . "$B$H(B") ( "$B$I(B" . "$B$I(B") ( "$B$J(B" . "$B$J(B") ( "$B$K(B" . "$B$K(B") ( "$B$L(B" . "$B$L(B") ( "$B$M(B" . "$B$M(B") ( "$B$N(B" . "$B$N(B") ( "$B$O(B" . "$B$O(B") ( "$B$P(B" . "$B$P(B") ( "$B$Q(B" . "$B$Q(B") ( "$B$R(B" . "$B$R(B") ( "$B$S(B" . "$B$S(B") ( "$B$T(B" . "$B$T(B") ( "$B$U(B" . "$B$U(B") ( "$B$V(B" . "$B$V(B") ( "$B$W(B" . "$B$W(B") ( "$B$X(B" . "$B$X(B") ( "$B$Y(B" . "$B$Y(B") ( "$B$Z(B" . "$B$Z(B") ( "$B$[(B" . "$B$[(B") ( "$B$\(B" . "$B$\(B") ( "$B$](B" . "$B$](B") ( "$B$^(B" . "$B$^(B") ( "$B$_(B" . "$B$_(B") ( "$B$`(B" . "$B$`(B") ( "$B$a(B" . "$B$a(B") ( "$B$b(B" . "$B$b(B") ( "$B$c(B" . "$B$c(B") ( "$B$d(B" . "$B$d(B") ( "$B$e(B" . "$B$e(B") ( "$B$f(B" . "$B$f(B") ( "$B$g(B" . "$B$g(B") ( "$B$h(B" . "$B$h(B") ( "$B$i(B" . "$B$i(B") ( "$B$j(B" . "$B$j(B") ( "$B$k(B" . "$B$k(B") ( "$B$l(B" . "$B$l(B") ( "$B$m(B" . "$B$m(B") ( "$B$n(B" . "$B$n(B") ( "$B$o(B" . "$B$o(B") ( "$B$p(B" . "$B$p(B") ( "$B$q(B" . "$B$q(B") ( "$B$r(B" . "$B$r(B") ( "$B$s(B" . "$B$s(B") ; ( "$B$t(B" . "$B$t(B") ; ( "$B$u(B" . "$B$u(B") ; ( "$B$v(B" . "$B$v(B") ; ( "$B$w(B" . "$B$w(B") ; ( "$B$x(B" . "$B$x(B") ; ( "$B$y(B" . "$B$y(B") ; ( "$B$z(B" . "$B$z(B") ; ( "$B${(B" . "$B${(B") ; ( "$B$|(B" . "$B$|(B") ; ( "$B$}(B" . "$B$}(B") ; ( "$B$~(B" . "$B$~(B") )) (defvar egg:*hiragana-alist* *ku4-alist*) (defvar *ku5-alist* '( ( "$B%!(B" . "$B%!(B") ( "$B%"(B" . "$B%"(B") ( "$B%#(B" . "$B%#(B") ( "$B%$(B" . "$B%$(B") ( "$B%%(B" . "$B%%(B") ( "$B%&(B" . "$B%&(B") ( "$B%'(B" . "$B%'(B") ( "$B%((B" . "$B%((B") ( "$B%)(B" . "$B%)(B") ( "$B%*(B" . "$B%*(B") ( "$B%+(B" . "$B%+(B") ( "$B%,(B" . "$B%,(B") ( "$B%-(B" . "$B%-(B") ( "$B%.(B" . "$B%.(B") ( "$B%/(B" . "$B%/(B") ( "$B%0(B" . "$B%0(B") ( "$B%1(B" . "$B%1(B") ( "$B%2(B" . "$B%2(B") ( "$B%3(B" . "$B%3(B") ( "$B%4(B" . "$B%4(B") ( "$B%5(B" . "$B%5(B") ( "$B%6(B" . "$B%6(B") ( "$B%7(B" . "$B%7(B") ( "$B%8(B" . "$B%8(B") ( "$B%9(B" . "$B%9(B") ( "$B%:(B" . "$B%:(B") ( "$B%;(B" . "$B%;(B") ( "$B%<(B" . "$B%<(B") ( "$B%=(B" . "$B%=(B") ( "$B%>(B" . "$B%>(B") ( "$B%?(B" . "$B%?(B") ( "$B%@(B" . "$B%@(B") ( "$B%A(B" . "$B%A(B") ( "$B%B(B" . "$B%B(B") ( "$B%C(B" . "$B%C(B") ( "$B%D(B" . "$B%D(B") ( "$B%E(B" . "$B%E(B") ( "$B%F(B" . "$B%F(B") ( "$B%G(B" . "$B%G(B") ( "$B%H(B" . "$B%H(B") ( "$B%I(B" . "$B%I(B") ( "$B%J(B" . "$B%J(B") ( "$B%K(B" . "$B%K(B") ( "$B%L(B" . "$B%L(B") ( "$B%M(B" . "$B%M(B") ( "$B%N(B" . "$B%N(B") ( "$B%O(B" . "$B%O(B") ( "$B%P(B" . "$B%P(B") ( "$B%Q(B" . "$B%Q(B") ( "$B%R(B" . "$B%R(B") ( "$B%S(B" . "$B%S(B") ( "$B%T(B" . "$B%T(B") ( "$B%U(B" . "$B%U(B") ( "$B%V(B" . "$B%V(B") ( "$B%W(B" . "$B%W(B") ( "$B%X(B" . "$B%X(B") ( "$B%Y(B" . "$B%Y(B") ( "$B%Z(B" . "$B%Z(B") ( "$B%[(B" . "$B%[(B") ( "$B%\(B" . "$B%\(B") ( "$B%](B" . "$B%](B") ( "$B%^(B" . "$B%^(B") ( "$B%_(B" . "$B%_(B") ( "$B%`(B" . "$B%`(B") ( "$B%a(B" . "$B%a(B") ( "$B%b(B" . "$B%b(B") ( "$B%c(B" . "$B%c(B") ( "$B%d(B" . "$B%d(B") ( "$B%e(B" . "$B%e(B") ( "$B%f(B" . "$B%f(B") ( "$B%g(B" . "$B%g(B") ( "$B%h(B" . "$B%h(B") ( "$B%i(B" . "$B%i(B") ( "$B%j(B" . "$B%j(B") ( "$B%k(B" . "$B%k(B") ( "$B%l(B" . "$B%l(B") ( "$B%m(B" . "$B%m(B") ( "$B%n(B" . "$B%n(B") ( "$B%o(B" . "$B%o(B") ( "$B%p(B" . "$B%p(B") ( "$B%q(B" . "$B%q(B") ( "$B%r(B" . "$B%r(B") ( "$B%s(B" . "$B%s(B") ( "$B%t(B" . "$B%t(B") ( "$B%u(B" . "$B%u(B") ( "$B%v(B" . "$B%v(B") ; ( "$B%w(B" . "$B%w(B") ; ( "$B%x(B" . "$B%x(B") ; ( "$B%y(B" . "$B%y(B") ; ( "$B%z(B" . "$B%z(B") ; ( "$B%{(B" . "$B%{(B") ; ( "$B%|(B" . "$B%|(B") ; ( "$B%}(B" . "$B%}(B") ; ( "$B%~(B" . "$B%~(B") )) (defvar egg:*katakana-alist* *ku5-alist*) (defvar *ku6-alist* '( ( "$B&!(B" . "$B&!(B") ( "$B&"(B" . "$B&"(B") ( "$B&#(B" . "$B&#(B") ( "$B&$(B" . "$B&$(B") ( "$B&%(B" . "$B&%(B") ( "$B&&(B" . "$B&&(B") ( "$B&'(B" . "$B&'(B") ( "$B&((B" . "$B&((B") ( "$B&)(B" . "$B&)(B") ( "$B&*(B" . "$B&*(B") ( "$B&+(B" . "$B&+(B") ( "$B&,(B" . "$B&,(B") ( "$B&-(B" . "$B&-(B") ( "$B&.(B" . "$B&.(B") ( "$B&/(B" . "$B&/(B") ( "$B&0(B" . "$B&0(B") ( "$B&1(B" . "$B&1(B") ( "$B&2(B" . "$B&2(B") ( "$B&3(B" . "$B&3(B") ( "$B&4(B" . "$B&4(B") ( "$B&5(B" . "$B&5(B") ( "$B&6(B" . "$B&6(B") ( "$B&7(B" . "$B&7(B") ( "$B&8(B" . "$B&8(B") ; ( "$B&9(B" . "$B&9(B") ; ( "$B&:(B" . "$B&:(B") ; ( "$B&;(B" . "$B&;(B") ; ( "$B&<(B" . "$B&<(B") ; ( "$B&=(B" . "$B&=(B") ; ( "$B&>(B" . "$B&>(B") ; ( "$B&?(B" . "$B&?(B") ; ( "$B&@(B" . "$B&@(B") ( "$B&A(B" . "$B&A(B") ( "$B&B(B" . "$B&B(B") ( "$B&C(B" . "$B&C(B") ( "$B&D(B" . "$B&D(B") ( "$B&E(B" . "$B&E(B") ( "$B&F(B" . "$B&F(B") ( "$B&G(B" . "$B&G(B") ( "$B&H(B" . "$B&H(B") ( "$B&I(B" . "$B&I(B") ( "$B&J(B" . "$B&J(B") ( "$B&K(B" . "$B&K(B") ( "$B&L(B" . "$B&L(B") ( "$B&M(B" . "$B&M(B") ( "$B&N(B" . "$B&N(B") ( "$B&O(B" . "$B&O(B") ( "$B&P(B" . "$B&P(B") ( "$B&Q(B" . "$B&Q(B") ( "$B&R(B" . "$B&R(B") ( "$B&S(B" . "$B&S(B") ( "$B&T(B" . "$B&T(B") ( "$B&U(B" . "$B&U(B") ( "$B&V(B" . "$B&V(B") ( "$B&W(B" . "$B&W(B") ( "$B&X(B" . "$B&X(B") ; ( "$B&Y(B" . "$B&Y(B") ; ( "$B&Z(B" . "$B&Z(B") ; ( "$B&[(B" . "$B&[(B") ; ( "$B&\(B" . "$B&\(B") ; ( "$B&](B" . "$B&](B") ; ( "$B&^(B" . "$B&^(B") ; ( "$B&_(B" . "$B&_(B") ; ( "$B&`(B" . "$B&`(B") ;(a) ( "$B&a(B" . "$B&a(B") ;(b) ( "$B&b(B" . "$B&b(B") ;(c) ( "$B&c(B" . "$B&c(B") ;(d) ( "$B&d(B" . "$B&d(B") ;(e) ( "$B&e(B" . "$B&e(B") ;(f) ( "$B&f(B" . "$B&f(B") ;(g) ( "$B&g(B" . "$B&g(B") ;(h) ( "$B&h(B" . "$B&h(B") ;(i) ( "$B&i(B" . "$B&i(B") ;(j) ( "$B&j(B" . "$B&j(B") ;(k) ( "$B&k(B" . "$B&k(B") ;(l) ( "$B&l(B" . "$B&l(B") ;(m) ( "$B&m(B" . "$B&m(B") ;(n) ( "$B&n(B" . "$B&n(B") ;(o) ( "$B&o(B" . "$B&o(B") ;(p) ( "$B&p(B" . "$B&p(B") ;(q) ( "$B&q(B" . "$B&q(B") ;(r) ( "$B&r(B" . "$B&r(B") ;(s) ( "$B&s(B" . "$B&s(B") ;(t) ( "$B&t(B" . "$B&t(B") ;(u) ( "$B&u(B" . "$B&u(B") ;(v) ( "$B&v(B" . "$B&v(B") ;(w) ( "$B&w(B" . "$B&w(B") ;(x) ( "$B&x(B" . "$B&x(B") ;(y) ( "$B&y(B" . "$B&y(B") ;(z) ( "$B&z(B" . "$B&z(B") ; ( "$B&{(B" . "$B&{(B") ; ( "$B&|(B" . "$B&|(B") ; ( "$B&}(B" . "$B&}(B") ; ( "$B&~(B" . "$B&~(B") )) (defvar egg:*greek-alist* *ku6-alist*) (defvar *ku7-alist* '( ( "$B'!(B" . "$B'!(B") ( "$B'"(B" . "$B'"(B") ( "$B'#(B" . "$B'#(B") ( "$B'$(B" . "$B'$(B") ( "$B'%(B" . "$B'%(B") ( "$B'&(B" . "$B'&(B") ( "$B''(B" . "$B''(B") ( "$B'((B" . "$B'((B") ( "$B')(B" . "$B')(B") ( "$B'*(B" . "$B'*(B") ( "$B'+(B" . "$B'+(B") ( "$B',(B" . "$B',(B") ( "$B'-(B" . "$B'-(B") ( "$B'.(B" . "$B'.(B") ( "$B'/(B" . "$B'/(B") ( "$B'0(B" . "$B'0(B") ( "$B'1(B" . "$B'1(B") ( "$B'2(B" . "$B'2(B") ( "$B'3(B" . "$B'3(B") ( "$B'4(B" . "$B'4(B") ( "$B'5(B" . "$B'5(B") ( "$B'6(B" . "$B'6(B") ( "$B'7(B" . "$B'7(B") ( "$B'8(B" . "$B'8(B") ( "$B'9(B" . "$B'9(B") ( "$B':(B" . "$B':(B") ( "$B';(B" . "$B';(B") ( "$B'<(B" . "$B'<(B") ( "$B'=(B" . "$B'=(B") ( "$B'>(B" . "$B'>(B") ( "$B'?(B" . "$B'?(B") ( "$B'@(B" . "$B'@(B") ( "$B'A(B" . "$B'A(B") ;(1) ( "$B'B(B" . "$B'B(B") ;(2) ( "$B'C(B" . "$B'C(B") ;(3) ( "$B'D(B" . "$B'D(B") ;(4) ( "$B'E(B" . "$B'E(B") ;(5) ( "$B'F(B" . "$B'F(B") ;(6) ( "$B'G(B" . "$B'G(B") ;(7) ( "$B'H(B" . "$B'H(B") ;(8) ( "$B'I(B" . "$B'I(B") ;(9) ( "$B'J(B" . "$B'J(B") ;(10) ( "$B'K(B" . "$B'K(B") ;(11) ( "$B'L(B" . "$B'L(B") ;(12) ( "$B'M(B" . "$B'M(B") ;(13) ( "$B'N(B" . "$B'N(B") ;(14) ( "$B'O(B" . "$B'O(B") ;(15) ( "$B'P(B" . "$B'P(B") ( "$B'Q(B" . "$B'Q(B") ( "$B'R(B" . "$B'R(B") ( "$B'S(B" . "$B'S(B") ( "$B'T(B" . "$B'T(B") ( "$B'U(B" . "$B'U(B") ( "$B'V(B" . "$B'V(B") ( "$B'W(B" . "$B'W(B") ( "$B'X(B" . "$B'X(B") ( "$B'Y(B" . "$B'Y(B") ( "$B'Z(B" . "$B'Z(B") ( "$B'[(B" . "$B'[(B") ( "$B'\(B" . "$B'\(B") ( "$B'](B" . "$B'](B") ( "$B'^(B" . "$B'^(B") ( "$B'_(B" . "$B'_(B") ( "$B'`(B" . "$B'`(B") ( "$B'a(B" . "$B'a(B") ( "$B'b(B" . "$B'b(B") ( "$B'c(B" . "$B'c(B") ( "$B'd(B" . "$B'd(B") ( "$B'e(B" . "$B'e(B") ( "$B'f(B" . "$B'f(B") ( "$B'g(B" . "$B'g(B") ( "$B'h(B" . "$B'h(B") ( "$B'i(B" . "$B'i(B") ( "$B'j(B" . "$B'j(B") ( "$B'k(B" . "$B'k(B") ( "$B'l(B" . "$B'l(B") ( "$B'm(B" . "$B'm(B") ( "$B'n(B" . "$B'n(B") ( "$B'o(B" . "$B'o(B") ( "$B'p(B" . "$B'p(B") ( "$B'q(B" . "$B'q(B") ;i ( "$B'r(B" . "$B'r(B") ;ii ( "$B's(B" . "$B's(B") ;iii ( "$B't(B" . "$B't(B") ;iv ( "$B'u(B" . "$B'u(B") ;v ( "$B'v(B" . "$B'v(B") ;vi ( "$B'w(B" . "$B'w(B") ;vii ( "$B'x(B" . "$B'x(B") ;viii ( "$B'y(B" . "$B'y(B") ;ix ( "$B'z(B" . "$B'z(B") ;x ( "$B'{(B" . "$B'{(B") ;| ( "$B'|(B" . "$B'|(B") ;' ( "$B'}(B" . "$B'}(B") ;'' ( "$B'~(B" . "$B'~(B") )) (defvar egg:*russian-alist* *ku7-alist*) (defvar *ku8-alist* '( ( "$B(!(B" . "$B(!(B") ( "$B("(B" . "$B("(B") ( "$B(#(B" . "$B(#(B") ( "$B($(B" . "$B($(B") ( "$B(%(B" . "$B(%(B") ( "$B(&(B" . "$B(&(B") ( "$B('(B" . "$B('(B") ( "$B(((B" . "$B(((B") ( "$B()(B" . "$B()(B") ( "$B(*(B" . "$B(*(B") ( "$B(+(B" . "$B(+(B") ( "$B(,(B" . "$B(,(B") ( "$B(-(B" . "$B(-(B") ( "$B(.(B" . "$B(.(B") ( "$B(/(B" . "$B(/(B") ( "$B(0(B" . "$B(0(B") ( "$B(1(B" . "$B(1(B") ( "$B(2(B" . "$B(2(B") ( "$B(3(B" . "$B(3(B") ( "$B(4(B" . "$B(4(B") ( "$B(5(B" . "$B(5(B") ( "$B(6(B" . "$B(6(B") ( "$B(7(B" . "$B(7(B") ( "$B(8(B" . "$B(8(B") ( "$B(9(B" . "$B(9(B") ( "$B(:(B" . "$B(:(B") ( "$B(;(B" . "$B(;(B") ( "$B(<(B" . "$B(<(B") ( "$B(=(B" . "$B(=(B") ( "$B(>(B" . "$B(>(B") ( "$B(?(B" . "$B(?(B") ( "$B(@(B" . "$B(@(B") ; ( "$B(A(B" . "$B(A(B") ; ( "$B(B(B" . "$B(B(B") ; ( "$B(C(B" . "$B(C(B") ; ( "$B(D(B" . "$B(D(B") ; ( "$B(E(B" . "$B(E(B") ;* ( "$B(F(B" . "$B(F(B") ;* ( "$B(G(B" . "$B(G(B") ;* ( "$B(H(B" . "$B(H(B") ;* ( "$B(I(B" . "$B(I(B") ;* ( "$B(J(B" . "$B(J(B") ;* ( "$B(K(B" . "$B(K(B") ;* ( "$B(L(B" . "$B(L(B") ;* ( "$B(M(B" . "$B(M(B") ;* ( "$B(N(B" . "$B(N(B") ;* ( "$B(O(B" . "$B(O(B") ;* ( "$B(P(B" . "$B(P(B") ;* ( "$B(Q(B" . "$B(Q(B") ;* ( "$B(R(B" . "$B(R(B") ;* ( "$B(S(B" . "$B(S(B") ;* ( "$B(T(B" . "$B(T(B") ;* ( "$B(U(B" . "$B(U(B") ;* ( "$B(V(B" . "$B(V(B") ;* ( "$B(W(B" . "$B(W(B") ;* ( "$B(X(B" . "$B(X(B") ;* ( "$B(Y(B" . "$B(Y(B") ;* ( "$B(Z(B" . "$B(Z(B") ;* ( "$B([(B" . "$B([(B") ;* ( "$B(\(B" . "$B(\(B") ;* ( "$B(](B" . "$B(](B") ;* ( "$B(^(B" . "$B(^(B") ;* ( "$B(_(B" . "$B(_(B") ;* ( "$B(`(B" . "$B(`(B") ;* ( "$B(a(B" . "$B(a(B") ;* ( "$B(b(B" . "$B(b(B") ;* ( "$B(c(B" . "$B(c(B") ;* ( "$B(d(B" . "$B(d(B") ;* ( "$B(e(B" . "$B(e(B") ;* ( "$B(f(B" . "$B(f(B") ;* ( "$B(g(B" . "$B(g(B") ;* ( "$B(h(B" . "$B(h(B") ;* ( "$B(i(B" . "$B(i(B") ;* ( "$B(j(B" . "$B(j(B") ;* ( "$B(k(B" . "$B(k(B") ;* ( "$B(l(B" . "$B(l(B") ;* ( "$B(m(B" . "$B(m(B") ;* ( "$B(n(B" . "$B(n(B") ;* ( "$B(o(B" . "$B(o(B") ;* ( "$B(p(B" . "$B(p(B") ;* ( "$B(q(B" . "$B(q(B") ;* ( "$B(r(B" . "$B(r(B") ;* ( "$B(s(B" . "$B(s(B") ;* ( "$B(t(B" . "$B(t(B") ;* ( "$B(u(B" . "$B(u(B") ;* ( "$B(v(B" . "$B(v(B") ;* ( "$B(w(B" . "$B(w(B") ;* ( "$B(x(B" . "$B(x(B") ;* ( "$B(y(B" . "$B(y(B") ;* ( "$B(z(B" . "$B(z(B") ; ( "$B({(B" . "$B({(B") ; ( "$B(|(B" . "$B(|(B") ; ( "$B(}(B" . "$B(}(B") ; ( "$B(~(B" . "$B(~(B") )) (defvar egg:*keisen-alist* *ku8-alist*) (defun make-all-jis-code-alist () (let ((result nil) (ku 116)) (while (< 32 ku) (let ((ten 126)) (while (< 32 ten) (setq result (cons (let ((str (make-string 1 0))) (aset str 0 (make-char 'japanese-jisx0208 ku ten)) (cons str str)) result)) (setq ten (1- ten)))) (setq ku (1- ku))) result)) (defun make-jis-first-level-code-alist () (let ((result nil) (ku 79)) (while (<= 48 ku) (let ((ten 126)) (while (<= 33 ten) (setq result (cons (let ((str (make-string 1 0))) (aset str 0 (make-char 'japanese-jisx0208 ku ten)) (cons str str)) result)) (setq ten (1- ten)))) (setq ku (1- ku))) result)) (defun make-jis-second-level-code-alist () (let ((result nil) (ku 116)) (while (<= 80 ku) (let ((ten 126)) (while (<= 33 ten) (setq result (cons (let ((str (make-string 1 0))) (aset str 0 (make-char 'japanese-jisx0208 ku ten)) (cons str str)) result)) (setq ten (1- ten)))) (setq ku (1- ku))) result)) (defun make-jis-hojo-kanji-code-alist () (let ((result nil) (ku 109)) (while (<= 34 ku) (let ((ten 126)) (while (<= 33 ten) (setq result (cons (let ((str (make-string 1 0))) ; by T.Shingu (aset str 0 (make-char 'japanese-jisx0212 ku ten)) (cons str str)) result)) (setq ten (1- ten)))) (setq ku (1- ku))) result)) ;;;(defvar egg:*all-jis-code-alist* (make-all-jis-code-alist)) (defvar egg:*first-level-alist* (make-jis-first-level-code-alist)) (defvar egg:*second-level-alist* (make-jis-second-level-code-alist)) (defvar egg:*hojo-kanji-alist* (make-jis-hojo-kanji-code-alist)) (defvar *symbol-input-menu* (list 'menu "$B5-9fF~NO(B:" (list (cons "JIS$BF~NO(B" '(jis-code-input)) (cons "$B5-9f(B" (list 'menu "$B5-9f(B:" egg:*symbol-alist*)) (cons "$B1Q?t;z(B" (list 'menu "$B1Q?t;z(B:" egg:*alphanumeric-alist*)) (cons "$B$R$i$,$J(B" (list 'menu "$B$R$i$,$J(B:" egg:*hiragana-alist*)) (cons "$B%+%?%+%J(B" (list 'menu "$B%+%?%+%J(B:" egg:*katakana-alist*)) (cons "$B%.%j%7%cJ8;z(B" (list 'menu "$B%.%j%7%cJ8;z(B:" egg:*greek-alist*)) (cons "$B%m%7%"J8;z(B" (list 'menu "$B%m%7%"J8;z(B:" egg:*russian-alist*)) (cons "$B7S@~(B" (list 'menu "$B7S@~(B:" egg:*keisen-alist*)) ;; 92.7.8 by T.Shingu (cons "$BIt/$7;~4V$,3]$+$j$^$9!#!K(B" ;; (list 'menu "$BA4%3!<%I(B:" egg:*all-jis-code-alist*)) ))) wnn7egg-1.02.orig/elisp/emacs20/wnn7egg-leim.el0100644000764400003210000000453407474174160021343 0ustar ishikawaishikawa;;; wnn7egg-leim.el --- Egg/Wnn-related code for LEIM ;; Copyright (C) 2001 OMRON SOFTWARE Co., Ltd. ;; Shamelessly ripped off from ;; ;; egg-leim.el --- Egg-related code for LEIM ;; Copyright (C) 1997 Stephen Turnbull ;; Copyright (C) 1997 Free Software Foundation, Inc. ;; ;; Shamelessly ripped off from ;; ;; skk-leim.el --- SKK related code for LEIM ;; Copyright (C) 1997 ;; Murata Shuuichirou ;; ;; Author: OMRON SOFTWARE Co., Ltd. ;; Keywords: japanese, input method, LEIM, Wnn7 ;; Last Modified: 2001/5/30 00:00:00 ;; This program 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 versions 2, or (at your option) ;; any later version. ;; This program 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 XEmacs, see the file COPYING. If not, write to the Free ;; Software Foundation Inc., 59 Temple Place - Suite 330, Boston, ;; MA 02111-1307, USA. ;;; TODO ;; ;; Add pointers to Egg documentation in LEIM format (defvar wnn7-activate nil "T if wnn7egg is activeate.") (make-variable-buffer-local 'wnn7-activate) (set-default 'wnn7-activate nil) (if (featurep 'xemacs) (if (fboundp 'set-input-method) (defun select-input-method (lang) (set-input-method lang)))) (defun wnn7egg-activate (&optional name) (require 'wnn7egg) (require 'wnn7egg-cnv) (setq inactivate-current-input-method-function 'wnn7egg-inactivate) (setq wnn7egg-default-startup-file "eggrc-wnn7") (wnn7-egg-mode) (setq wnn7-activate t);;;; (toggle-egg-mode)) (defun wnn7egg-inactivate () (setq wnn7-activate nil);;;; (cond (egg:*mode-on* (toggle-egg-mode)))) (defun wnn7-p () (or (and current-input-method (string-match "japanese-egg-wnn7" current-input-method)) wnn7-activate)) (register-input-method 'japanese-egg-wnn7 "Japanese" 'wnn7egg-activate nil "Wnn7EGG - an interface to the Wnn7 kana to kanji conversion program") (provide 'wnn7egg-leim) ;;; wnn7egg-leim.el ends here wnn7egg-1.02.orig/elisp/emacs20/wnn7egg-lib.el0100644000764400003210000023354007474174160021164 0ustar ishikawaishikawa;; Wnn7Egg is Egg modified for Wnn7, and the current maintainer ;; is OMRON SOFTWARE Co., Ltd. ;; ;; This file is part of Wnn7Egg. ;; (base code is egg/wnn.el (eggV4) and wnnfns.c) ;; ;;; ------------------------------------------------------------------ ;;; ;;; Wnn7Egg $B!J(BWnn "$B$J$J(B"$B$?$^$4!K(B--- Wnn7 Emacs Client ;;; ;;; Wnn7Egg $B$O!"!V$?$^$4Bh#3HG!W(Bv3.09 $B$r%Y!<%9$K(B $B!V$?$^$4Bh#4HG!W$NDL?.!"(B ;;; $B%i%$%V%i%jIt$rAH$_9~$s$@!"(BWnn7 $B$N0Y$N@lMQ%/%i%$%"%s%H$G$9!#(B ;;; ;;; $B$9$Y$F$N%=!<%9$,(B Emacs Lisp $B$G5-=R$5$l$F$$$k$N$G!"(BWnn SDK/Library $B$rI,MW(B ;;; $B$H$;$:!"(BGNU Emacs $B5Z$S(B XEmacs $B4D6-$G;HMQ$9$k$3$H$,$G$-$^$9!#;HMQ5vBz>r7o(B ;;; $B$O(B GPL $B$G$9!#(B ;;; ;;; GNU Emacs 20.3 $B0J9_!"(BXEmacs 21.x $B0J9_$GF0:n3NG'$7$F$$$^$9!#(B ;;; ;;; ;;; Wnn7Egg $B$O(B Wnn7 $B$N5!G=$G$"$k3Z!9F~NO!JF~NOM=B,!K!"O"A[JQ49$r%5%]!<%H(B ;;; $B$7$F$$$^$9!#(B ;;; ;;; $B!V$?$^$4!W$HFHN)!?6&B8$G$-$k$h$&$K!"1F6A$9$k$r(B ;;; "wnn7..." $B$H$$$&7A$KJQ99$7$F$$$^$9!#(B ;;; ;;; ------------------------------------------------------------------ ;;; wnn7egg-lib.el --- high level Interface with Wnn7 Jserver ;; Copyright (C) 2001 OMRON SOFTWARE Co., Ltd. ;; Author: OMRON SOFTWARE Co., Ltd. ;; Keywords: input method ;; This file is part of Wnn7Egg. ;; And this file is composed from egg/wnn.el (eggV4) and wnnfns.c (eggV3.09) ;; egg/wnn.el --- WNN Support (high level interface) in Egg ;; Input Method Architecture ;; Copyright (C) 1999,2000 PFU LIMITED ;; Author: NIIBE Yutaka ;; KATAYAMA Yoshio ;; wnnfns.c --- Jserver Interface for Mule ;; Coded by Yutaka Ishikawa at ETL (yisikawa@etl.go.jp) ;; Satoru Tomura at ETL (tomura@etl.go.jp) ;; This program 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. ;; This program 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: ;;; Change log: ;;; 2002/5/22 $BL5JQ49<-=q!"J8@a@Z$j<-=q$NDI2C=hM}$N=$@5(B ;;; 2002/5/22 $B@\F,8l%Q%i%a!<%?(B prefix-flag $B$N@_DjCM$N=$@5(B ;;; 2002/5/16 XEmacs $B$G%f!<%6<-=q$N3JG<>l=jJQ99$,@5$7$/9T$J$($J$$LdBj$NBP1~(B ;;; 2002/5/16 $B%f!<%6<-=q$N%/%i%$%"%s%HE>AwF0:n$K$*$1$kIT6q9g=$@5(B ;;; 2002/5/16 $BM=B,%b!<%I;~$K5UJQ49F0:n$,@5$7$/9T$J$($J$$LdBj$KBP1~(B ;;; 2001/9/30 v1.01 (bug fix) ;;; 2001/5/30 First Release ;;; Code: ;;; Last modified date: 2002/5/22 (require 'wnn7egg-edep) (if (featurep 'xemacs) (require 'wnn7egg-rpcx21) (require 'wnn7egg-rpc)) (defun egg:error (form &rest mesg) (apply 'notify (or form "%s") mesg) (apply 'error (or form "%s") mesg)) (defvar wnn7-message-type 'japanese) (defun wnn7-toggle-message-type () "Toggle whether wnn reports info in english or japanese." (interactive) (if (eq wnn7-message-type 'japanese) (setq wnn7-message-type 'english) (setq wnn7-message-type 'japanese))) (defvar *wnn7-message-alist* '((english ((open-wnn "Connected with Wnn on host %s") (cannot-connect "Cannot connect with Wnn") (no-rcfile "No wnn7egg-startup-file on %s") (file-saved "Wnn dictionary and frequency data recorded.") (no-dir "directory %s missing. Create it? ") (fail-dir "failed to create directory %s") (create-dir "directory %s created") (no-dict1 "dictionary file %s is missing: %s") (no-dict2 "dictionary file %s is missing. Create it? ") (create-dict "dictionary file %s is created") (no-freq1 "frequency file %s is missing: %s") (no-freq2 "frequency file %s is missing. Create it? ") (create-freq "frequency file %s is created") (no-match "unmatch dictionary and freq. file %s. Re-create it? ") (re-create-freq "frequency file %s is re-created") (henkan-mode-indicator "$B4A(B") (begin-henkan "Fence starting character: ") (end-henkan "Fence ending character: ") (kugiri-dai "Large bunsetsu separator: ") (kugiri-sho "Small bunsetsu separator: ") (face-henkan "Face for conversion: ") (face-dai "Face for large bunsetsu: ") (face-sho "Face for small bunsetsu: ") (jikouho "Entries:") (off-msg "%s %s(%s:%s) turned off.") (henkan-help "Kanji conversion mode: Bunsetsu motion commands \\[wnn7-henkan-first-bunsetu]\tFirst bunsetsu\t\\[wnn7-henkan-last-bunsetu]\tLast bunsetsu \\[wnn7-henkan-backward-bunsetu]\tPrevious bunsetsu\t\\[wnn7-henkan-forward-bunsetu]\tNext bunsetsu Bunsetsu conversion commands \\[wnn7-henkan-next-kouho-dai]\tNext larger match\t\\[wnn7-henkan-next-kouho-sho]\tNext smaller match \\[wnn7-henkan-previous-kouho]\tPrevious match\t\\[wnn7-henkan-next-kouho]\tNext match \\[wnn7-henkan-bunsetu-nobasi-dai]\tExtend bunsetsu largest\t\\[wnn7-henkan-bunsetu-chijime-dai]\tShrink bunsetsu smallest \\[wnn7-henkan-bunsetu-nobasi-sho]\tExtend bunsetsu\t\\[wnn7-henkan-bunsetu-chijime-sho]\tShrink bunsetsu \\[wnn7-henkan-select-kouho-dai]\tMenu select largest match\t\\[wnn7-henkan-select-kouho-sho]\tMenu select smallest match Conversion commands \\[wnn7-henkan-kakutei]\tComplete conversion commit\t\\[wnn7-henkan-kakutei-before-point]\tCommit before point \\[wnn7-henkan-quit]\tAbort conversion ") (hinsimei "Hinshi (product/noun) name:") (jishotouroku-yomi "Dictionary entry for$B!X(B%s$B!Y(B reading:") (touroku-jishomei "Name of dictionary:" ) (registerd "Dictonary entry$B!X(B%s$B!Y(B(%s: %s) registered in %s.") (yomi "Reading$B!'(B") (no-yomi "No dictionary entry for $B!X(B%s$B!Y(B.") (jisho "Dictionary:") (hindo "Frequency:") (kanji "Kanji:") (no-predict "Not input-predict-mode.") (no-wnn7egg "Not wnn7egg.") (no-rensou "No association candidates.") (register-notify "Dictonary entry$B!X(B%s$B!Y(B(%s: %s) registered in %s.") (cannot-remove "Cannot delete entry from system dictionary.") (enter-hindo "Enter frequency:") (remove-notify "Dictonary entry$B!X(B%s$B!Y(B(%s) removed from %s.") (removed "Dictonary entry$B!X(B%s$B!Y(B(%s) removed from %s.") (pseud-bunsetsu "pseud clause") (jishomei "Dictionary name:" ) (comment "Comment:") (jisho-comment "Dictionary:%s: comment:%s") (param ("$B#N(B ( $BBg(B ) $BJ8@a2r@O$N#N(B" "$BBgJ8@aCf$N>.J8@a$N:GBg?t(B" "$B448l$NIQEY$N%Q%i%a!<%?(B" "$B>.J8@aD9$N%Q%i%a!<%?(B" "$B448lD9$N%Q%i%a!<%?(B" "$B:#;H$C$?$h%S%C%H$N%Q%i%a!<%?(B" "$B<-=q$N%Q%i%a!<%?(B" "$B>.J8@a$NI>2ACM$N%Q%i%a!<%?(B" "$BBgJ8@aD9$N%Q%i%a!<%?(B" "$B>.J8@a?t$N%Q%i%a!<%?(B" "$B5?;wIJ;l(B $B?t;z$NIQEY(B" "$B5?;wIJ;l(B $B%+%J$NIQEY(B" "$B5?;wIJ;l(B $B1Q?t$NIQEY(B" "$B5?;wIJ;l(B $B5-9f$NIQEY(B" "$B5?;wIJ;l(B $BJD3g8L$NIQEY(B" "$B5?;wIJ;l(B $BIUB08l$NIQEY(B" "$B5?;wIJ;l(B $B3+3g8L$NIQEY(B")) )) (japanese ((open-wnn "$B%[%9%H(B %s $B$N(B Wnn $B$r5/F0$7$^$7$?(B") (cannot-connect "Wnn $B$H@\B3$G$-$^$;$s$G$7$?(B") (no-rcfile "%s $B>e$K(B wnn7egg-startup-file $B$,$"$j$^$;$s!#(B") (file-saved "Wnn$B$NIQEY>pJs!&<-=q>pJs$rB`Hr$7$^$7$?!#(B") (no-dir "$B%G%#%l%/%H%j(B %s $B$,$"$j$^$;$s!#:n$j$^$9$+(B? ") (fail-dir "$B%G%#%l%/%H%j(B %s $B$N:n@.$K<:GT$7$^$7$?(B") (create-dir "$B%G%#%l%/%H%j(B %s $B$r:n$j$^$7$?(B") (no-dict1 "$B<-=q%U%!%$%k(B %s $B$,$"$j$^$;$s(B: %s") (no-dict2 "$B<-=q%U%!%$%k(B %s $B$,$"$j$^$;$s!#:n$j$^$9$+(B? ") (create-dict "$B<-=q%U%!%$%k(B %s $B$r:n$j$^$7$?(B") (no-freq1 "$BIQEY%U%!%$%k(B %s $B$,$"$j$^$;$s(B: %s") (no-freq2 "$BIQEY%U%!%$%k(B %s $B$,$"$j$^$;$s!#:n$j$^$9$+(B? ") (create-freq "$BIQEY%U%!%$%k(B %s $B$r:n$j$^$7$?(B") (no-match "$B<-=q$HIQEY(B %s $B$N@09g@-$,$"$j$^$;$s!#:n$jD>$7$^$9$+(B? ") (re-create-freq "$BIQEY%U%!%$%k(B %s $B$r:n$jD>$7$^$7$?(B") (henkan-mode-indicator "$B4A(B") (begin-henkan "$BJQ493+;OJ8;zNs(B: ") (end-henkan "$BJQ49=*N;J8;zNs(B: ") (kugiri-dai "$BBgJ8@a6h@Z$jJ8;zNs(B: ") (kugiri-sho "$B>.J8@a6h@Z$jJ8;zNs(B: ") (face-henkan "$BJQ496h4VI=<(B0@-(B: ") (face-dai "$BBgJ8@a6h4VI=<(B0@-(B: ") (face-sho "$B>.J8@a6h4VI=<(B0@-(B: ") (jikouho "$BA0J8@a(B\t\\[wnn7-henkan-forward-bunsetu]\t$BD>8eJ8@a(B $BJQ49JQ99(B \\[wnn7-henkan-next-kouho-dai]\t$BBgJ8@a.J8@a.J8@a?-$7(B\t\\[wnn7-henkan-bunsetu-chijime-sho]\t$B>.J8@a=L$a(B \\[wnn7-henkan-select-kouho-dai]\t$BBgJ8@aJQ498uJdA*Br(B\t\\[wnn7-henkan-select-kouho-sho]\t$B>.J8@aJQ498uJdA*Br(B $BJQ493NDj(B \\[wnn7-henkan-kakutei]\t$BA4J8@a3NDj(B\t\\[wnn7-henkan-kakutei-before-point]\t$BD>A0J8@a$^$G3NDj(B \\[wnn7-henkan-quit]\t$BJQ49Cf;_(B ") (hinsimei "$BIJ;lL>(B:") (jishotouroku-yomi "$B<-=qEPO?!X(B%s$B!Y(B $BFI$_(B :") (touroku-jishomei "$BEPO?<-=qL>(B:" ) (registerd "$B<-=q9`L\!X(B%s$B!Y(B(%s: %s)$B$r(B%s$B$KEPO?$7$^$7$?!#(B" ) (yomi "$B$h$_!'(B") (no-yomi "$B<-=q9`L\!X(B%s$B!Y$O$"$j$^$;$s!#(B") (jisho "$B<-=q!'(B") (hindo " $BIQEY!'(B") (kanji "$B4A;z!'(B") (no-predict "$BF~NOM=B,%b!<%I$G$O$"$j$^$;$s!#(B") (no-wnn7egg "$B;HMQCf$N(B input method $B$O(B wnn7egg $B$G$O$"$j$^$;$s(B") (no-rensou "$BO"A[8uJd$O$"$j$^$;$s!#(B") (register-notify "$B<-=q9`L\!X(B%s$B!Y(B(%s: %s)$B$r(B%s$B$KEPO?$7$^$9!#(B") (cannot-remove "$B%7%9%F%`<-=q9`L\$O:o=|$G$-$^$;$s!#(B") (enter-hindo "$BIQEY$rF~$l$F2<$5$$(B: ") (remove-notify "$B<-=q9`L\!X(B%s$B!Y(B(%s)$B$r(B%s$B$+$i:o=|$7$^$9!#(B") (removed "$B<-=q9`L\!X(B%s$B!Y(B(%s)$B$r(B%s$B$+$i:o=|$7$^$7$?!#(B") (pseud-bunsetsu "$B5?;wJ8@a(B") (jishomei "$B<-=qL>(B:" ) (comment "$B%3%a%s%H(B: ") (jisho-comment "$B<-=q(B:%s: $B%3%a%s%H(B:%s") (param ("$B#N(B ( $BBg(B ) $BJ8@a2r@O$N#N(B" "$BBgJ8@aCf$N>.J8@a$N:GBg?t(B" "$B448l$NIQEY$N%Q%i%a!<%?(B" "$B>.J8@aD9$N%Q%i%a!<%?(B" "$B448lD9$N%Q%i%a!<%?(B" "$B:#;H$C$?$h%S%C%H$N%Q%i%a!<%?(B" "$B<-=q$N%Q%i%a!<%?(B" "$B>.J8@a$NI>2ACM$N%Q%i%a!<%?(B" "$BBgJ8@aD9$N%Q%i%a!<%?(B" "$B>.J8@a?t$N%Q%i%a!<%?(B" "$B5?;wIJ;l(B $B?t;z$NIQEY(B" "$B5?;wIJ;l(B $B%+%J$NIQEY(B" "$B5?;wIJ;l(B $B1Q?t$NIQEY(B" "$B5?;wIJ;l(B $B5-9f$NIQEY(B" "$B5?;wIJ;l(B $BJD3g8L$NIQEY(B" "$B5?;wIJ;l(B $BIUB08l$NIQEY(B" "$B5?;wIJ;l(B $B3+3g8L$NIQEY(B")) )))) (defun wnn7-msg-get (message) (or (nth 1 (assoc message (nth 1 (assoc wnn7-message-type *wnn7-message-alist*)))) (format "No message. Check *wnn7-message-alist* %s %s" wnn7-message-type message))) ;;; ;;; secure compatibility with eggV4 translation engine ;;; (defcustom wnn-one-level-conversion nil "*Don't use major clause (dai bunsetu/da wenjie/dae munjeol), if non-NIL.") (defcustom wnn-uniq-level 'wnn-uniq "Uniq level for candidate selection. wnn-no-uniq: Use all candidates. wnn-uniq-entry: Use only one among same dictionary entry candidates. wnn-uniq: Use only one among same hinshi candidates. (default) wnn-uniq-kanji: Use only one among same kanji candidates.") (defcustom wnn-auto-save-dictionaries 0 "*Save dictionaries automatically after N-th end conversion, if positive") ;; Retern value of system-name may differ from hostname. (defconst wnn-system-name (or (with-temp-buffer (condition-case nil (call-process "hostname" nil `(,(current-buffer) nil) "hostname") (error)) (goto-char (point-min)) (if (re-search-forward "[\0- ]" nil 0) (goto-char (1- (point)))) (if (> (point) 1) (buffer-substring 1 (point)))) (system-name))) ;;; ;;; ;;; (defvar wnn7-process nil "Process Number to Wnn7 jserver") (defvar wnn7-server-default-port 22273) (defvar wnn7-server-proc-name "Wnn7") (defvar wnn7-server-buffer-name "*Wnn7*") (defvar wnn7-server-coding-system '(fixed-euc-jp fixed-euc-jp)) (defvar wnn7-active-server-name nil "connecting server host") (defvar wnn7-active-server-port nil "connecting server port") (defcustom wnn7-usr-dic-dir (concat "usr/" (user-login-name)) "*Directory of user dictionary for Wnn.") (defmacro WNN-const (c) (cond ((eq c 'BUN_SENTOU) -1) ((eq c 'NO_EXIST) 1) ((eq c 'NO_MATCH) 10) ((eq c 'IMA_OFF) -4) ((eq c 'IMA_ON) -3) ((eq c 'CONNECT) 1) ((eq c 'CONNECT_BK) 1) ((eq c 'HIRAGANA) -1) ((eq c 'KATAKANA) -11) ((eq c 'IKEIJI_ENTRY) -50) ((eq c 'LEARNING_LEN) 3) ((eq c 'MUHENKAN_DIC) -3) ((eq c 'HINDO_NOP) -2) ((eq c 'HINDO_INC) -3) ((eq c 'DIC_RW) 0) ((eq c 'DIC_RDONLY) 1) ((eq c 'DIC_GROUP) 3) ((eq c 'DIC_MERGE) 4) ((eq c 'NOTRANS_LEARN) 1) ((eq c 'BMODIFY_LEARN) 2) ((eq c 'WNN_REV_DICT) 3) ((eq c 'WNN_FI_SYSTEM_DICT) 6) ((eq c 'WNN_FI_USER_DICT) 7) ((eq c 'WNN_GROUP_DICT) 9) ((eq c 'WNN_MERGE_DICT) 10) ((eq c 'WNNDS_FILE_READ_ERROR) 90))) ;; ((eq c 'DIC_NO_TEMPS) ?\x3f))) ; cannot eval on xemacs ;; Retern value of system-name may differ from hostname. (defconst wnn-system-name (or (with-temp-buffer (condition-case nil (call-process "hostname" nil `(,(current-buffer) nil) "hostname") (error)) (goto-char (point-min)) (if (re-search-forward "[\0- ]" nil 0) (goto-char (1- (point)))) (if (> (point) 1) (buffer-substring 1 (point)))) (system-name))) ;;; ;;; environment information ;;; (defvar wnn7-env-norm nil "Normal Dic-search Environment for Wnn7 conversion server") (defvar wnn7-env-rev nil "Reverse Dic-search Environment for Wnn7 conversion server") (defvar env-normal t "Select translation mode to normal if t") (defun wnn7-env-create (proc env-id &optional name) (if name (set (setq name (make-symbol name)) (make-vector 5 nil))) (vector proc env-id name (make-vector 2 (WNN-const DIC_RDONLY)))) (defsubst wnn7env-get-proc (env) (aref env 0)) (defsubst wnn7env-get-env-id (env) (aref env 1)) (defsubst wnn7env-get-hinshi (env h) (or (get (aref env 2) h) -1)) (defsubst wnn7env-set-hinshi (env h v)(put (aref env 2) h v)) (defsubst wnn7env-get-auto-learn (env)(aref env 3)) (defsubst wnn7env-get-notrans (env) (aref (wnn7env-get-auto-learn env) 0)) (defsubst wnn7env-get-bmodify (env) (aref (wnn7env-get-auto-learn env) 1)) (defsubst wnn7env-set-notrans (env v) (aset (wnn7env-get-auto-learn env) 0 v)) (defsubst wnn7env-set-bmodify (env v) (aset (wnn7env-get-auto-learn env) 1 v)) (defun wnn7env-get-client-file (env name) (let ((hash (intern-soft name (symbol-value (aref env 2))))) (and hash (symbol-value hash)))) (defun wnn7env-set-client-file (env name) (set (intern (concat wnn-system-name "!" name) (symbol-value (aref env 2))) name)) (defun wnn7-set-hinshi (env sym name) (let ((hinshi (wnn7rpc-hinshi-number (wnn7env-get-proc env) name))) (if (>= hinshi 0) (wnn7env-set-hinshi env sym hinshi)))) ;;; ;;; client information & bunsetsu information ;;; ;;;* $BJ8@a%j%9%H!#JQ497k2L$r.J8@aC10L$N%j%9%H$K$J$C$F$$$k(B (defvar wnn7-bun-list nil "Bunsetsu infomation for Wnn7 conversion server") ;; ::= [ ;; ;; ;; ;; ;; ] ;; ;; ::= [ ] ;; (defsubst wnn7-bunsetsu-create (env jirilen dic-no entry freq right-now hinshi status status-backward kangovect evaluation) (vector env jirilen dic-no entry freq right-now hinshi status status-backward kangovect evaluation nil nil nil nil nil nil nil nil nil nil)) (defsubst wnn7-bunsetsu-get-env (b) (aref b 0)) (defsubst wnn7-bunsetsu-set-env (b env) (aset b 0 env)) (defsubst wnn7-bunsetsu-get-jirilen (b) (aref b 1)) (defsubst wnn7-bunsetsu-get-dic-no (b) (aref b 2)) (defsubst wnn7-bunsetsu-set-dic-no (b dic) (aset b 2 dic)) (defsubst wnn7-bunsetsu-get-entry (b) (aref b 3)) (defsubst wnn7-bunsetsu-set-entry (b ent) (aset b 3 ent)) (defsubst wnn7-bunsetsu-get-freq (b) (aref b 4)) (defsubst wnn7-bunsetsu-get-right-now (b) (aref b 5)) (defsubst wnn7-bunsetsu-get-hinshi (b) (aref b 6)) (defsubst wnn7-bunsetsu-get-status (b) (aref b 7)) (defsubst wnn7-bunsetsu-get-status-backward (b) (aref b 8)) (defsubst wnn7-bunsetsu-get-kangovect (b) (aref b 9)) (defsubst wnn7-bunsetsu-get-evaluation (b) (aref b 10)) (defsubst wnn7-bunsetsu-get-converted (b) (aref b 11)) (defsubst wnn7-bunsetsu-set-converted (b cvt) (aset b 11 cvt)) (defsubst wnn7-bunsetsu-get-yomi (b) (aref b 12)) (defsubst wnn7-bunsetsu-set-yomi (b yomi) (aset b 12 yomi)) (defsubst wnn7-bunsetsu-get-fuzokugo (b) (aref b 13)) (defsubst wnn7-bunsetsu-set-fuzokugo (b fuzokugo) (aset b 13 fuzokugo)) (defsubst wnn7-bunsetsu-get-dai-evaluation (b) (aref b 14)) (defsubst wnn7-bunsetsu-set-dai-evaluation (b de) (aset b 14 de)) (defsubst wnn7-bunsetsu-get-dai-continue (b) (aref b 15)) (defsubst wnn7-bunsetsu-set-dai-continue (b dc) (aset b 15 dc)) (defsubst wnn7-bunsetsu-get-change-top (b) (aref b 16)) (defsubst wnn7-bunsetsu-set-change-top (b top) (aset b 16 top)) (defsubst wnn7-bunsetsu-get-zenkouho (b) (aref b 17)) (defsubst wnn7-bunsetsu-set-zenkouho (b z) (aset b 17 z)) (defsubst wnn7-bunsetsu-get-freq-down (b) (aref b 18)) (defsubst wnn7-bunsetsu-set-freq-down (b fd) (aset b 18 fd)) (defsubst wnn7-bunsetsu-get-fi-rel (b) (aref b 19)) (defsubst wnn7-bunsetsu-set-fi-rel (b fr) (aset b 19 fr)) (defsubst wnn7-bunsetsu-get-context (b) (aref b 20)) (defsubst wnn7-bunsetsu-set-context (b c) (aset b 20 c)) (defsubst wnn7-zenkouho-create (pos list converted dai prev-b next-b) (vector pos list converted dai prev-b next-b)) (defsubst wnn7-bunsetsu-get-zenkouho-pos (b) (aref (wnn7-bunsetsu-get-zenkouho b) 0)) (defsubst wnn7-bunsetsu-set-zenkouho-pos (b p) (aset (wnn7-bunsetsu-get-zenkouho b) 0 p)) (defsubst wnn7-bunsetsu-get-zenkouho-list (b) (aref (wnn7-bunsetsu-get-zenkouho b) 1)) (defsubst wnn7-bunsetsu-get-zenkouho-converted (b) (aref (wnn7-bunsetsu-get-zenkouho b) 2)) (defsubst wnn7-bunsetsu-get-zenkouho-dai (b) (aref (wnn7-bunsetsu-get-zenkouho b) 3)) (defsubst wnn7-bunsetsu-get-zenkouho-prev-b (b) (aref (wnn7-bunsetsu-get-zenkouho b) 4)) (defsubst wnn7-bunsetsu-get-zenkouho-next-b (b) (aref (wnn7-bunsetsu-get-zenkouho b) 5)) (defsubst wnn7-bunsetsu-connect-prev (bunsetsu) (= (wnn7-bunsetsu-get-status bunsetsu) (WNN-const CONNECT))) (defsubst wnn7-bunsetsu-connect-next (bunsetsu) (= (wnn7-bunsetsu-get-status-backward bunsetsu) (WNN-const CONNECT_BK))) (defsubst wnn7-context-create (dic-no entry jirilen hinshi fuzokugo converted freq right-now) (vector dic-no entry jirilen hinshi fuzokugo converted freq right-now (egg-chars-in-period converted 0 (length converted)))) (defsubst wnn7-context-dic-no (context) (aref context 0)) (defsubst wnn7-context-entry (context) (aref context 1)) (defsubst wnn7-context-jirilen (context) (aref context 2)) (defsubst wnn7-context-hinshi (context) (aref context 3)) (defsubst wnn7-context-fuzokugo (context) (aref context 4)) (defsubst wnn7-context-converted (context) (aref context 5)) (defsubst wnn7-context-freq (context) (aref context 6)) (defsubst wnn7-context-set-freq (context f) (aset context 6 f)) (defsubst wnn7-context-right-now (context) (aref context 7)) (defsubst wnn7-context-set-right-now (context r) (aset context 7 r)) (defsubst wnn7-context-length (context) (aref context 8)) (defun wnn7-null-context () (list (wnn7-context-create -2 0 0 0 "" "" 0 0) (wnn7-context-create -2 0 0 0 "" "" 0 0))) (defun wnn7-get-bunsetsu-converted (bunsetsu) (concat (wnn7-bunsetsu-get-converted bunsetsu) (wnn7-bunsetsu-get-fuzokugo bunsetsu))) (defun wnn7-get-bunsetsu-source (bunsetsu) (concat (wnn7-bunsetsu-get-yomi bunsetsu) (wnn7-bunsetsu-get-fuzokugo bunsetsu))) (defun wnn7-get-major-bunsetsu-converted (bunsetsu) (mapconcat 'wnn7-get-bunsetsu-converted bunsetsu "")) (defun wnn7-get-major-bunsetsu-source (bunsetsu) (mapconcat 'wnn7-get-bunsetsu-source bunsetsu "")) (defun wnn7-major-bunsetsu-set-context (bunsetsu-list context) (while bunsetsu-list (wnn7-bunsetsu-set-context (car bunsetsu-list) context) (setq bunsetsu-list (cdr bunsetsu-list)))) (defsubst wnn7-bunsetsu-equal (bunsetsu-1 bunsetsu-2) (and (= (wnn7-bunsetsu-get-dic-no bunsetsu-1) (wnn7-bunsetsu-get-dic-no bunsetsu-2)) (= (wnn7-bunsetsu-get-entry bunsetsu-1) (wnn7-bunsetsu-get-entry bunsetsu-2)) (= (wnn7-bunsetsu-get-kangovect bunsetsu-1) (wnn7-bunsetsu-get-kangovect bunsetsu-2)) (equal (wnn7-bunsetsu-get-converted bunsetsu-1) (wnn7-bunsetsu-get-converted bunsetsu-2)) (equal (wnn7-bunsetsu-get-fuzokugo bunsetsu-1) (wnn7-bunsetsu-get-fuzokugo bunsetsu-2)))) (defun wnn7-bunsetsu-list-equal (b1 b2) (while (and b1 b2 (wnn7-bunsetsu-equal (car b1) (car b2))) (setq b1 (cdr b1) b2 (cdr b2))) (and (null b1) (null b2))) (defun wnn7-bunsetsu-list-copy (bunsetsu) (copy-sequence bunsetsu)) (defmacro wnn7-uniq-hash-string (uniq-level) `(mapconcat (lambda (b) (concat ,@(cond ((eq uniq-level 'wnn-uniq) '((number-to-string (wnn7-bunsetsu-get-hinshi b)))) ((eq uniq-level 'wnn-uniq-entry) '((number-to-string (wnn7-bunsetsu-get-dic-no b)) "+" (number-to-string (wnn7-bunsetsu-get-entry b))))) "\0" (wnn7-bunsetsu-get-converted b) "\0" (wnn7-bunsetsu-get-fuzokugo b))) bunsetsu "\0")) (defun wnn7-uniq-hash (bunsetsu hash-table) (intern (cond ((eq wnn-uniq-level 'wnn-uniq) (wnn7-uniq-hash-string wnn-uniq)) ((eq wnn-uniq-level 'wnn-uniq-entry) (wnn7-uniq-hash-string wnn-uniq-entry)) (t (wnn7-uniq-hash-string nil))) hash-table)) (defun wnn7-uniq-candidates (candidates) (if (eq wnn-uniq-level 'wnn-no-uniq) candidates (let ((hash-table (make-vector (length candidates) 0))) (delq nil (mapcar (lambda (b) (let ((sym (wnn7-uniq-hash b hash-table))) (if (null (boundp sym)) (set sym b)))) candidates))))) (defun wnn7-server-zenkouho-bun-p (bunno) (let ((bunsetsu (nth bunno wnn7-bun-list))) (if (vectorp (wnn7-bunsetsu-get-zenkouho bunsetsu)) t nil))) (defun wnn7-get-major-bunsetsu (bunno) "get major bunsetsu of bunno position." (let ((bun (nth bunno wnn7-bun-list)) bunsetsu) (while bun (setq bunsetsu (cons bun bunsetsu) bunno (1+ bunno) bun (and (wnn7-bunsetsu-get-dai-continue bun) (nth bunno wnn7-bun-list)))) (nreverse bunsetsu))) (defun wnn7-get-minor-bunsetsu (bunno) "get minor bunsetsu of bunno positon." (list (nth bunno wnn7-bun-list))) (defun wnn7-get-next-major-bunsetsu (bunno) "get all the major bunsetsu after bunno position." (let* ((bun1 (nth bunno wnn7-bun-list)) (bunno (1+ bunno)) (bun2 (nth bunno wnn7-bun-list)) bunsetsu) (while (and bun1 bun2) (if (null (wnn7-bunsetsu-get-dai-continue bun1)) (while bun2 (setq bunsetsu (cons bun2 bunsetsu) bunno (1+ bunno) bun2 (nth bunno wnn7-bun-list))) (setq bun1 (nth bunno wnn7-bun-list) bunno (1+ bunno) bun2 (nth bunno wnn7-bun-list)))) (nreverse bunsetsu))) (defun wnn7-get-pre-prev-bunsetsu (bunno) "get all bunsetsu before bunno position." (let (bunsetsu) (while (<= 0 bunno) (setq bunsetsu (cons (nth bunno wnn7-bun-list) bunsetsu) bunno (1- bunno))) bunsetsu)) (defun wnn7-get-prev-major-bunsetsu (bunno) "get part of major bunsetsu before bunno position." (let* ((bunno (1- bunno)) (bun (if (< bunno 0) nil (nth bunno wnn7-bun-list))) bunsetsu) (while bun (setq bunsetsu (cons bun bunsetsu) bunno (1- bunno)) (if (< bunno 0) (setq bun nil) (setq bun (nth bunno wnn7-bun-list)) (if (null (wnn7-bunsetsu-get-dai-continue bun)) (setq bun nil)))) (cons bunsetsu (1+ bunno)))) (defun wnn7-get-prev-minor-bunsetsu (bunno) "get minor bunsetsu before bunno position." (let ((bunno (1- bunno))) (if (< bunno 0) nil (list (nth bunno wnn7-bun-list))))) ;;; ;;; dictionary file information ;;; (defsubst wnn7dic-get-id (dic) (aref dic 0)) (defsubst wnn7dic-get-comment (dic) (aref dic 8)) (defsubst wnn7dic-get-dictname (dic) (aref dic 9)) (defsubst wnn7-dicinfo-entry (info) (aref info 0)) (defsubst wnn7-dicinfo-id (info freq) (aref info (+ 1 freq))) (defsubst wnn7-dicinfo-mode (info freq) (aref info (+ 3 freq))) (defsubst wnn7-dicinfo-enable (info) (aref info 5)) (defsubst wnn7-dicinfo-nice (info) (aref info 6)) (defsubst wnn7-dicinfo-reverse (info) (aref info 7)) (defsubst wnn7-dicinfo-comment (info) (aref info 8)) (defsubst wnn7-dicinfo-name (info freq) (aref info (+ 9 freq))) (defsubst wnn7-dicinfo-passwd (info freq) (aref info (+ 11 freq))) (defsubst wnn7-dicinfo-type (info) (aref info 13)) (defsubst wnn7-dicinfo-words (info) (aref info 14)) (defsubst wnn7-dicinfo-local (info freq) (aref info (+ 15 freq))) (defsubst wnn7-filename (p) (substitute-in-file-name (if (consp p) (concat wnn7-usr-dic-dir "/" (car p)) p))) (defsubst wnn7-client-file-p (filename) (and (stringp filename) (= (aref filename 0) ?!))) (defsubst wnn7-client-filename (filename) (substitute-in-file-name (expand-file-name (substring filename 1) "~"))) ;;;----------------------------------------------------------------------- ;;; ;;; open, connect, close ;;; (defun wnn7-comm-sentinel (proc reason) (let ((inhibit-quit t)) (if (string= (process-status proc) "closed") (kill-buffer (process-buffer proc)) (progn (delete-process proc) (kill-buffer (process-buffer proc)))))) (defun wnn7-server-start (hname) (let ((save-inhibit-quit inhibit-quit) (inhibit-quit t) (proc nil) buf msg) (unwind-protect (progn (setq buf (generate-new-buffer wnn7-server-buffer-name)) (save-excursion (set-buffer buf) (erase-buffer) (buffer-disable-undo) (set-buffer-multibyte nil) (setq egg-fixed-euc wnn7-server-coding-system)) (setq msg (format "Wnn: connecting to jserver at %s(%d)..." hname wnn7-active-server-port)) (message "%s" msg) (let ((inhibit-quit save-inhibit-quit)) (condition-case nil (setq proc (open-network-stream wnn7-server-proc-name buf hname wnn7-active-server-port)) ((error quit)))) (when proc (process-kill-without-query proc) (if (featurep 'xemacs) (set-process-coding-system proc 'binary 'binary) (set-process-coding-system proc 'no-conversion 'no-conversion)) (set-process-sentinel proc 'wnn7-comm-sentinel) (set-marker-insertion-type (process-mark proc) t)) proc) (if proc (message (concat msg "done")) (if buf (kill-buffer buf)) (setq proc nil))))) (defun wnn7-server-open (proc hname lname) (let ((result (wnn7rpc-open proc hname lname))) (when (/= 0 result) (delete-process wnn7-process) (kill-buffer (process-buffer proc)) (setq wnn7-process nil)) result)) (defun wnn7-server-connect (proc lname &optional rev) (let ((envid (wnn7rpc-connect proc lname)) (env nil)) (if (< envid 0) (progn (egg:error "%s" (wnn7rpc-get-error-message (- envid))) envid) (setq env (wnn7-env-create proc envid lname)) (wnn7-set-hinshi env 'noun "$BL>;l(B") (wnn7-set-hinshi env 'settou "$B@\F,8l(B($B$*(B)") (wnn7-set-hinshi env 'rendaku "$BO"By(B") (if rev (setq wnn7-env-rev env) (setq wnn7-env-norm env)) envid))) (defun wnn7-server-isconnect () (let ((status)) (if (and wnn7-process (setq status (process-status wnn7-process))) (if (or (equal 'open status) (equal 'run status)) t nil) nil))) (defun wnn7-server-close () "Close the connection to jserver, Dictionary and frequency files are not saved." (if wnn7-env-norm (wnn7rpc-disconnect wnn7-env-norm)) (if wnn7-env-rev (wnn7rpc-disconnect wnn7-env-rev)) (if (wnn7-server-isconnect) (wnn7rpc-close wnn7-process)) (delete-process wnn7-process) (kill-buffer (process-buffer wnn7-process)) (setq wnn7-process nil wnn7-env-norm nil wnn7-env-rev nil wnn7-bun-list nil)) (defun wnn7-server-set-rev (rev) (if (null rev) (progn ;;(wnn7-bunsetsu-set-env wnn7-buf wnn7-env-norm) (setq env-normal t)) ;;(wnn7-bunsetsu-set-env wnn7-buf wnn7-env-rev) (setq env-normal nil))) ;;; ;;; ;;; dictionary & hinshi ;;; ;;; (defun wnn7-server-hinsi-name (no) (wnn7rpc-hinshi-name wnn7-process no)) (defun wnn7-server-dict-list () (let ((env (if env-normal wnn7-env-norm wnn7-env-rev))) (wnn7-get-dictionary-list-with-environment env))) (defun wnn7-get-dictionary-list-with-environment (env) (wnn7rpc-get-fi-dictionary-list-with-environment env wnn7-dic-no-temps)) (defun wnn7-server-dict-comment (env dicno comment) (let (dinfo fid) (setq dinfo (wnn7rpc-get-dictionary-info env dicno)) (setq fid (wnn7-dicinfo-id dinfo 0)) (wnn7rpc-set-file-comment env fid comment))) (defun wnn7-file-loaded-client (env name fid) (let ((len (length wnn-system-name)) local-name) (and (> (length name) len) (equal (substring name 0 len) wnn-system-name) (prog1 (wnn7-client-file-p (substring name len)) (setq local-name (wnn7-client-filename (substring name len)))) (= (wnn7rpc-file-loaded-local (wnn7env-get-proc env) local-name t) fid) local-name))) (defun wnn7-server-dict-save () "Save all dictionaries and frequency files." (let* ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (dic-list (wnn7-get-dictionary-list-with-environment env)) info freq fid name local-name) (while dic-list (setq info (car dic-list) dic-list (cdr dic-list) freq 0) (while (<= freq 1) (setq fid (wnn7-dicinfo-id info freq) name (wnn7-dicinfo-name info freq)) (if (and (> fid 0) (= (wnn7-dicinfo-mode info freq) 0)) (cond ((= (wnn7-dicinfo-local info freq) 1) (wnn7rpc-write-file env fid name)) ((setq local-name (wnn7env-get-client-file env name)) (wnn7rpc-file-receive env fid local-name)) ((and (setq local-name (wnn7-file-loaded-client env name fid)) (file-writable-p local-name)) (wnn7rpc-file-receive env fid local-name)))) (setq freq (1+ freq)))))) (defun wnn7-server-inspect (bunno) (let* ((bunsetsu (nth bunno wnn7-bun-list)) (env (wnn7-bunsetsu-get-env bunsetsu)) (converted (wnn7-get-bunsetsu-converted bunsetsu)) (yomi (wnn7-bunsetsu-get-yomi bunsetsu)) (fuzokugo (wnn7-bunsetsu-get-fuzokugo bunsetsu)) (hinshi-no (wnn7-bunsetsu-get-hinshi bunsetsu)) (dic-no (wnn7-bunsetsu-get-dic-no bunsetsu)) (entry (wnn7-bunsetsu-get-entry bunsetsu)) (now (wnn7-bunsetsu-get-right-now bunsetsu)) (freq (wnn7-bunsetsu-get-freq bunsetsu)) (evaluation (wnn7-bunsetsu-get-evaluation bunsetsu)) (evaluation-dai (or (wnn7-bunsetsu-get-dai-evaluation bunsetsu) "---")) (kangovect (wnn7-bunsetsu-get-kangovect bunsetsu)) hinshi dic) (setq hinshi (wnn7rpc-hinshi-name (wnn7env-get-proc env) hinshi-no)) (setq dic (if (>= dic-no 0) (wnn7-dict-name (car (wnn7rpc-get-dictionary-info env dic-no))) (wnn7-msg-get 'pseud-bunsetsu))) (format "%s %s+%s(%s %s:%s Freq:%s%s) S:%s D:%s V:%s " converted yomi fuzokugo hinshi dic entry (if (= now 1) "*" " ") freq evaluation evaluation-dai kangovect))) (defun wnn7-dict-name (dic-info) (let ((comment (wnn7dic-get-comment dic-info)) (name (wnn7dic-get-dictname dic-info))) (cond ((null (string= comment "")) comment) ((wnn7-client-file-p name) name) (t (file-name-nondirectory name))))) ;;; ;;; ;;; dictionary file operation ;;; ;;; (defun wnn7-server-fisys-dict-add (dname fname frw &optional fpass) (wnn7-server-dict-add-body t dname fname t nil frw nil fpass)) (defun wnn7-server-fiusr-dict-add (dname fname drw frw &optional dpass fpass) (wnn7-server-dict-add-body t dname fname nil drw frw dpass fpass)) (defun wnn7-server-dict-add (dname fname prior drw frw &optional dpass fpass) (wnn7-server-dict-add-body nil dname fname prior drw frw dpass fpass)) (defun wnn7-server-dict-add-body (fi dname fname prior drw frw dpass fpass) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (rev (if env-normal nil t)) did fid result) (if (equal dname "") (setq dname nil)) (if (equal fname "") (setq fname nil)) (cond ((numberp (setq dpass (wnn7rpc-read-passwd-file dpass))) (message "%s" (wnn7rpc-get-error-message (- dpass))) nil) ((numberp (setq fpass (if fname (wnn7rpc-read-passwd-file fpass) ""))) (message "%s" (wnn7rpc-get-error-message (- fpass))) nil) ((and (setq did (wnn7-open-dictionary env fi dname drw "" dpass fpass)) (setq fid (wnn7-open-frequency env fi did fname frw "" fpass))) (if fi (setq result (wnn7rpc-set-fi-dictionary env did fid prior drw frw dpass fpass)) (setq drw (cond ((eq drw (WNN-const DIC_GROUP)) (WNN-const DIC_RW)) ((eq drw (WNN-const DIC_MERGE)) (WNN-const DIC_RDONLY)) (t drw)) result (wnn7rpc-set-dictionary env did fid prior drw frw dpass fpass rev))) (cond ((>= result 0) t) ((or (null frw) (/= result (- (WNN-const NO_MATCH)))) (message "%s (%s): %s" dname (if fname fname "") (wnn7rpc-get-error-message (- result))) nil) ((and (y-or-n-p (format (wnn7-msg-get 'no-match) fname)) (>= (wnn7rpc-file-discard env fid) 0) (wnn7-file-remove wnn7-process fname fpass) (wnn7-create-frequency env fi did fname "" fpass)) (message (wnn7-msg-get 're-create-freq) fname) (if fi (setq prior (if prior (wnn-const WNN_FI_SYSTEM_DICT) (wnn-const WNN_FI_USER_DICT)))) (and (>= (setq fid (wnn7-open-file env fname)) 0) (>= (wnn7rpc-set-dictionary env did fid prior drw frw dpass fpass rev) 0)))))))) (defun wnn7-file-remove (proc filename passwd) (let ((result (if (wnn7-client-file-p filename) (wnn7rpc-file-remove-client proc (wnn7-client-filename filename) passwd) (wnn7rpc-file-remove proc (wnn7-filename filename) passwd)))) (or (= result 0) (progn (message (wnn7rpc-get-error-message (- result))) nil)))) (defun wnn7-get-autolearning-dic-mode (env type) (let* ((dic (wnn7rpc-get-autolearning-dic env type)) (info (and (> dic 0) (wnn7rpc-get-dictionary-info env (1- dic))))) (if (vectorp (car-safe info)) (wnn7-dicinfo-mode (car info) 0) (WNN-const DIC_RDONLY)))) (defun wnn7-server-bmodify-dict-add (dname prior drw &optional dpass) (let* ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (type (WNN-const BMODIFY_LEARN)) (did (wnn7rpc-get-autolearning-dic env type)) (param-list (wnn7-make-henkan-parameter)) (name 'bunsetsugiri) mode vmask) (setq mode (wnn7-server-autolearn-dic-add type did dname prior drw dpass)) (when mode (setq vmask (lsh 1 14)) (aset param-list 14 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list)) (wnn7env-set-bmodify env (wnn7-get-autolearning-dic-mode env (WNN-const BMODIFY_LEARN))))) (defun wnn7-server-notrans-dict-add (dname prior drw &optional dpass) (let* ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (type (WNN-const NOTRANS_LEARN)) (did (wnn7rpc-get-autolearning-dic env type)) (param-list (wnn7-make-henkan-parameter)) (name 'muhenkan) mode vmask) (setq mode (wnn7-server-autolearn-dic-add type did dname prior drw dpass)) (when mode (setq vmask (lsh 1 15)) (aset param-list 15 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list)) (wnn7env-set-notrans env (wnn7-get-autolearning-dic-mode env (WNN-const NOTRANS_LEARN))))) (defun wnn7-temporary-dic-add (env rev) (let ((result (wnn7rpc-temporary-dic-loaded env))) (if (= result 0) (wnn7rpc-temporary-dic-add env rev) result))) (defun wnn7-server-autolearn-dic-add (type did dname prior drw dpass) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (rev (if env-normal nil t)) result) (or (numberp drw) (setq drw (if drw 0 1))) (cond ((< did 0) (message "%s" (wnn7rpc-get-error-message (- did))) nil) ((> did 0) (setq result (wnn7-temporary-dic-add env rev)) (if (>= result 0) drw (message "%s" (wnn7rpc-get-error-message (- result))) nil)) ((numberp (setq dpass (wnn7rpc-read-passwd-file dpass))) (message "%s" (wnn7rpc-get-error-message (- dpass))) nil) ((setq did (wnn7-open-dictionary env nil dname t "" dpass "" nil)) (if (and (>= (setq did (wnn7rpc-set-dictionary env did -1 prior drw drw dpass "" rev)) 0) (>= (setq did (wnn7rpc-set-autolearning-dic env type did)) 0) (>= (setq did (wnn7-temporary-dic-add env rev)) 0)) drw (message "%s" (wnn7rpc-get-error-message (- did))) nil))))) (defun wnn7-server-fuzokugo-set (file) (let* ((env (if env-normal wnn7-env-norm wnn7-env-rev)) fid result) (setq fid (wnn7-open-file env file)) (setq result (wnn7rpc-set-fuzokugo-file env fid)) (if (< result 0) (message "%s" (wnn7rpc-get-error-message (- result)))) result)) ;;; ;;; ;;; parameter operation ;;; ;;; ;; henkan-parameter ::=[ ;; ;; ;; ;; ;; ;; ;; (defun wnn7-make-henkan-parameter () (make-vector 24 0)) (defmacro wnn7-make-henkan-parameter-list () ''(last-is-first complex okuri-learn okuri prefix-learn prefix suffix-learn common-learn freq-func numeric alphabet symbol yuragi rendaku bunsetsugiri muhenkan fi-relation-learn fi-freq-func)) (defun wnn7-server-get-param () (let ((env (if env-normal wnn7-env-norm wnn7-env-rev))) (wnn7rpc-get-conversion-parameter env))) (defun wnn7-server-set-param (v) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev))) (wnn7rpc-set-conversion-parameter env v))) (defun wnn7-server-set-last-is-first (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'last-is-first) vmask) (setq vmask (lsh 1 0)) (aset param-list 0 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-complex-conv-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'complex) vmask) (setq vmask (lsh 1 1)) (aset param-list 1 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-okuri-learn-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'okuri-learn) vmask) (setq vmask (lsh 1 2)) (aset param-list 2 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-okuri-flag (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'okuri) vmask) (setq vmask (lsh 1 3)) (aset param-list 3 (cond ((or (eq mode -1) (eq mode 'regulation)) -1) ((or (eq mode 0) (eq mode 'no)) 0) ((or (eq mode 1) (eq mode 'yes)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-prefix-learn-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'prefix-learn) vmask) (setq vmask (lsh 1 4)) (aset param-list 4 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-prefix-flag (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'prefix) vmask) (setq vmask (lsh 1 5)) (aset param-list 5 (cond ((or (eq mode 0) (eq mode 'hiragana)) 0) ((or (eq mode 1) (eq mode 'kanji)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-suffix-learn-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'suffix-learn) vmask) (setq vmask (lsh 1 6)) (aset param-list 6 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-common-learn-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'common-learn) vmask) (setq vmask (lsh 1 7)) (aset param-list 7 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-freq-func-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'freq-func) vmask) (setq vmask (lsh 1 8)) (aset param-list 8 (cond ((or (eq mode 0) (eq mode 'not)) 0) ((or (eq mode 1) (eq mode 'always)) 1) ((or (eq mode 2) (eq mode 'high)) 2) ((or (eq mode 3) (eq mode 'normal)) 3) ((or (eq mode 4) (eq mode 'low)) 4) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-numeric-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'numeric) vmask) (setq vmask (lsh 1 9)) (aset param-list 9 (cond ((or (eq mode -2) (eq mode 'han)) -2) ((or (eq mode -12) (eq mode 'zen)) -12) ((or (eq mode -13) (eq mode 'kan)) -13) ((or (eq mode -15) (eq mode 'kansuuji)) -15) ((or (eq mode -16) (eq mode 'kanold)) -16) ((or (eq mode -17) (eq mode 'hancan)) -17) ((or (eq mode -18) (eq mode 'zencan)) -18) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-alphabet-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'alphabet) vmask) (setq vmask (lsh 1 10)) (aset param-list 10 (cond ((or (eq mode -4) (eq mode 'han)) -4) ((or (eq mode -30) (eq mode 'zen)) -30) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-symbol-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'symbol) vmask) (setq vmask (lsh 1 11)) (aset param-list 11 (cond ((or (eq mode -5) (eq mode 'han)) -5) ((or (eq mode -40) (eq mode 'jis)) -40) ((or (eq mode -41) (eq mode 'asc)) -41) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-yuragi-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'yuragi) vmask) (setq vmask (lsh 1 12)) (aset param-list 12 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-rendaku-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'rendaku) vmask) (setq vmask (lsh 1 13)) (aset param-list 13 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-yosoku-learn-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'yosoku-learn) vmask) (setq vmask (lsh 1 22)) (aset param-list 18 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-yosoku-max-disp (max) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'yosoku-max-disp) vmask) (setq vmask (lsh 1 23)) (aset param-list 19 (cond ((and (<= max 10) (>= max 1) max)) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-yosoku-last-is-first-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'yosoku-last-is-first) vmask) (setq vmask (lsh 1 24)) (aset param-list 20 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-boin-kabusoku (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'wnn7-set-boin-kabusoku) vmask) (setq vmask (lsh 1 26)) (aset param-list 21 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-shiin-choka (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'wnn7-set-shiin-choka) vmask) (setq vmask (lsh 1 27)) (aset param-list 22 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-n-choka (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'wnn7-set-n-choka) vmaskh vmaskl) (setq vmaskh (lsh 1 12)) (setq vmaskl 0) (aset param-list 23 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param-highbit env vmaskh vmaskl param-list))) (defconst HINSHI_NO_ATEJI 114) (defconst HINSHI_NO_GOYOU 115) (defconst HINSHI_NO_ATEJI_START 64946) (defconst HINSHI_NO_ATEJI_END 64965) (defconst HINSHI_NO_GOYOU_START 64925) (defconst HINSHI_NO_GOYOU_END 64945) (defun wnn7-server-set-nihongo-kosei (mode) "" (unless mode (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (hlist nil) hend nhinshi) (setq hend HINSHI_NO_ATEJI_END) (setq hlist nil) (while (>= hend HINSHI_NO_ATEJI_START) (setq hlist (cons hend hlist) hend (1- hend))) (setq hlist (cons HINSHI_NO_ATEJI hlist)) (setq hlist (append hlist '(0))) (setq nhinshi (length hlist) nhinshi (- nhinshi)) (wnn7rpc-set-henkan-hinshi env 1 nhinshi hlist) (setq hend HINSHI_NO_GOYOU_END) (setq hlist nil) (while (>= hend HINSHI_NO_GOYOU_START) (setq hlist (cons hend hlist) hend (1- hend))) (setq hlist (cons HINSHI_NO_GOYOU hlist)) (setq hlist (append hlist '(0))) (setq nhinshi (length hlist) nhinshi (- nhinshi)) (wnn7rpc-set-henkan-hinshi env 1 nhinshi hlist))) 0) ;;; ;;; ;;; file operation ;;; ;;; (defun wnn7-open-file (env filename) "Open the file FILENAME on the environment ENV. Return file ID. NIL means NO-file. On failure, return negative error code." (and filename (if (wnn7-client-file-p filename) (wnn7rpc-file-send env (wnn7-client-filename filename)) (wnn7rpc-file-read env (wnn7-filename filename))))) (defun wnn7-create-directory (env path noquery) "Create directory to the path. Retun non-NIL value on success." (if (wnn7-client-file-p path) (let ((local-name (directory-file-name (file-name-directory (wnn7-client-filename path))))) (cond ((file-directory-p local-name) t) ((or noquery (y-or-n-p (format (wnn7-msg-get 'no-dir) (file-name-directory path)))) (make-directory local-name t) ;; server $BB&$N%G%#%l%/%H%j$b:n@.$7$F$*$/(B (wnn7-create-directory env (concat wnn7-usr-dic-dir "/foo") t) (if (file-directory-p local-name) (progn (message (wnn7-msg-get 'create-dir) path) t) (message (wnn7-msg-get 'fail-dir) path) nil)))) (let ((name (directory-file-name (file-name-directory (wnn7-filename path)))) create-list) (setq path name) (while (and name (/= (wnn7rpc-access env name 0) 0)) (setq create-list (cons name create-list) name (file-name-directory name) name (and name (directory-file-name name)))) (or (null create-list) (if (or noquery (y-or-n-p (format (wnn7-msg-get 'no-dir) path))) (let ((result 0)) (while (and (>= result 0) create-list) (setq result (wnn7rpc-mkdir env (car create-list)) create-list (cdr create-list))) (if (>= result 0) (progn (message (wnn7-msg-get 'create-dir) path) t) (message (wnn7-msg-get 'fail-dir) path) nil))))))) (defun wnn7-open-dictionary (env fi name rw comment dpasswd fpasswd &optional noquery) (let ((dic-id (wnn7-open-file env name))) (cond ((null dic-id) (message "Wnn: cannot omit dictionary name") nil) ((>= dic-id 0) dic-id) ((or (null rw) (and (/= dic-id (- (WNN-const NO_EXIST))) (/= dic-id (- (WNN-const WNNDS_FILE_READ_ERROR))))) (message (wnn7-msg-get 'no-dict1) name (wnn7rpc-get-error-message (- dic-id))) nil) ((and (or noquery (y-or-n-p (format (wnn7-msg-get 'no-dict2) name))) (wnn7-create-directory env name noquery) (wnn7-create-dictionary env name (wnn7rpc-writable-dic-type env fi rw) comment dpasswd fpasswd)) (message (wnn7-msg-get 'create-dict) name) (setq dic-id (wnn7-open-file env name)) (if (>= dic-id 0) dic-id (message "%s" (wnn7rpc-get-error-message (- dic-id))) nil))))) (defun wnn7-create-dictionary (env name type comment dpasswd fpasswd) "Create a dictionary file on the server or the client depending on name." (let ((result (if (wnn7-client-file-p name) (wnn7rpc-dic-file-create-client env (wnn7-client-filename name) type comment dpasswd fpasswd) (wnn7rpc-dic-file-create env (wnn7-filename name) type comment dpasswd fpasswd)))) (or (= result 0) (progn (message (wnn7rpc-get-error-message (- result))) nil)))) (defun wnn7-open-frequency (env fi dic-id name rw comment passwd) (let ((freq-id (wnn7-open-file env name))) (cond ((null freq-id) -1) ((>= freq-id 0) freq-id) ((or (null rw) (and (/= freq-id (- (WNN-const NO_EXIST))) (/= freq-id (- (WNN-const WNNDS_FILE_READ_ERROR))))) (message (wnn7-msg-get 'no-freq1) name (wnn7rpc-get-error-message (- freq-id))) nil) ((and (y-or-n-p (format (wnn7-msg-get 'no-freq2) name)) (wnn7-create-directory env name nil) (wnn7-create-frequency env fi dic-id name comment passwd)) (message (wnn7-msg-get 'create-freq) name) (setq freq-id (wnn7-open-file env name)) (if (>= freq-id 0) freq-id (message "%s" (wnn7rpc-get-error-message (- freq-id))) nil))))) (defun wnn7-create-frequency (env fi dic-id name comment passwd) "Create a frequency file on the server or the client depending on name." (let ((result (if (wnn7-client-file-p name) (wnn7rpc-hindo-file-create-client env fi dic-id (wnn7-client-filename name) comment passwd) (wnn7rpc-hindo-file-create env fi dic-id (wnn7-filename name) comment passwd)))) (or (= result 0) (progn (message (wnn7rpc-get-error-message (- result))) nil)))) ;;; ;;; henkan ;;; (defun wnn7-server-henkan-begin (yomi) ;; bun_no = 0, bun_no2 = -1, USE_MAE (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (hinshi (WNN-const BUN_SENTOU)) (fuzokugo "") (v nil) result context) (setq context (wnn7-null-context) result (wnn7-renbunsetsu-conversion env yomi hinshi fuzokugo v context)) (if (numberp result) (progn (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil) (if wnn-one-level-conversion (while (consp result) (wnn7-bunsetsu-set-dai-continue (car result) nil) (setq result (cdr result)))) (setq wnn7-bun-list result) (setq result (cons (length result) result))))) (defun wnn7-server-bunsetu-kanji (bunno) (let* ((bunsetsu (nth bunno wnn7-bun-list)) (kanji (wnn7-get-bunsetsu-converted bunsetsu))) kanji)) (defun wnn7-server-bunsetu-yomi (bunno) (let* ((bunsetsu (nth bunno wnn7-bun-list)) (yomi (wnn7-get-bunsetsu-source bunsetsu))) yomi)) (defun wnn7-server-dai-top (bunno) "$BJ8@a$,BgJ8@a$N@hF,$J$i(B t" (let ((bun1 (nth bunno wnn7-bun-list)) bun2) (if (< (setq bunno (1- bunno)) 0) t (setq bun2 (nth bunno wnn7-bun-list)) (if (and (null (wnn7-bunsetsu-get-dai-continue bun2)) (or (wnn7-bunsetsu-get-dai-continue bun1) (null (wnn7-bunsetsu-get-dai-continue bun1)))) t nil)))) (defun wnn7-server-dai-end (bunno) "$B pos 0) (null (eq (wnn7-bunsetsu-get-zenkouho head) t))) (setq cand (cons (nth pos cand) (delq (nth pos cand) cand))))) (setq cand (wnn7-uniq-candidates cand) pos (wnn7-candidate-pos bunsetsu cand) converted (wnn7-get-candidates-converted cand)) (wnn7-set-candidate-info bunsetsu (wnn7-zenkouho-create pos cand converted major prev-b next-b)) (wnn7-add-freq-down head cand) (cons pos converted)))) (defsubst wnn7-uniq-bunsetsu-equal (bunsetsu-1 bunsetsu-2) (and (or (eq wnn-uniq-level 'wnn-uniq-kanji) (and (eq wnn-uniq-level 'wnn-uniq) (= (wnn7-bunsetsu-get-hinshi bunsetsu-1) (wnn7-bunsetsu-get-hinshi bunsetsu-2))) (and (= (wnn7-bunsetsu-get-dic-no bunsetsu-1) (wnn7-bunsetsu-get-dic-no bunsetsu-2)) (= (wnn7-bunsetsu-get-entry bunsetsu-1) (wnn7-bunsetsu-get-entry bunsetsu-2)) (or (eq wnn-uniq-level 'wnn-uniq-entry) (= (wnn7-bunsetsu-get-kangovect bunsetsu-1) (wnn7-bunsetsu-get-kangovect bunsetsu-2))))) (equal (wnn7-bunsetsu-get-converted bunsetsu-1) (wnn7-bunsetsu-get-converted bunsetsu-2)) (equal (wnn7-bunsetsu-get-fuzokugo bunsetsu-1) (wnn7-bunsetsu-get-fuzokugo bunsetsu-2)))) (defun wnn7-uniq-bunsetsu-list-equal (b1 b2) (while (and b1 b2 (wnn7-uniq-bunsetsu-equal (car b1) (car b2))) (setq b1 (cdr b1) b2 (cdr b2))) (and (null b1) (null b2))) (defun wnn7-candidate-pos (bunsetsu candidates) (let ((n 0) pos) (while (and (null pos) candidates) (if (wnn7-uniq-bunsetsu-list-equal (car candidates) bunsetsu) (setq pos n) (setq candidates (cdr candidates) n (1+ n)))) (or pos -1))) ;;; ;;; ;;; frequency and flag operation ;;; ;;; (defvar wnn-auto-save-dic-count 0) (defun wnn7-server-hindo-update () (let* ((head (car wnn7-bun-list)) (env (wnn7-bunsetsu-get-env head))) (prog1 (progn (wnn7-clear-now-flag wnn7-bun-list) (wnn7-merge-fi-rel head (cdr wnn7-bun-list)) (wnn7rpc-set-fi-priority env (wnn7-bunsetsu-get-fi-rel head)) (wnn7-optimize-in-local wnn7-bun-list) (wnn7-optimize-in-server wnn7-bun-list)) (setq wnn-auto-save-dic-count (1+ wnn-auto-save-dic-count)) (when (eq wnn-auto-save-dic-count wnn-auto-save-dictionaries) (wnn7-server-dict-save) (setq wnn-auto-save-dic-count 0))))) (defun wnn7-clear-now-flag (bunsetsu-list) (let ((env (wnn7-bunsetsu-get-env (car bunsetsu-list))) fd) (while bunsetsu-list (setq fd (wnn7-bunsetsu-get-freq-down (car bunsetsu-list)) bunsetsu-list (cdr bunsetsu-list)) (while fd (wnn7rpc-set-frequency env (caar fd) (cdar fd) (WNN-const IMA_OFF) (WNN-const HINDO_NOP)) (setq fd (cdr fd)))))) (defun wnn7-add-freq-down (bunsetsu down-list) (let ((freq-down (wnn7-bunsetsu-get-freq-down bunsetsu)) b-list b pair) (while down-list (setq b-list (car down-list) down-list (cdr down-list)) (while b-list (setq b (car b-list) b-list (cdr b-list) pair (cons (wnn7-bunsetsu-get-dic-no b) (wnn7-bunsetsu-get-entry b))) (if (and (/= (wnn7-bunsetsu-get-right-now b) 0) (/= (car pair) -1) (null (member pair freq-down))) (setq freq-down (cons pair freq-down))))) (wnn7-bunsetsu-set-freq-down bunsetsu freq-down))) (defun wnn7-merge-freq-down (bunsetsu b-list) (let ((freq-down0 (wnn7-bunsetsu-get-freq-down bunsetsu)) freq-down1) (while b-list (setq freq-down1 (wnn7-bunsetsu-get-freq-down (car b-list)) b-list (cdr b-list)) (while freq-down1 (if (null (member (car freq-down1) freq-down0)) (setq freq-down0 (cons (car freq-down1) freq-down0))) (setq freq-down1 (cdr freq-down1))) (wnn7-bunsetsu-set-freq-down bunsetsu freq-down0)))) (defun wnn7-merge-fi-rel (bunsetsu b-list) (let ((fi-rel (cons nil (wnn7-bunsetsu-get-fi-rel bunsetsu)))) (if (eq bunsetsu (car b-list)) (setq b-list (cdr b-list))) (while b-list (nconc fi-rel (wnn7-bunsetsu-get-fi-rel (car b-list))) (wnn7-bunsetsu-set-fi-rel (car b-list) nil) (setq b-list (cdr b-list))) (wnn7-bunsetsu-set-fi-rel bunsetsu (cdr fi-rel)))) (defun wnn7-optimize-in-local (bunsetsu-list) (let ((env (wnn7-bunsetsu-get-env (car bunsetsu-list))) b prev-b next-b major-top entry hinshi) (setq next-b (car bunsetsu-list) bunsetsu-list (cdr bunsetsu-list)) (while next-b (setq major-top (null (and b (wnn7-bunsetsu-get-dai-continue b))) prev-b b b next-b next-b (car bunsetsu-list) bunsetsu-list (cdr bunsetsu-list) hinshi (wnn7-bunsetsu-get-hinshi b)) (when (or (and (/= (wnn7env-get-notrans env) (WNN-const DIC_RDONLY)) (= (wnn7-bunsetsu-get-dic-no b) -1) (or (= (wnn7-bunsetsu-get-entry b) (WNN-const HIRAGANA)) (= (wnn7-bunsetsu-get-entry b) (WNN-const KATAKANA))) (>= (wnn7-bunsetsu-get-jirilen b) (WNN-const LEARNING_LEN))) (= (wnn7-bunsetsu-get-entry b) (WNN-const IKEIJI_ENTRY))) (setq entry (wnn7-notrans-auto-learning b)) (when (/= entry -1) (wnn7-bunsetsu-set-dic-no b (WNN-const MUHENKAN_DIC)) (wnn7-bunsetsu-set-entry b entry))) (cond ((and next-b major-top (wnn7-bunsetsu-get-dai-continue b)) (wnn7-adjacent-learning b next-b)) ((and prev-b (= hinshi (wnn7env-get-hinshi env 'rendaku)) (equal (wnn7-bunsetsu-get-fuzokugo prev-b) "")) (wnn7-adjacent-learning prev-b b)) ((and next-b (= hinshi (wnn7env-get-hinshi env 'settou))) (wnn7-adjacent-learning b next-b)) ((and (/= (wnn7env-get-bmodify env) (WNN-const DIC_RDONLY)) (wnn7-bunsetsu-get-change-top b) next-b (/= (wnn7-bunsetsu-get-hinshi next-b) (wnn7env-get-hinshi env 'rendaku)) (/= hinshi (wnn7env-get-hinshi env 'settou))) (wnn7-bmodify-learning b next-b)))))) (defun wnn7-notrans-auto-learning (bunsetsu) (let ((env (wnn7-bunsetsu-get-env bunsetsu))) (wnn7rpc-auto-learning env (WNN-const NOTRANS_LEARN) (wnn7-bunsetsu-get-yomi bunsetsu) (wnn7-bunsetsu-get-converted bunsetsu) "" (if (= (wnn7-bunsetsu-get-entry bunsetsu) (WNN-const IKEIJI_ENTRY)) (wnn7-bunsetsu-get-hinshi bunsetsu) (wnn7env-get-hinshi env 'noun)) 0))) (defun wnn7-adjacent-learning (bunsetsu1 bunsetsu2) (let* ((env (wnn7-bunsetsu-get-env bunsetsu1)) (yomi (concat (wnn7-bunsetsu-get-yomi bunsetsu1) (wnn7-bunsetsu-get-yomi bunsetsu2))) (kanji (concat (wnn7-bunsetsu-get-converted bunsetsu1) (wnn7-bunsetsu-get-converted bunsetsu2))) (hinshi (wnn7env-get-hinshi env 'noun))) (if (= (wnn7env-get-bmodify env) (WNN-const DIC_RW)) (wnn7rpc-auto-learning env (WNN-const BMODIFY_LEARN) yomi kanji "" hinshi 0) (wnn7rpc-temporary-learning env yomi kanji "" hinshi 0)))) (defun wnn7-bmodify-learning (bunsetsu1 bunsetsu2) (let ((env (wnn7-bunsetsu-get-env bunsetsu1)) (yomi (concat (wnn7-bunsetsu-get-yomi bunsetsu1) (wnn7-bunsetsu-get-fuzokugo bunsetsu1) (wnn7-bunsetsu-get-yomi bunsetsu2))) (kanji (concat (wnn7-bunsetsu-get-converted bunsetsu1) (wnn7-bunsetsu-get-fuzokugo bunsetsu1) (wnn7-bunsetsu-get-converted bunsetsu2))) (hinshi (wnn7-bunsetsu-get-hinshi bunsetsu2))) (wnn7rpc-auto-learning env (WNN-const BMODIFY_LEARN) yomi kanji "" hinshi 0))) (defun wnn7-optimize-in-server (bunsetsu-list) (let ((env (wnn7-bunsetsu-get-env (car bunsetsu-list))) (context (wnn7-bunsetsu-get-context (car bunsetsu-list))) b) (wnn7-context-set-right-now (car context) (WNN-const HINDO_NOP)) (wnn7-context-set-freq (car context) (WNN-const HINDO_NOP)) (wnn7-context-set-right-now (nth 1 context) (WNN-const HINDO_NOP)) (wnn7-context-set-freq (nth 1 context) (WNN-const HINDO_NOP)) (while bunsetsu-list (setq b (car bunsetsu-list) bunsetsu-list (cdr bunsetsu-list) context (cons (wnn7-context-create (wnn7-bunsetsu-get-dic-no b) (wnn7-bunsetsu-get-entry b) (wnn7-bunsetsu-get-jirilen b) (wnn7-bunsetsu-get-hinshi b) (wnn7-bunsetsu-get-fuzokugo b) (wnn7-bunsetsu-get-converted b) (WNN-const IMA_ON) (WNN-const HINDO_INC)) context))) (prog1 (list (car context) (nth 1 context)) (wnn7rpc-optimize-fi env (nreverse context))))) (defun wnn7-server-henkan-kakutei (bunno pos) (let* ((bunsetsu (wnn7-get-major-bunsetsu bunno)) (head (car bunsetsu)) (next-b (wnn7-get-next-major-bunsetsu bunno)) (prev-b (car (wnn7-get-prev-major-bunsetsu bunno))) (cand-list (wnn7-bunsetsu-get-zenkouho-list head)) (cand (nth pos cand-list)) (c-head (car cand)) top bunno2) (setq bunno2 (cdr (wnn7-get-prev-major-bunsetsu bunno)) top (wnn7-get-pre-prev-bunsetsu (1- bunno2))) (wnn7-bunsetsu-set-zenkouho-pos head pos) (wnn7-bunsetsu-set-change-top c-head (wnn7-bunsetsu-get-change-top head)) (wnn7-bunsetsu-set-freq-down c-head (wnn7-bunsetsu-get-freq-down head)) (wnn7-merge-fi-rel c-head bunsetsu) (wnn7-major-bunsetsu-set-context cand (wnn7-bunsetsu-get-context head)) (wnn7-set-candidate-info cand (wnn7-bunsetsu-get-zenkouho head)) (if (and prev-b (null wnn-one-level-conversion)) (progn (wnn7-bunsetsu-set-dai-continue (wnn7-get-bunsetsu-tail prev-b) (wnn7-bunsetsu-connect-prev c-head)))) (setq wnn7-bun-list (append top prev-b cand next-b)))) (defun wnn7-server-henkan-kakutei-sho (bunno pos) (let* ((bunsetsu (wnn7-get-minor-bunsetsu bunno)) (head (car bunsetsu)) (next-b (nthcdr (1+ bunno) wnn7-bun-list)) (prev-b (wnn7-get-pre-prev-bunsetsu (1- bunno))) (cand-list (wnn7-bunsetsu-get-zenkouho-list head)) (cand (nth pos cand-list)) (c-head (car cand)) top bunno2) ;;(setq bunno2 (wnn7-get-prev-minor-bunsetsu bunno) ;; top (wnn7-get-pre-prev-bunsetsu (1- bunno2))) (wnn7-bunsetsu-set-zenkouho-pos head pos) (wnn7-bunsetsu-set-change-top c-head (wnn7-bunsetsu-get-change-top head)) (wnn7-bunsetsu-set-freq-down c-head (wnn7-bunsetsu-get-freq-down head)) (wnn7-merge-fi-rel c-head bunsetsu) (wnn7-major-bunsetsu-set-context cand (wnn7-bunsetsu-get-context head)) (wnn7-set-candidate-info cand (wnn7-bunsetsu-get-zenkouho head)) ;; (if (and prev-b (null wnn-one-level-conversion)) ;; (progn ;; (wnn7-bunsetsu-set-dai-continue (wnn7-get-bunsetsu-tail prev-b) ;; (wnn7-bunsetsu-connect-prev c-head)))) (setq wnn7-bun-list (append top prev-b cand next-b)))) (defun wnn7-server-bunsetu-henkou (bunno len major) (let (bunsetsu next-b prev-b tail env yomi context yomi1 yomi2 hinshi fuzokugo new tmplen) (if major (setq bunsetsu (wnn7-get-major-bunsetsu bunno) prev-b (wnn7-get-pre-prev-bunsetsu (1- bunno)) next-b (wnn7-get-next-major-bunsetsu bunno)) (setq bunsetsu (wnn7-get-minor-bunsetsu bunno) prev-b (wnn7-get-pre-prev-bunsetsu (1- bunno)) next-b (list (nthcdr (1+ bunno) wnn7-bun-list)))) (setq tmplen (length (wnn7-get-major-bunsetsu-source bunsetsu))) (when (< tmplen len) (nconc bunsetsu (list (car next-b))) (setq next-b (cdr next-b))) (setq tail (wnn7-get-bunsetsu-tail prev-b) env (wnn7-bunsetsu-get-env (car bunsetsu)) yomi (wnn7-get-major-bunsetsu-source bunsetsu) context (wnn7-bunsetsu-get-context (car bunsetsu))) (if tail (setq hinshi (wnn7-bunsetsu-get-hinshi tail) fuzokugo (wnn7-bunsetsu-get-fuzokugo tail)) (setq hinshi -1 fuzokugo "")) (setq yomi1 (substring yomi 0 len) yomi2 (concat (substring yomi len) (wnn7-get-major-bunsetsu-source next-b))) (setq new (wnn7-tanbunsetsu-conversion env yomi1 hinshi fuzokugo nil major)) (if (numberp new) (egg:error "%s" (wnn7rpc-get-error-message (- new)))) (if (and prev-b (null wnn-one-level-conversion)) (wnn7-bunsetsu-set-dai-continue tail (wnn7-bunsetsu-connect-prev (car new)))) (wnn7-bunsetsu-set-change-top (car new) t) (wnn7-merge-freq-down (car new) bunsetsu) (wnn7-merge-fi-rel (car new) bunsetsu) (wnn7-merge-fi-rel (car new) next-b) (wnn7-major-bunsetsu-set-context new context) (if (= (length yomi2) 0) (setq next-b nil) (setq tail (wnn7-get-bunsetsu-tail new) next-b (wnn7-renbunsetsu-conversion env yomi2 (wnn7-bunsetsu-get-hinshi tail) (wnn7-bunsetsu-get-fuzokugo tail) nil context)) (if (numberp next-b) (egg:error "%s" (wnn7rpc-get-error-message (- next-b)))) (if (and (null major) (null wnn-one-level-conversion)) (wnn7-bunsetsu-set-dai-continue tail (wnn7-bunsetsu-connect-prev (car next-b))))) (setq new (append prev-b new next-b)) (cons (length new) new))) ;; new-bunsetsu-list (defun wnn7-renbunsetsu-conversion (env yomi hinshi fuzokugo v context) (let ((result (wnn7rpc-fi-renbunsetsu-conversion env yomi hinshi fuzokugo v context))) (prog1 result (if wnn-one-level-conversion (while (consp result) (wnn7-bunsetsu-set-dai-continue (car result) nil) (setq result (cdr result))))))) (defun wnn7-tanbunsetsu-conversion (env yomi hinshi fuzokugo v major) (if (or (null major) wnn-one-level-conversion) (wnn7rpc-tanbunsetsu-conversion env yomi hinshi fuzokugo v) (wnn7rpc-daibunsetsu-conversion env yomi hinshi fuzokugo v))) (defun wnn7-server-synonym (bunno pos major) (let (bunsetsu head env yomi yomi_org next-b prev-b hinshi fuzokugo converted cand cand-list c-head v) (if major (setq bunsetsu (wnn7-get-major-bunsetsu bunno) prev-b (car (wnn7-get-prev-major-bunsetsu bunno)) next-b (wnn7-get-next-major-bunsetsu bunno)) (setq bunsetsu (wnn7-get-minor-bunsetsu bunno) prev-b (wnn7-get-prev-minor-bunsetsu bunno) next-b (list (nthcdr (1+ bunno) wnn7-bun-list)))) (setq head (car bunsetsu) env (wnn7-bunsetsu-get-env head) cand-list (wnn7-bunsetsu-get-zenkouho-list head) cand (nth pos cand-list) c-head (car cand) yomi (wnn7-get-bunsetsu-converted c-head) yomi_org (wnn7-get-bunsetsu-source c-head)) (if prev-b (setq prev-b (wnn7-get-bunsetsu-tail prev-b) hinshi (wnn7-bunsetsu-get-hinshi prev-b) fuzokugo (wnn7-bunsetsu-get-fuzokugo prev-b)) (setq hinshi -1 fuzokugo "")) (if next-b (setq next-b (car next-b) v (wnn7-bunsetsu-get-kangovect next-b))) (if (vectorp (wnn7-bunsetsu-get-zenkouho head)) (setq pos (wnn7-bunsetsu-get-zenkouho-pos head) cand (wnn7-bunsetsu-get-zenkouho-list head))) (setq cand (wnn7rpc-assoc-with-data env yomi hinshi fuzokugo v (wnn7-bunsetsu-get-hinshi c-head) ;; jirihin yomi_org (wnn7-bunsetsu-get-jirilen c-head); jirilen (length (wnn7-get-bunsetsu-source c-head)); yomilen* (length (wnn7-get-bunsetsu-converted c-head)); kanjilen* (length (wnn7-bunsetsu-get-converted c-head)))); real_kanjilen (if (numberp cand) (egg:error "%s" (wnn7rpc-get-error-message (- cand))) (if cand (progn (setq cand (wnn7-uniq-candidates cand) pos 0 converted (wnn7-get-candidates-converted cand)) (wnn7-set-candidate-info bunsetsu (wnn7-zenkouho-create pos cand converted major prev-b next-b)) (wnn7-add-freq-down head cand) (cons pos converted)) nil)))) ;;; ;;; ;;; predictive input ;;; ;;; (defvar egg-predict-status nil) (defun wnn7-server-predict-init () (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-init env))) (if (= result 0) (progn (wnn7rpc-yosoku-init-time-keydata env) (wnn7rpc-yosoku-init-inputinfo env) (setq egg-predict-status t)) (if (= result -16) (egg:error "%s" "$B%7%9%F%`M=B,<-=q%U%!%$%k$,8+$D$+$j$^$;$s(B") (egg:error "%s" (wnn7rpc-get-error-message (- result)))) nil))) (defun wnn7-server-predict-free () (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-free env))) (setq egg-predict-status nil) (if (= result 0) t (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil))) (defun wnn7-server-predict-start (str) (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-yosoku env str))) (if (numberp result) (if (= result -3011) result (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil) result))) (defun wnn7-server-predict-toroku (&optional kakutei-str) (when env-normal (let* ((bunlist wnn7-bun-list) (head (car bunlist)) (env wnn7-env-norm) ykouho yklist result) (if kakutei-str ;; before convert (setq ykouho (vector kakutei-str (length (encode-coding-string (comm-format-truncate-after-null kakutei-str) egg-mb-euc)) kakutei-str (length (encode-coding-string (comm-format-truncate-after-null kakutei-str) egg-mb-euc)) 0) yklist (cons ykouho yklist)) ;; after convert ;;(setq env (wnn7-bunsetsu-get-env head)) (let (bun bunsetsu) (while bunlist (setq bun (car bunlist) bunsetsu nil) (while bun (setq bunsetsu (cons bun bunsetsu) bunlist (cdr bunlist) bun (and (wnn7-bunsetsu-get-dai-continue bun) bunlist (car bunlist)))) (setq bunsetsu (nreverse bunsetsu)) (when bunsetsu (setq ykouho (vector (wnn7-get-major-bunsetsu-source bunsetsu) (length (encode-coding-string (comm-format-truncate-after-null (mapconcat 'wnn7-bunsetsu-get-yomi bunsetsu "")) egg-mb-euc)) (wnn7-get-major-bunsetsu-converted bunsetsu) (length (encode-coding-string (comm-format-truncate-after-null (mapconcat 'wnn7-bunsetsu-get-converted bunsetsu "")) egg-mb-euc)) (wnn7-bunsetsu-get-hinshi (car (nreverse bunsetsu)))) yklist (cons ykouho yklist))))) (setq yklist (nreverse yklist))) (if (= (setq result (wnn7rpc-yosoku-toroku env (length yklist) yklist)) 0) t (if (not (eq result -3011)) (egg:error "%s" (wnn7rpc-get-error-message (- result)))) nil)))) (defun wnn7-server-predict-selected-cand (pos) (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-selected-cand env pos))) (if (>= result 0) result (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil))) (defun wnn7-server-predict-delete-cand (pos) (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-delete-cand env pos))) (if (= result 0) t (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil))) (defun wnn7-server-predict-cancel-toroku () (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-cancel-latest-toroku env))) (if (= result 0) t (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil))) (defun wnn7-server-predict-reset-connective () (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-reset-pre-yosoku env))) (if (= result 0) t (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil))) (defun wnn7-server-predict-save-data () (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-save-datalist env))) (if (= result 0) t (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil))) (defun wnn7-server-predict-set-timeinfo (yosokuselect throughyosoku inputtime keylen) (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-set-timeinfo env yosokuselect throughyosoku inputtime keylen))) (if (= result 0) t (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil))) (defun wnn7-server-predict-set-user-inputinfo (allkey userkey yosokuselect) (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-set-user-inputinfo env allkey userkey yosokuselect))) (if (= result 0) t (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil))) (defun wnn7-server-predict-status () (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-status env))) result)) (provide 'wnn7egg-lib) ;;; wnn7egg-lib.el ends here wnn7egg-1.02.orig/elisp/emacs20/wnn7egg-rpc.el0100644000764400003210000016546707474174160021216 0ustar ishikawaishikawa;; Wnn7Egg is Egg modified for Wnn7, and the current maintainer ;; is OMRON SOFTWARE Co., Ltd. ;; ;; This file is part of Wnn7Egg. (base code is egg/wnnrpc.el (eggV4)) ;; ;;; ------------------------------------------------------------------ ;;; ;;; Wnn7Egg $B!J(BWnn "$B$J$J(B"$B$?$^$4!K(B--- Wnn7 Emacs Client ;;; ;;; Wnn7Egg $B$O!"!V$?$^$4Bh#3HG!W(Bv3.09 $B$r%Y!<%9$K(B $B!V$?$^$4Bh#4HG!W$NDL?.!"(B ;;; $B%i%$%V%i%jIt$rAH$_9~$s$@!"(BWnn7 $B$N0Y$N@lMQ%/%i%$%"%s%H$G$9!#(B ;;; ;;; $B$9$Y$F$N%=!<%9$,(B Emacs Lisp $B$G5-=R$5$l$F$$$k$N$G!"(BWnn SDK/Library $B$rI,MW(B ;;; $B$H$;$:!"(BGNU Emacs $B5Z$S(B XEmacs $B4D6-$G;HMQ$9$k$3$H$,$G$-$^$9!#;HMQ5vBz>r7o(B ;;; $B$O(B GPL $B$G$9!#(B ;;; ;;; GNU Emacs 20.3 $B0J9_!"(BXEmacs 21.x $B0J9_$GF0:n3NG'$7$F$$$^$9!#(B ;;; ;;; ;;; Wnn7Egg $B$O(B Wnn7 $B$N5!G=$G$"$k3Z!9F~NO!JF~NOM=B,!K!"O"A[JQ49$r%5%]!<%H(B ;;; $B$7$F$$$^$9!#(B ;;; ;;; $B!V$?$^$4!W$HFHN)!?6&B8$G$-$k$h$&$K!"1F6A$9$k$r(B ;;; "wnn7..." $B$H$$$&7A$KJQ99$7$F$$$^$9!#(B ;;; ;;; ------------------------------------------------------------------ ;;; egg/wnnrpc.el --- WNN Support (low level interface) in Egg ;;; Input Method Architecture ;; Copyright (C) 1999, 2000 Free Software Foundation, Inc ;; Author: NIIBE Yutaka ;; KATAYAMA Yoshio ; Korean, Chinese support. ;; Maintainer: TOMURA Satoru ;; Keywords: mule, multilingual, input method ;; This file is part of EGG. ;; EGG is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; EGG is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;;; 2001/9/30 Modified Error Messages ;;; Code: (require 'wnn7egg-com) (defmacro wnn-file-string () (string-as-unibyte (decode-coding-string "$B#W#n#n$N%U%!%$%k(B" 'euc-jp))) (defmacro wnn-const (c) "Macro for WNN constants." (cond ((eq c 'JS_VERSION) 0) ((eq c 'JS_OPEN) 1) ((eq c 'JS_CLOSE) 3) ((eq c 'JS_CONNECT) 5) ((eq c 'JS_DISCONNECT) 6) ((eq c 'JS_ENV_EXIST) 7) ((eq c 'JS_ENV_STICKY) 8) ((eq c 'JS_ENV_UNSTICKY) 9) ((eq c 'JS_KANREN) 17) ((eq c 'JS_KANTAN_SHO) 18) ((eq c 'JS_KANZEN_SHO) 19) ((eq c 'JS_KANTAN_DAI) 20) ((eq c 'JS_KANZEN_DAI) 21) ((eq c 'JS_HINDO_SET) 24) ((eq c 'JS_DIC_ADD) 33) ((eq c 'JS_DIC_DELETE) 34) ((eq c 'JS_DIC_USE) 35) ((eq c 'JS_DIC_LIST) 36) ((eq c 'JS_DIC_INFO) 37) ((eq c 'JS_FUZOKUGO_SET) 41) ((eq c 'JS_FUZOKUGO_GET) 48) ((eq c 'JS_WORD_ADD) 49) ((eq c 'JS_WORD_DELETE) 50) ((eq c 'JS_WORD_SEARCH) 51) ((eq c 'JS_WORD_SEARCH_BY_ENV) 52) ((eq c 'JS_WORD_INFO) 53) ((eq c 'JS_WORD_COMMENT_SET) 54) ((eq c 'JS_PARAM_SET) 65) ((eq c 'JS_PARAM_GET) 66) ((eq c 'JS_MKDIR) 81) ((eq c 'JS_ACCESS) 82) ((eq c 'JS_WHO) 83) ((eq c 'JS_ENV_LIST) 85) ((eq c 'JS_FILE_LIST_ALL) 86) ((eq c 'JS_DIC_LIST_ALL) 87) ((eq c 'JS_FILE_READ) 97) ((eq c 'JS_FILE_WRITE) 98) ((eq c 'JS_FILE_SEND) 99) ((eq c 'JS_FILE_RECEIVE) 100) ((eq c 'JS_HINDO_FILE_CREATE) 101) ((eq c 'JS_DIC_FILE_CREATE) 102) ((eq c 'JS_FILE_REMOVE) 103) ((eq c 'JS_FILE_LIST) 104) ((eq c 'JS_FILE_INFO) 105) ((eq c 'JS_FILE_LOADED) 106) ((eq c 'JS_FILE_LOADED_LOCAL) 107) ((eq c 'JS_FILE_DISCARD) 108) ((eq c 'JS_FILE_COMMENT_SET) 109) ((eq c 'JS_FILE_PASSWORD_SET) 110) ((eq c 'JS_FILE_STAT) 111) ((eq c 'JS_KILL) 112) ((eq c 'JS_HINSI_LIST) 114) ((eq c 'JS_HINSI_NAME) 115) ((eq c 'JS_HINSI_NUMBER) 116) ((eq c 'JS_HINSI_DICTS) 117) ((eq c 'JS_HINSI_TABLE_SET) 118) ((eq c 'JS_ACCESS_ADD_HOST) ?\xf00011) ((eq c 'JS_ACCESS_ADD_USER) ?\xf00012) ((eq c 'JS_ACCESS_REMOVE_HOST) ?\xf00013) ((eq c 'JS_ACCESS_REMOVE_USER) ?\xf00014) ((eq c 'JS_ACCESS_ENABLE) ?\xf00015) ((eq c 'JS_ACCESS_DISABLE) ?\xf00016) ((eq c 'JS_ACCESS_GET_INFO) ?\xf00017) ((eq c 'JS_TEMPORARY_DIC_ADD) ?\xf00021) ((eq c 'JS_TEMPORARY_DIC_DELETE) ?\xf00022) ((eq c 'JS_AUTOLEARNING_WORD_ADD) ?\xf00023) ((eq c 'JS_SET_AUTOLEARNING_DIC) ?\xf00024) ((eq c 'JS_GET_AUTOLEARNING_DIC) ?\xf00025) ((eq c 'JS_IS_LOADED_TEMPORARY_DIC) ?\xf00026) ((eq c 'JS_TEMPORARY_WORD_ADD) ?\xf00027) ((eq c 'JS_SET_HENKAN_ENV) ?\xf00031) ((eq c 'JS_GET_HENKAN_ENV) ?\xf00032) ((eq c 'JS_SET_HENKAN_HINSI) ?\xf00033) ((eq c 'JS_GET_HENKAN_HINSI) ?\xf00034) ((eq c 'JS_HENKAN_WITH_DATA) ?\xf00035) ((eq c 'JS_FI_DIC_ADD) ?\xf00061) ((eq c 'JS_FI_HINDO_FILE_CREATE) ?\xf00062) ((eq c 'JS_FI_KANREN) ?\xf00065) ((eq c 'JS_SET_FI_PRIORITY) ?\xf00066) ((eq c 'JS_OPTIMIZE_FI) ?\xf00067) ((eq c 'JS_HENKAN_IKEIJI) ?\xf0006f) ((eq c 'JS_LOCK) ?\xf00071) ((eq c 'JS_UNLOCK) ?\xf00072) ((eq c 'JS_FI_DIC_LIST) ?\xf00081) ((eq c 'JS_FI_DIC_LIST_ALL) ?\xf00082) ((eq c 'JS_FUZOKUGO_LIST) ?\xf00083) ((eq c 'JS_YOSOKU_INIT) ?\xf01001) ((eq c 'JS_YOSOKU_FREE) ?\xf01002) ((eq c 'JS_YOSOKU_YOSOKU) ?\xf01003) ((eq c 'JS_YOSOKU_TOROKU) ?\xf01004) ((eq c 'JS_YOSOKU_SELECTED_CAND) ?\xf01005) ((eq c 'JS_YOSOKU_DELETE_CAND) ?\xf01006) ((eq c 'JS_YOSOKU_CANCEL_LATEST_TOROKU) ?\xf01007) ((eq c 'JS_YOSOKU_RESET_PRE_YOSOKU) ?\xf01008) ((eq c 'JS_YOSOKU_IKKATSU_TOROKU) ?\xf01009) ((eq c 'JS_YOSOKU_SAVE_DATALIST) ?\xf0100a) ((eq c 'JS_YOSOKU_INIT_TIME_KEYDATA) ?\xf0100b) ((eq c 'JS_YOSOKU_INIT_INPUTINFO) ?\xf0100c) ((eq c 'JS_YOSOKU_SET_USER_INPUTINFO) ?\xf0100d) ((eq c 'JS_YOSOKU_SET_TIMEINFO) ?\xf0100e) ((eq c 'JS_YOSOKU_STATUS) ?\xf0100f) ((eq c 'JS_YOSOKU_SET_PARAM) ?\xf01010) ((eq c 'JS_YOSOKU_IKKATSU_TOROKU_INIT) ?\xf01011) ((eq c 'JS_YOSOKU_IKKATSU_TOROKU_END) ?\xf01012) ((eq c 'JS_HENKAN_ASSOC) ?\xf01013) ((eq c 'JLIB_VERSION) ?\x4003) ((eq c 'JLIB_VERSION_WNN6) ?\x4f00) ((eq c 'JLIB_VERSION_WNN7) ?\x4f01) ((eq c 'WNN_C_LOCAL) "!") ((eq c 'WNN_FT_DICT_FILE) 1) ((eq c 'WNN_FT_HINDO_FILE) 2) ((eq c 'WNN_FILE_STRING) (encode-coding-string "$B#W#n#n$N%U%!%$%k(B" 'euc-jp)) ((eq c 'WNN_FILE_STRING7) (encode-coding-string "$B#W#n#n#7%U%!%$%k(B" 'euc-jp)) ((eq c 'WNN_FILE_STRING_LEN) 16) ((eq c 'WNN_PASSWD_LEN) 16) ((eq c 'WNN_HOST_LEN) 16) ((eq c 'WNN_UNIQ_LEN) 28) ((eq c 'WNN_FILE_HEADER_LEN) 128) ((eq c 'WNN_FILE_HEADER_PAD) 36) ((eq c 'WNN_FILE_BODY_PAD) 116) ((eq c 'WNN_ENVNAME_LEN) 32) ((eq c 'WNN_MAX_ENV_OF_A_CLIENT) 32) ((eq c 'WNN_MAX_DIC_OF_AN_ENV) 30) ((eq c 'WNN_MAX_FILE_OF_AN_ENV) 60) ((eq c 'WNN_ACK) 0) ((eq c 'WNN_NAK) -1) ((eq c 'WNN_NO_EXIST) 1) ((eq c 'WNN_OPENF_ERR) 16) ((eq c 'WNN_JSERVER_DEAD) 70) ((eq c 'WNN_BAD_VERSION) 73) ((eq c 'WNN_FILE_READ_ERROR) 90) ((eq c 'WNN_FILE_WRITE_ERROR) 91) ((eq c 'WNN_INCORRECT_PASSWD) 94) ((eq c 'WNN_FILE_IN_USE) 95) ((eq c 'WNN_UNLINK) 96) ((eq c 'WNN_FILE_CREATE_ERROR) 97) ((eq c 'WNN_NOT_A_FILE) 98) ((eq c 'WNN_INODE_CHECK_ERROR) 99) ((eq c 'WNN_UD_DICT) 2) ((eq c 'WNN_REV_DICT) 3) ((eq c 'CWNN_REV_DICT) ?\x103) ((eq c 'BWNN_REV_DICT) ?\x203) ((eq c 'WNN_COMPACT_DICT) 5) ((eq c 'WNN_FI_SYSTEM_DICT) 6) ((eq c 'WNN_FI_USER_DICT) 7) ((eq c 'WNN_FI_HINDO_FILE) 8) ((eq c 'WNN_GROUP_DICT) 9) ((eq c 'WNN_MERGE_DICT) 10) ((eq c 'WNN_VECT_NO) -1) ((eq c 'WNN_VECT_BUNSETSU) 2) ((eq c 'WNN_VECT_KANREN) 0) ((eq c 'WNN_VECT_KANZEN) 1) ((eq c 'WNN_VECT_KANTAN) 1))) (defvar wnn7-dic-no-temps ?\x3f) (defconst wnn7rpc-error-message '((Japanese . [ nil "$B%U%!%$%k$,B8:_$7$^$;$s(B" nil "$B%a%b%j(B allocation $B$G<:GT$7$^$7$?(B" nil "$B<-=q$G$O$"$j$^$;$s(B" "$BIQEY%U%!%$%k$G$O$"$j$^$;$s(B" "$BIUB08l%U%!%$%k$G$O$"$j$^$;$s(B" nil "$B<-=q%F!<%V%k$,0lGU$G$9(B" "$BIQEY%U%!%$%k$,;XDj$5$l$?<-=q$NIQEY%U%!%$%k$G$O$"$j$^$;$s(B" nil nil nil nil nil "$B%U%!%$%k$,%*!<%W%s$G$-$^$;$s(B" "$B@5$7$$IQEY%U%!%$%k$G$O$"$j$^$;$s(B" "$B@5$7$$IUB08l%U%!%$%k$G$O$"$j$^$;$s(B" "$BIUB08l$N8D?t(B, $B%Y%/%?D9$5$J$I$,B?2a$.$^$9(B" "$B$=$NHV9f$N<-=q$O;H$o$l$F$$$^$;$s(B" nil nil nil "$BIUB08l%U%!%$%k$NFbMF$,@5$7$/$"$j$^$;$s(B" "$B5?;wIJ;lHV9f$,0[>o$G$9(B(hinsi.data $B$,@5$7$/$"$j$^$;$s(B)" "$BL$Dj5A$NIJ;l$,A0Ce%U%!%$%k$rFI$_9~$`$3$H$,$G$-$^$;$s(B" "$B%Q%9%o!<%I$,4V0c$C$F$$$^$9(B" "$B%U%!%$%k$,FI$_9~$^$l$F$$$^$9(B" "$B%U%!%$%k$,:o=|$G$-$^$;$s(B" "$B%U%!%$%k$,:n@.=PMh$^$;$s(B" "WNN $B$N%U%!%$%k$G$"$j$^$;$s(B" "$B%U%!%$%k$N(B inode $B$H(B FILE_UNIQ $B$r0lCW$5$;$k;v$,$G$-$^$;$s(B" "$BIJ;l%U%!%$%k$,Bg$-2a$.$^$9(B" "$BIJ;l%U%!%$%k$,Bg$-2a$.$^$9(B" "$BIJ;l%U%!%$%k$,B8:_$7$^$;$s(B" "$BIJ;l%U%!%$%k$NFbMF$,4V0c$C$F$$$^$9(B" nil "$BIJ;l%U%!%$%k$,FI$_9~$^$l$F$$$^$;$s(B" "$BIJ;lL>$,4V0c$C$F$$$^$9(B" "$BIJ;lHV9f$,4V0c$C$F$$$^$9(B" nil "$B$=$NA`:n$O%5%]!<%H$5$l$F$$$^$;$s(B" "$B%Q%9%o!<%I$NF~$C$F$$$k%U%!%$%k$,%*!<%W%s$G$-$^$;$s(B" "uumrc $B%U%!%$%k$,B8:_$7$^$;$s(B" "uumrc $B%U%!%$%k$N7A<0$,8m$C$F$$$^$9(B" "$B$3$l0J>e4D6-$r:n$k$3$H$O$G$-$^$;$s(B" "$B$3$N%/%i%$%"%s%H$,FI$_9~$s$@%U%!%$%k$G$"$j$^$;$s(B" "$B<-=q$KIQEY%U%!%$%k$,$D$$$F$$$^$;$s(B" "$B%Q%9%o!<%I$N%U%!%$%k$,:n@.=PMh$^$;$s(B" ])) "Array of WNN error messages. Indexed by error code.") (defconst wnn7rpc-error-message500 '((Japanese . [ "$B0l;~3X=,<-=q$,4{$K4D6-$KEPO?$5$l$F$$$^$9(B" "$B0l;~3X=,<-=q$N4D6-$X$NEPO?$K<:GT$7$^$7$?(B" "$B0l;~3X=,<-=q$N4D6-$+$i$N:o=|$K<:GT$7$^$7$?(B" "$B%Q%i%a!<%?<+F0%A%e!<%K%s%0=hM}$r=i4|2=$9$k$3$H$,$G$-$^$;$s(B" "$B%Q%i%a!<%?<+F0%A%e!<%K%s%0%G!<%?$r:n@.$9$k$3$H$,$G$-$^$;$s(B" "$B%Q%i%a!<%?<+F0%A%e!<%K%s%0%G!<%?$,4V0c$C$F$$$^$9(B" ])) "Array of WNN error messages part of 500-1000. caution, start-no. is 500") (defconst wnn7rpc-error-message3000 '((Japanese . [ nil "$B#F#I4X78<-=q%U%!%$%k$G$O$"$j$^$;$s(B" "$B#F#I4X78IQEY%U%!%$%k$G$O$"$j$^$;$s(B" "$B#F#I4X78%7%9%F%`<-=q$G$O$"$j$^$;$s(B" "$B#F#I4X78%f!<%6<-=q$G$O$"$j$^$;$s(B" "$B8E$$%P!<%8%g%s$NIUB08l%U%!%$%k$,@_Dj$5$l$F$$$^$9(B" "$B#1$D$NIQEY%U%!%$%k$r0[$J$k<-=q4V$G6&MQ$7$h$&$H$7$^$7$?(B" nil nil nil "$B%5!<%P$,%m%C%/$5$l$F$$$^$9(B" "$B%i%$%;%s%9$, n-bunsetsu 0) (comm-unpack (u u u u u u u u u u u u) end start jiritsugo-end dic-no entry freq right-now hinshi status status-backward kangovect evaluation) (setq slist (cons (wnn7-bunsetsu-create env (1+ (- jiritsugo-end start)) dic-no entry freq right-now hinshi status status-backward kangovect evaluation) slist)) (setq n-bunsetsu (1- n-bunsetsu))) (prog1 (setq slist (nreverse slist)) (while slist (comm-unpack (S S S) result source fuzokugo) (wnn7-bunsetsu-set-converted (car slist) result) (wnn7-bunsetsu-set-yomi (car slist) source) (wnn7-bunsetsu-set-fuzokugo (car slist) fuzokugo) (setq slist (cdr slist)))))) (defun wnn7rpc-receive-dai-bunsetsu-list (env n-dai separate) (let ((proc (wnn7env-get-proc env)) n-bunstsu kanji-length dlist slist end start n-sho evaluation n retval) (comm-unpack (u u) n-bunstsu kanji-length) (while (> n-dai 0) (comm-unpack (u u u u) end start n-sho evaluation) (setq dlist (cons (cons n-sho evaluation) dlist) n-dai (1- n-dai))) (setq dlist (nreverse dlist) slist (wnn7rpc-receive-sho-bunsetsu-list env n-bunstsu)) (if (null separate) (prog1 slist (while dlist (setq n (caar dlist)) (while (> n 0) (wnn7-bunsetsu-set-dai-evaluation (car slist) (cdar dlist)) (wnn7-bunsetsu-set-dai-continue (car slist) (> n 1)) (setq slist (cdr slist) n (1- n))) (setq dlist (cdr dlist)))) (while dlist (setq retval (cons slist retval) n (caar dlist)) (while (> n 1) (wnn7-bunsetsu-set-dai-evaluation (car slist) (cdar dlist)) (wnn7-bunsetsu-set-dai-continue (car slist) t) (setq slist (cdr slist) n (1- n))) (wnn7-bunsetsu-set-dai-evaluation (car slist) (cdar dlist)) (wnn7-bunsetsu-set-dai-continue (car slist) (wnn7-bunsetsu-connect-next (car slist))) (setq slist (prog1 (cdr slist) (setcdr slist nil)) dlist (cdr dlist))) (nreverse retval)))) (defun wnn7rpc-renbunsetsu-conversion (env yomi hinshi fuzokugo v) "Convert YOMI string into Kanji. HINSHI and FUZOKUGO are information of preceding bunsetsu." (wnn7rpc-call-with-environment env () (comm-format (u u S i S i i i) (wnn-const JS_KANREN) env-id yomi hinshi fuzokugo (or v (wnn-const WNN_VECT_KANREN)) (if v (wnn-const WNN_VECT_KANREN) (wnn-const WNN_VECT_NO)) (wnn-const WNN_VECT_BUNSETSU)) (wnn7rpc-get-result (wnn7rpc-receive-dai-bunsetsu-list env result nil)))) (defun wnn7rpc-fi-renbunsetsu-conversion (env yomi hinshi fuzokugo v context) "Convert YOMI string into Kanji. HINSHI and FUZOKUGO are information of preceding bunsetsu." (wnn7rpc-call-with-environment env (result) (comm-format (u u S i S i i i i i i i S i i i i S) (wnn-const JS_FI_KANREN) env-id yomi hinshi fuzokugo (or v (wnn-const WNN_VECT_KANREN)) (if v (wnn-const WNN_VECT_KANREN) (wnn-const WNN_VECT_NO)) (wnn-const WNN_VECT_BUNSETSU) (wnn7-context-dic-no (car context)) (wnn7-context-entry (car context)) (wnn7-context-jirilen (car context)) (wnn7-context-hinshi (car context)) (wnn7-context-fuzokugo (car context)) (wnn7-context-dic-no (nth 1 context)) (wnn7-context-entry (nth 1 context)) (wnn7-context-jirilen (nth 1 context)) (wnn7-context-hinshi (nth 1 context)) (wnn7-context-fuzokugo (nth 1 context))) (setq result (wnn7rpc-get-result (wnn7rpc-receive-dai-bunsetsu-list env result nil))) (prog1 result (unless (numberp result) (wnn7-bunsetsu-set-fi-rel (car result) (wnn7rpc-get-fi-relation-data env)) (while result (wnn7-bunsetsu-set-context (car result) context) (setq result (cdr result))))))) (defun wnn7rpc-get-fi-relation-data (env) "Receive FI relation data from the server." (let ((proc (wnn7env-get-proc env)) fi-dic dic entry offset num result) (comm-unpack (i) num) (while (> num 0) (comm-unpack (u u u u) fi-dic dic entry offset) (setq result (cons (vector fi-dic dic entry offset -2 -4) result) num (1- num))) (nreverse result))) (defun wnn7rpc-tanbunsetsu-conversion (env yomi hinshi fuzoku v) "" (wnn7rpc-call-with-environment env (kanji-length) (comm-format (u u S i S i i) (wnn-const JS_KANTAN_SHO) env-id yomi hinshi fuzoku (or v (wnn-const WNN_VECT_KANTAN)) (if v (wnn-const WNN_VECT_KANTAN) (wnn-const WNN_VECT_NO))) (wnn7rpc-get-result (comm-unpack (u) kanji-length) ; ignore kanji-length (wnn7rpc-receive-sho-bunsetsu-list env result)))) (defun wnn7rpc-get-bunsetsu-candidates (env yomi hinshi fuzoku v) "" (wnn7rpc-call-with-environment env (kanji-length) (comm-format (u u S i S i i) (wnn-const JS_KANZEN_SHO) env-id yomi hinshi fuzoku (or v (wnn-const WNN_VECT_KANZEN)) (if v (wnn-const WNN_VECT_KANZEN) (wnn-const WNN_VECT_NO))) (wnn7rpc-get-result (comm-unpack (u) kanji-length) ; ignore kanji-length (mapcar (lambda (b) (wnn7-bunsetsu-set-dai-continue b (wnn7-bunsetsu-connect-next b)) (list b)) (wnn7rpc-receive-sho-bunsetsu-list env result))))) (defun wnn7rpc-daibunsetsu-conversion (env yomi hinshi fuzoku v) "" (wnn7rpc-call-with-environment env (n-sho-bunsetsu kanji-size) (comm-format (u u S i S i i) (wnn-const JS_KANTAN_DAI) env-id yomi hinshi fuzoku (or v (wnn-const WNN_VECT_KANTAN)) (if v (wnn-const WNN_VECT_KANTAN) (wnn-const WNN_VECT_NO))) (wnn7rpc-get-result (wnn7rpc-receive-dai-bunsetsu-list env result nil)))) (defun wnn7rpc-get-daibunsetsu-candidates (env yomi hinshi fuzoku v) "" (wnn7rpc-call-with-environment env (n-sho-bunsetsu kanji-size) (comm-format (u u S i S i i) (wnn-const JS_KANZEN_DAI) env-id yomi hinshi fuzoku (or v (wnn-const WNN_VECT_KANZEN)) (if v (wnn-const WNN_VECT_KANZEN) (wnn-const WNN_VECT_NO))) (wnn7rpc-get-result (wnn7rpc-receive-dai-bunsetsu-list env result t)))) (defun wnn7rpc-set-frequency (env dicno entry ima hindo) "" (wnn7rpc-call-with-environment env () (comm-format (u u i i i i) (wnn-const JS_HINDO_SET) env-id dicno entry ima hindo) (wnn7rpc-get-result))) (defun wnn7rpc-set-fi-priority (env fi-rel) "" (wnn7rpc-call-with-environment env () (progn (comm-format (u u u) (wnn-const JS_SET_FI_PRIORITY) env-id (length fi-rel)) (while fi-rel (comm-format (i i i i i i) (aref (car fi-rel) 0) (aref (car fi-rel) 1) (aref (car fi-rel) 2) (aref (car fi-rel) 3) (aref (car fi-rel) 4) (aref (car fi-rel) 5)) (setq fi-rel (cdr fi-rel)))) (wnn7rpc-get-result))) (defun wnn7rpc-optimize-fi (env context) "" (wnn7rpc-call-with-environment env (c) (progn (comm-format (u u u) (wnn-const JS_OPTIMIZE_FI) env-id (length context)) (while context (setq c (car context) context (cdr context)) (comm-format (i i i i i S) (wnn7-context-dic-no c) (wnn7-context-entry c) (wnn7-context-right-now c) (wnn7-context-freq c) (wnn7-context-length c) (concat (wnn7-context-converted c) (wnn7-context-fuzokugo c))))) (wnn7rpc-get-result))) (defun wnn7rpc-close (proc) "" (comm-call-with-proc proc () (comm-format (u) (wnn-const JS_CLOSE)) (wnn7rpc-get-result))) (defun wnn7rpc-env-exist (proc envname) "" (comm-call-with-proc proc (result) (comm-format (u s) (wnn-const JS_ENV_EXIST) envname) (comm-unpack (u) result) result)) (defun wnn7rpc-make-env-sticky (env) "" (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_ENV_STICKY) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-make-env-unsticky (env) "" (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_ENV_UNSTICKY) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-disconnect (env) "" (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_DISCONNECT) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-add-word (env dictionary yomi kanji comment hinshi initial-freq) "" (wnn7rpc-call-with-environment env () (comm-format (u u u S S S u u) (wnn-const JS_WORD_ADD) env-id dictionary yomi kanji comment hinshi initial-freq) (wnn7rpc-get-result))) (defun wnn7rpc-auto-learning (env type yomi kanji comment hinshi initial-freq) "" (wnn7rpc-call-with-environment env () (comm-format (u u u S S S u u) (wnn-const JS_AUTOLEARNING_WORD_ADD) env-id type yomi kanji comment hinshi initial-freq) (wnn7rpc-get-result))) (defun wnn7rpc-temporary-learning (env yomi kanji comment hinshi initial-freq) "" (wnn7rpc-call-with-environment env () (comm-format (u u S S S u u) (wnn-const JS_AUTOLEARNING_WORD_ADD) env-id yomi kanji comment hinshi initial-freq) (wnn7rpc-get-result))) (defun wnn7rpc-get-dictionary-list-with-environment (env) "" (wnn7rpc-call-with-environment env (n-dic) (comm-format (u u) (wnn-const JS_DIC_LIST) env-id) (comm-unpack (u) n-dic) (wnn7rpc-receive-dictionary-list proc n-dic))) (defun wnn7rpc-get-fi-dictionary-list-with-environment (env mask) "" (wnn7rpc-call-with-environment env (n-dic) (comm-format (u u u) (wnn-const JS_FI_DIC_LIST) env-id mask) (comm-unpack (u) n-dic) (wnn7rpc-receive-dictionary-list proc n-dic))) (defun wnn7rpc-receive-dictionary-list (proc n-dic) (let (entry dic freq dic-mode freq-mode enable-flag nice rev comment dicname freqname dic-passwd freq-passwd type gosuu dic-local-flag freq-local-flag retval) (while (> n-dic 0) (comm-unpack (u u u u u u u u S s s s s u u u u) entry dic freq dic-mode freq-mode enable-flag nice rev comment dicname freqname dic-passwd freq-passwd type gosuu dic-local-flag freq-local-flag) (setq retval (cons (vector entry dic freq dic-mode freq-mode enable-flag nice rev comment dicname freqname dic-passwd freq-passwd type gosuu dic-local-flag freq-local-flag) retval) n-dic (1- n-dic))) (nreverse retval))) (defsubst wnndic-get-id (dic) (aref dic 0)) (defsubst wnndic-get-comment (dic) (aref dic 8)) (defsubst wnndic-get-dictname (dic) (aref dic 9)) (defun wnn7rpc-get-writable-dictionary-id-list (env) "" (wnn7rpc-call-with-environment env (dic-list dic) (comm-format (u u i) (wnn-const JS_HINSI_DICTS) env-id -1) (wnn7rpc-get-result (while (> result 0) (comm-unpack (u) dic) (setq dic-list (nconc dic-list (list dic)) result (1- result))) dic-list))) (defun wnn7rpc-get-hinshi-list (env dic name) "" (wnn7rpc-call-with-environment env (hinshi hinshi-list str-size) (comm-format (u u u S) (wnn-const JS_HINSI_LIST) env-id dic name) (wnn7rpc-get-result (comm-unpack (u) str-size) ; ignore (while (> result 0) (comm-unpack (S) hinshi) (setq hinshi-list (nconc hinshi-list (list hinshi)) result (1- result))) hinshi-list))) (defun wnn7rpc-hinshi-number (proc name) "" (wnn7rpc-call-with-proc proc () (comm-format (u S) (wnn-const JS_HINSI_NUMBER) name) (wnn7rpc-get-result))) (defun wnn7rpc-get-conversion-parameter (env) "" (wnn7rpc-call-with-environment env (n nsho p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15) (comm-format (u u) (wnn-const JS_PARAM_GET) env-id) (wnn7rpc-get-result (comm-unpack (u u u u u u u u u u u u u u u u u) n nsho p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15) (vector n nsho p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15)))) (defun wnn7rpc-get-conversion-env-param (env) "" (wnn7rpc-call-with-environment env (p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20 p21 p22 p23 p24) (comm-format (u u) (wnn-const JS_GET_HENKAN_ENV) env-id) (wnn7rpc-get-result (comm-unpack (i i i i i i i i i i i i i i i i i i i i i i i i) p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20 p21 p22 p23 p24) (vector p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20 p21 p22 p23 p24)))) (defun wnn7rpc-file-loaded (proc path) "" (comm-call-with-proc proc (result) (comm-format (u s) (wnn-const JS_FILE_LOADED) path) (comm-unpack (u) result) result)) (defun wnn7rpc-write-file (env fid filename) (wnn7rpc-call-with-environment env () (comm-format (u u u s) (wnn-const JS_FILE_WRITE) env-id fid filename) (wnn7rpc-get-result))) (defun wnn7rpc-get-fuzokugo-file (env) "" (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_FUZOKUGO_GET) env-id) (wnn7rpc-get-result))) (defsubst wnn7rpc-receive-file-list (proc) (let ((i 0) flist nfiles fid local ref-count type name) (comm-unpack (u) nfiles) (while (> nfiles 0) (comm-unpack (u u u u s) fid local ref-count type name) (setq flist (nconc flist (list (vector fid local ref-count type name))) nfiles (1- nfiles))) flist)) (defun wnn7rpc-get-file-list (proc) "" (comm-call-with-proc proc () (comm-format (u) (wnn-const JS_FILE_LIST_ALL)) (wnn7rpc-receive-file-list proc))) (defun wnn7rpc-get-file-list-with-env (env) "" (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_FILE_LIST) env-id) (wnn7rpc-receive-file-list proc))) (defun wnn7rpc-file-attribute (env path) "3: dictionary, 4: hindo file, 5: fuzokugo-file" (wnn7rpc-call-with-environment env (result) (comm-format (u u s) (wnn-const JS_FILE_STAT) env-id path) (comm-unpack (u) result) result)) (defun wnn7rpc-get-file-info (env fid) "" (wnn7rpc-call-with-environment env (name local ref-count type) (comm-format (u u u) (wnn-const JS_FILE_INFO) env-id fid) (wnn7rpc-get-result (comm-unpack (s u u u) name local ref-count type) (vector name local ref-count type)))) (defmacro wnn7rpc-receive-vector (n) `(let ((v (make-vector ,n -1)) (i 0) j) (while (< i ,n) (comm-unpack (u) j) (aset v i j) (setq i (1+ i))) v)) (defun wnn7rpc-who (proc) "" (comm-call-with-proc proc (who socket username hostname) (comm-format (u) (wnn-const JS_WHO)) (wnn7rpc-get-result (while (> result 0) (comm-unpack (u s s) socket username hostname) (setq who (nconc who (list (vector socket username hostname (wnn7rpc-receive-vector (wnn-const WNN_MAX_ENV_OF_A_CLIENT))))) result (1- result))) who))) (defun wnn7rpc-get-env-list (proc) (comm-call-with-proc proc (envs id name count fuzokugo dic-max) (comm-format (u) (wnn-const JS_ENV_LIST)) (wnn7rpc-get-result (while (> result 0) (comm-unpack (u s u u u) id name count fuzokugo dic-max) (setq envs (nconc envs (list (vector id name count fuzokugo dic-max (wnn7rpc-receive-vector (wnn-const WNN_MAX_DIC_OF_AN_ENV)) (wnn7rpc-receive-vector (wnn-const WNN_MAX_FILE_OF_AN_ENV))))) result (1- result))) envs))) (defun wnn7rpc-kill (proc) "" (comm-call-with-proc proc (result) (comm-format (u) (wnn-const JS_KILL)) (comm-unpack (u) result) result)) (defun wnn7rpc-delete-dictionary (env dic) "" (wnn7rpc-call-with-environment env () (comm-format (u u u) (wnn-const JS_DIC_DELETE) env-id dic) (wnn7rpc-get-result))) (defun wnn7rpc-set-flag-on-dictionary (env dic flag) "" (wnn7rpc-call-with-environment env () (comm-format (u u u u) (wnn-const JS_DIC_USE) env-id dic flag) (wnn7rpc-get-result))) (defun wnn7rpc-get-dictionary-list (proc) "" (wnn7rpc-call-with-proc proc (n-dic) (comm-format (u) (wnn-const JS_DIC_LIST_ALL)) (comm-unpack (u) n-dic) (wnn7rpc-receive-dictionary-list proc n-dic))) (defun wnn7rpc-delete-word (env dic entry) "" (wnn7rpc-call-with-environment env () (comm-format (u u u u) (wnn-const JS_WORD_DELETE) env-id dic entry) (wnn7rpc-get-result))) (defun wnn7rpc-receive-word (proc yomi) (let (dic serial hinshi hindo right-now internal-hindo internal-right-now kanji comment l l1) (comm-unpack (u) dic) (while (>= dic 0) (comm-unpack (u u u u u u) serial hinshi hindo right-now internal-hindo internal-right-now) (setq l (cons (vector dic serial hinshi hindo right-now internal-hindo internal-right-now yomi nil nil) l)) (comm-unpack (u) dic)) (setq l (nreverse l) l1 l) (while l1 (comm-unpack (S S) kanji comment) (aset (car l1) 8 kanji) (aset (car l1) 9 comment) (setq l1 (cdr l1))) l)) (defun wnn7rpc-search-word-in-dictionary (env dic yomi) "" (wnn7rpc-call-with-environment env (n-entries len) (comm-format (u u u S) (wnn-const JS_WORD_SEARCH) env-id dic yomi) (comm-unpack (u u) n-entries len) ; ignore (wnn7rpc-receive-word proc yomi))) (defun wnn7rpc-search-word (env yomi) "" (wnn7rpc-call-with-environment env (n-entries len) (comm-format (u u S) (wnn-const JS_WORD_SEARCH_BY_ENV) env-id yomi) (comm-unpack (u u) n-entries len) ; ignore (wnn7rpc-receive-word proc yomi))) (defun wnn7rpc-get-word-info (env dic entry) "" (wnn7rpc-call-with-environment env (n-entries len yomi) (comm-format (u u u u) (wnn-const JS_WORD_INFO) env-id dic entry) (wnn7rpc-get-result (comm-unpack (S) yomi) (comm-unpack (u u) n-entries len) ; ignore (wnn7rpc-receive-word proc yomi)))) (defun wnn7rpc-set-comment-on-word (env dic entry comment) "" (wnn7rpc-call-with-environment env () (comm-format (u u u u S) (wnn-const JS_WORD_COMMENT_SET) env-id dic entry comment) (wnn7rpc-get-result))) (defun wnn7rpc-get-dictionary-info (env dic) "" (wnn7rpc-call-with-environment env () (comm-format (u u u) (wnn-const JS_DIC_INFO) env-id dic) (wnn7rpc-get-result (wnn7rpc-receive-dictionary-list proc 1)))) (defun wnn7rpc-set-file-comment (env fid comment) "" (wnn7rpc-call-with-environment env () (comm-format (u u u S) (wnn-const JS_FILE_COMMENT_SET) env-id fid comment) (wnn7rpc-get-result))) (defun wnn7rpc-hinshi-name (proc hinshi) "" (wnn7rpc-call-with-proc proc () (comm-format (u u) (wnn-const JS_HINSI_NAME) hinshi) (wnn7rpc-get-result (comm-unpack (S) result) result))) (defun wnn7rpc-set-file-password (env fid which old new) "WHICH: 1: DIC, 2: HINDO, 3(0): Both" (wnn7rpc-call-with-environment env () (comm-format (u u u u s s) (wnn-const JS_FILE_PASSWORD_SET) env-id fid which old new) (wnn7rpc-get-result))) (defun wnn7rpc-set-hinshi-table (env dic hinshi-table) "" (wnn7rpc-call-with-environment env () (comm-format (u u u S) (wnn-const JS_HINSI_TABLE_SET) env-id dic hinshi-table) (wnn7rpc-get-result))) (defmacro wnn7rpc-with-temp-buffer (&rest body) `(with-temp-buffer (let ((coding-system-for-read 'no-conversion) (coding-system-for-write 'no-conversion)) (set-buffer-multibyte nil) ,@body))) (defmacro wnn7rpc-with-write-file (filename error-handler &rest body) `(condition-case error (with-temp-file ,filename (let ((coding-system-for-read 'no-conversion) (coding-system-for-write 'no-conversion)) (set-buffer-multibyte nil) ,@body)) (file-error ,error-handler))) (defmacro wnn7rpc-terminate-current-command (errno) `(progn (comm-call-with-proc-1 proc () (comm-format (i) (wnn-const WNN_NAK))) (- (wnn-const ,errno)))) (defun wnn7rpc-get-local-filename (name) (if (and (string-match (wnn-const WNN_C_LOCAL) name) (string= (substring name 0 (match-beginning 0)) wnn-system-name)) (substring name (match-end 0)) name)) ;;
::= ( ) ;; ::= string ;; ::= string (defun wnn7rpc-scan-file-header () (let ((proc nil) type uniq1 uniq2 passwd) (if (and (> (point-max) (wnn-const WNN_FILE_HEADER_LEN)) ;;; (equal (buffer-substring 1 (1+ (wnn-const WNN_FILE_STRING_LEN))) ;;; (wnn-const WNN_FILE_STRING))) (or (equal (buffer-substring 1 (1+ (wnn-const WNN_FILE_STRING_LEN))) (wnn-const WNN_FILE_STRING)) (equal (buffer-substring 1 (1+ (wnn-const WNN_FILE_STRING_LEN))) (wnn-const WNN_FILE_STRING7)))) (progn (goto-char (1+ (wnn-const WNN_FILE_STRING_LEN))) (comm-unpack (u v v v) type uniq1 (wnn-const WNN_UNIQ_LEN) uniq2 (wnn-const WNN_UNIQ_LEN) passwd (wnn-const WNN_PASSWD_LEN)) (list type uniq1 uniq2 passwd))))) (defun wnn7rpc-get-file-header (filename) (wnn7rpc-with-temp-buffer (if (null (file-readable-p filename)) (list nil (make-string (wnn-const WNN_UNIQ_LEN) 0) "" "") (insert-file-contents filename nil 0 (wnn-const WNN_FILE_HEADER_LEN)) (wnn7rpc-scan-file-header)))) (defun wnn7rpc-check-local-file (path &optional preserve) (let ((header (wnn7rpc-get-file-header path))) (cond ((null header) (- (wnn-const WNN_NOT_A_FILE))) ((null (car header)) (if (file-exists-p path) (- (wnn-const WNN_OPENF_ERR)) (- (wnn-const WNN_NO_EXIST)))) (t (if (wnn7rpc-check-inode header path) header (if preserve (- (wnn-const WNN_INODE_CHECK_ERROR)) (wnn7rpc-change-file-uniq header path) (wnn7rpc-check-local-file path t))))))) (defsubst wnn7rpc-get-inode (uniq) (+ (lsh (aref uniq 8) 24) (lsh (aref uniq 9) 16) (lsh (aref uniq 10) 8) (aref uniq 11))) (defun wnn7rpc-check-inode (header path) (let ((inode (nth 10 (file-attributes path)))) (and inode (= inode (wnn7rpc-get-inode (nth 1 header)))))) (defun wnn7rpc-make-uniq (attributes) (wnn7rpc-with-temp-buffer (let ((ctime (nth 6 attributes)) (ino (nth 10 attributes)) (devno (nth 11 attributes))) (if (numberp devno) (comm-format (U i u V) ctime devno ino wnn-system-name (wnn-const WNN_HOST_LEN)) ;; Emacs 21 returns returns negative devno as 16 bits uint pair (comm-format (U U u V) ctime (list (car devno) (cdr devno)) ino wnn-system-name (wnn-const WNN_HOST_LEN))) (buffer-string)))) (defun wnn7rpc-change-file-uniq (header path &optional new) (wnn7rpc-with-write-file path nil (insert-file-contents path) (if (wnn7rpc-scan-file-header) (let ((uniq (wnn7rpc-make-uniq (file-attributes path)))) (goto-char (1+ (wnn-const WNN_FILE_STRING_LEN))) (delete-region (point) (1+ (wnn-const WNN_FILE_HEADER_LEN))) (comm-format (u v v v v) (car header) uniq (wnn-const WNN_UNIQ_LEN) (if new uniq (nth 1 header)) (wnn-const WNN_UNIQ_LEN) (nth 3 header) (wnn-const WNN_PASSWD_LEN) "" (wnn-const WNN_FILE_HEADER_PAD)) t)))) (defun wnn7rpc-check-passwd (proc passwd header) (let ((env-id -1)) (unwind-protect (if (< (setq env-id (wnn7rpc-connect proc "")) 0) -1 (wnn7rpc-call-with-environment (wnn7-env-create proc env-id) (file-id) (comm-format (u u v) (wnn-const JS_FILE_SEND) env-id (nth 1 header) (wnn-const WNN_UNIQ_LEN)) (comm-unpack (u) file-id) (if (>= file-id 0) (progn (wnn7rpc-get-result) ; ignore result code (- (wnn-const WNN_FILE_IN_USE))) (wnn7rpc-get-result (comm-call-with-proc-1 proc () (comm-format (s B) (concat wnn-system-name "!TEMPFILE") (wnn7rpc-make-dummy-dictionary header)) (wnn7rpc-get-result (let ((egg-fixed-euc (list egg-fixed-euc egg-fixed-euc))) (wnn7rpc-set-dictionary (wnn7-env-create proc env-id) result -1 1 t t passwd "" nil)))))))) (if (>= env-id 0) (wnn7rpc-disconnect (wnn7-env-create proc env-id)))))) (defun wnn7rpc-make-dummy-dictionary (header) (wnn7rpc-with-temp-buffer (comm-format (v u v v v v u v) ;;; (wnn-const WNN_FILE_STRING) (wnn-const WNN_FILE_STRING_LEN) (wnn-const WNN_FILE_STRING7) (wnn-const WNN_FILE_STRING_LEN) (wnn-const WNN_FT_DICT_FILE) (nth 1 header) (wnn-const WNN_UNIQ_LEN) (nth 1 header) (wnn-const WNN_UNIQ_LEN) (nth 3 header) (wnn-const WNN_PASSWD_LEN) "" (wnn-const WNN_FILE_HEADER_PAD) (wnn-const WNN_REV_DICT) "" (wnn-const WNN_FILE_BODY_PAD)) (buffer-string))) (defun wnn7rpc-file-loaded-local (proc path &optional preserve) "" (let ((header (wnn7rpc-check-local-file path preserve))) (if (numberp header) -1 (comm-call-with-proc proc (result) (comm-format (u v) (wnn-const JS_FILE_LOADED_LOCAL) (nth 1 header) (wnn-const WNN_UNIQ_LEN)) (comm-unpack (u) result) result)))) (defun wnn7rpc-file-receive (env fid local-filename) "" (condition-case err (wnn7rpc-call-with-environment env (filename) (comm-format (u u u) (wnn-const JS_FILE_RECEIVE) env-id fid) (comm-unpack (s) filename) (if (null local-filename) (setq local-filename (wnn7rpc-get-local-filename filename))) (let ((header (wnn7rpc-get-file-header local-filename)) contents) (if (null header) (wnn7rpc-terminate-current-command WNN_NOT_A_FILE) (comm-call-with-proc-1 proc () (comm-format (u v) (wnn-const WNN_ACK) (nth 1 header) (wnn-const WNN_UNIQ_LEN))) (wnn7rpc-get-result (cond ((= result 0) 0) ((null (file-writable-p local-filename)) (wnn7rpc-terminate-current-command WNN_FILE_WRITE_ERROR)) (t (wnn7rpc-with-write-file local-filename (- (wnn-const WNN_FILE_WRITE_ERROR)) (comm-call-with-proc proc () (comm-format (u) (wnn-const WNN_ACK)) (comm-unpack (B) contents)) (insert contents) (if (= result 2) (insert-file-contents local-filename nil (1- (point)))) (save-excursion (set-buffer (process-buffer proc)) (wnn7rpc-get-result))))))))) ((quit error) (wnn7rpc-call-with-environment env () (comm-format (i) (wnn-const WNN_NAK))) (signal (car err) (cdr err))))) (defun wnn7rpc-file-send (env filename) "" (let ((header (wnn7rpc-check-local-file filename))) (if (numberp header) header (condition-case err (wnn7rpc-call-with-environment env (file-id) (comm-format (u u v) (wnn-const JS_FILE_SEND) env-id (nth 1 header) (wnn-const WNN_UNIQ_LEN)) (comm-unpack (u) file-id) (if (>= file-id 0) (wnn7rpc-get-result (wnn7env-set-client-file env filename) file-id) (wnn7rpc-get-result (comm-call-with-proc-1 proc () (comm-format (s B) (concat wnn-system-name "!" filename) (wnn7rpc-with-temp-buffer (insert-file-contents filename) (buffer-string))) (wnn7rpc-get-result (wnn7env-set-client-file env filename) result))))) ((quit error) (wnn7rpc-call-with-environment env () (comm-format (s B B B B B B) "" "" "" "" "" "" "")) (signal (car err) (cdr err))))))) (defun wnn7rpc-file-remove-client (proc name passwd) (let (header) (cond ((/= (wnn7rpc-file-loaded-local proc name) -1) (- (wnn-const WNN_FILE_IN_USE))) ((null (file-readable-p name)) (- (wnn-const WNN_FILE_READ_ERROR))) ((null (numberp (car (setq header (wnn7rpc-get-file-header name))))) (- (wnn-const WNN_NOT_A_FILE))) ((< (wnn7rpc-check-passwd proc passwd header) 0) (- (wnn-const WNN_INCORRECT_PASSWD))) (t (condition-case nil (progn (delete-file name) 0) (error (- (wnn-const WNN_UNLINK)))))))) (defun wnn7rpc-dic-file-create-client (env dicname type comment passwd hpasswd) (if (and (null (file-exists-p dicname)) (file-writable-p dicname) (or (eq type (wnn-const WNN_REV_DICT)) (eq type (wnn-const CWNN_REV_DICT)) (eq type (wnn-const BWNN_REV_DICT)) (eq type (wnn-const WNN_UD_DICT)) (eq type (wnn-const WNN_FI_USER_DICT))) (wnn7rpc-create-and-move-to-client env nil dicname type comment passwd hpasswd)) 0 (- (wnn-const WNN_FILE_CREATE_ERROR)))) (defun wnn7rpc-hindo-file-create-client (env fi dic-id freqname comment passwd) (if (and (null (file-exists-p freqname)) (file-writable-p freqname) (wnn7rpc-create-and-move-to-client env dic-id freqname fi comment passwd nil)) 0 (- (wnn-const WNN_FILE_CREATE_ERROR)))) (defun wnn7rpc-make-temp-name (env) (let ((n 0) (temp-form "usr/temp")) (while (= (wnn7rpc-access env (concat temp-form (number-to-string n)) 0) 0) (setq n (1+ n))) (concat temp-form (number-to-string n)))) (defun wnn7rpc-create-and-move-to-client (env dic-id filename type comment passwd hpasswd) (let ((tempfile (wnn7rpc-make-temp-name env)) (created -1) (fid -1)) (unwind-protect (progn (if (numberp type) (setq created (wnn7rpc-dic-file-create env tempfile type comment passwd hpasswd)) (setq created (wnn7rpc-hindo-file-create env type dic-id tempfile comment passwd))) (if (and (>= created 0) (>= (setq fid (wnn7rpc-file-read env tempfile)) 0) (>= (wnn7rpc-file-receive env fid filename) 0)) (wnn7rpc-change-file-uniq (wnn7rpc-get-file-header filename) filename t) (condition-case nil (delete-file filename) (error)) nil)) (if (>= fid 0) (wnn7rpc-file-discard env fid)) (if (>= created 0) (wnn7rpc-file-remove (wnn7env-get-proc env) tempfile passwd))))) (defun wnn7rpc-read-passwd-file (filename) (cond ((null filename) "") ((null (file-readable-p filename)) (- (wnn-const WNN_FILE_READ_ERROR))) (t (wnn7rpc-with-temp-buffer (insert-file-contents filename nil 0 (1- (wnn-const WNN_PASSWD_LEN))) (goto-char 1) (if (and (search-forward-regexp "[\0\n]" nil 0) (= (preceding-char) 0)) (backward-char)) (buffer-substring 1 (point)))))) ;;; ;;; Wnn7 new function: ;;; Input Prediction ;;; ;;; (defun wnn7rpc-yosoku-init (env) "Initialize input prediction function" (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_YOSOKU_INIT) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-free (env) "Free input prediction function area from server." (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_YOSOKU_FREE) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-yosoku (env moji) "Execute input prediction." (wnn7rpc-call-with-environment env (candnum len kouho kouho-list) (comm-format (u u E) (wnn-const JS_YOSOKU_YOSOKU) env-id moji) (wnn7rpc-get-result (comm-unpack (u) candnum) (while (> candnum 0) (comm-unpack (u s) len kouho) (setq kouho (decode-coding-string kouho 'euc-jp)) (setq kouho-list (nconc kouho-list (list kouho)) candnum (1- candnum))) kouho-list))) (defun wnn7rpc-yosoku-toroku (env bun-suu yosoku-bunsetsu) "Register the input prediction candidate." (wnn7rpc-call-with-environment env () (progn (comm-format (u u u) (wnn-const JS_YOSOKU_TOROKU) env-id bun-suu) (while yosoku-bunsetsu (comm-format (E u E u u) (aref (car yosoku-bunsetsu) 0) (aref (car yosoku-bunsetsu) 1) (aref (car yosoku-bunsetsu) 2) (aref (car yosoku-bunsetsu) 3) (aref (car yosoku-bunsetsu) 4)) (setq yosoku-bunsetsu (cdr yosoku-bunsetsu)))) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-selected-cand (env selectpos) "Select the input prediction candidate." (wnn7rpc-call-with-environment env () (comm-format (u u u) (wnn-const JS_YOSOKU_SELECTED_CAND) env-id selectpos) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-delete-cand (env selectpos) "Delete the input prediction candidate." (wnn7rpc-call-with-environment env () (comm-format (u u u) (wnn-const JS_YOSOKU_DELETE_CAND) env-id selectpos) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-cancel-latest-toroku (env) "Cancel the latest registered word." (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_YOSOKU_CANCEL_LATEST_TOROKU) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-reset-pre-yosoku (env) "Clear the connection information for the latest registered word." (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_YOSOKU_RESET_PRE_YOSOKU) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-ikkatsu-toroku (env torokustr) "Register the input prediction candidate with phrase analysis." (wnn7rpc-call-with-environment env () (comm-format (u u S) (wnn-const JS_YOSOKU_IKKATSU_TOROKU) env-id torokustr) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-save-datalist (env) "Save the input prediction data in data file." (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_YOSOKU_SAVE_DATALIST) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-init-time-keydata (env) "Initialize input efficiency data about inputed key." (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_YOSOKU_INIT_TIME_KEYDATA) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-init-inputinfo (env) "Initialize input efficiency data about input time." (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_YOSOKU_INIT_INPUTINFO) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-set-user-inputinfo (env allkey userkey yosokuselect) "Set user input information to the input efficiency data." (wnn7rpc-call-with-environment env () (comm-format (u u u u) (wnn-const JS_YOSOKU_SET_USER_INPUTINFO) env-id allkey (if yosokuselect (logior userkey ?\x8000) userkey)) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-set-timeinfo (env yosokuselect throughyosoku inputtime keylen) "Set input-time information to the input efficiency data." (wnn7rpc-call-with-environment env () (comm-format (u u u u u u) (wnn-const JS_YOSOKU_SET_TIMEINFO) env-id yosokuselect throughyosoku inputtime keylen) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-status (env) "Get input efficiency information." (wnn7rpc-call-with-environment env (totalrod totalallkey totaluserkey totalrot totalalltime totalusertime stmday sthour stmin ltmday lthour ltmin totalroykinput totalallykkey nowrod nowallkey nowuserkey nowrot nowalltime nowusertime timeperonekey) (comm-format (u u) (wnn-const JS_YOSOKU_STATUS) env-id) (comm-unpack (u) totalrod) (if (< totalrod 0) totalrod (comm-unpack (u u u u u u u u u u u u u u u u u u u u) totalallkey totaluserkey totalrot totalalltime totalusertime stmday sthour stmin ltmday lthour ltmin totalroykinput totalallykkey nowrod nowallkey nowuserkey nowrot nowalltime nowusertime timeperonekey) (vector totalrod totalallkey totaluserkey totalrot totalalltime totalusertime stmday sthour stmin ltmday lthour ltmin totalroykinput totalallykkey nowrod nowallkey nowuserkey nowrot nowalltime nowusertime timeperonekey)))) ;;; ;;; Wnn7 new function: ;;; association translation ;;; (defun wnn7rpc-assoc-with-data (env yomi hinsi fuzokugo v jilihin yomi_org jililen yomilen kanjilen real_kanjilen) "Convert YOMI string into Kanji with association." (wnn7rpc-call-with-environment env (kanji-length) (comm-format (u u S i S i i u S i i i i) (wnn-const JS_HENKAN_ASSOC) env-id yomi hinsi fuzokugo (or v (wnn-const WNN_VECT_KANZEN)) (if v (wnn-const WNN_VECT_KANZEN) (wnn-const WNN_VECT_NO)) jilihin yomi_org jililen yomilen kanjilen real_kanjilen) (wnn7rpc-get-result (comm-unpack (u) kanji-length) ; ignore kanji-length (mapcar (lambda (b) (wnn7-bunsetsu-set-dai-continue b (wnn7-bunsetsu-connect-next b)) (list b)) (wnn7rpc-receive-sho-bunsetsu-list env result))))) (defun wnn7rpc-set-henkan-hinshi (env mode nhinshi hlist) "" (wnn7rpc-call-with-environment env () (progn (comm-format (u u i i) (wnn-const JS_SET_HENKAN_HINSI) env-id mode nhinshi) (while hlist (comm-format (u) (car hlist)) (setq hlist (cdr hlist)))) (wnn7rpc-get-result))) (provide 'wnn7egg-rpc) ;;; wnn7egg-rpc.el ends here. wnn7egg-1.02.orig/elisp/emacs20/wnn7egg.el0100644000764400003210000031457507474174160020430 0ustar ishikawaishikawa;; Wnn7Egg is Egg modified for Wnn7, and the current maintainer ;; is OMRON SOFTWARE Co., Ltd. ;; ;; This file is part of Wnn7Egg. (base code is egg.el (eggV3.09)) ;; ;;; ------------------------------------------------------------------ ;;; ;;; Wnn7Egg $B!J(BWnn "$B$J$J(B"$B$?$^$4!K(B--- Wnn7 Emacs Client ;;; ;;; Wnn7Egg $B$O!"!V$?$^$4Bh#3HG!W(Bv3.09 $B$r%Y!<%9$K(B $B!V$?$^$4Bh#4HG!W$NDL?.!"(B ;;; $B%i%$%V%i%jIt$rAH$_9~$s$@!"(BWnn7 $B$N0Y$N@lMQ%/%i%$%"%s%H$G$9!#(B ;;; ;;; $B$9$Y$F$N%=!<%9$,(B Emacs Lisp $B$G5-=R$5$l$F$$$k$N$G!"(BWnn SDK/Library $B$rI,MW(B ;;; $B$H$;$:!"(BGNU Emacs $B5Z$S(B XEmacs $B4D6-$G;HMQ$9$k$3$H$,$G$-$^$9!#;HMQ5vBz>r7o(B ;;; $B$O(B GPL $B$G$9!#(B ;;; ;;; GNU Emacs 20.3 $B0J9_!"(BXEmacs 21.x $B0J9_$GF0:n3NG'$7$F$$$^$9!#(B ;;; ;;; ;;; Wnn7Egg $B$O(B Wnn7 $B$N5!G=$G$"$k3Z!9F~NO!JF~NOM=B,!K!"O"A[JQ49$r%5%]!<%H(B ;;; $B$7$F$$$^$9!#(B ;;; ;;; $B!V$?$^$4!W$HFHN)!?6&B8$G$-$k$h$&$K!"1F6A$9$k$r(B ;;; "wnn7..." $B$H$$$&7A$KJQ99$7$F$$$^$9!#(B ;;; ;;; ------------------------------------------------------------------ ;; Japanese Character Input Package for Egg ;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) ;; This file is part of Egg on Mule (Multilingal Environment) ;; Egg is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; Egg is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to ;; the Free Software Foundation, 59 Temple Place - Suite 330, Boston, ;; MA 02111-1307, USA. ;;;================================================================== ;;; ;;; $BF|K\8l4D6-(B $B!V$?$^$4!W(B $BBh#3HG(B ;;; ;;;=================================================================== ;;; ;;;$B!V$?$^$4!W$O%M%C%H%o!<%/$+$J4A;zJQ49%5!<%P$rMxMQ$7!"(BMule $B$G$NF|K\(B ;;; $B8l4D6-$rDs6!$9$k%7%9%F%`$G$9!#!V$?$^$4!WBh#2HG$G$O(B Wnn V3 $B$*$h$S(B ;;; Wnn V4 $B$N$+$J4A;zJQ49%5!<%P$r;HMQ$7$F$$$^$9!#(B ;;; ;;; $BL>A0$O(B $B!VBt;3(B/$BBT$?$;$F(B/$B$4$a$s$J$5$$!W$N3FJ8@a$N@hF,#12;$G$"$k!V$?!W(B ;;; $B$H!V$^!W$H!V$4!W$r$K0M$k$b$N$G$9!#(Begg $B$O!V$?$^$4!W$N1QLu$G$9!#(B ;;; ;;; $B;HMQK!$O(B info/egg-jp $B$r8+$F2<$5$$!#(B ;;; ;;; ;;; $B!V$?$^$4!W$K4X$9$kDs0F!"Cn>pJs$O(B tomura@etl.go.jp $B$K$*Aw$j2<$5$$!#(B ;;; ;;; ;;; $B")(B 305 $B0q>k8)$D$/$P;TG_1`(B1-1-4 ;;; $BDL;:>J9)6H5;=Q1!EE;R5;=QAm9g8&5f=j(B ;;; $B>pJs%"!<%-%F%/%A%cIt8@8l%7%9%F%`8&5f<<(B ;;; ;;; $B8MB<(B $BE/(B ;;; ;;; ($BCm0U(B)$B$3$N%U%!%$%k$O4A;z%3!<%I$r4^$s$G$$$^$9!#(B ;;; ;;; $BBh#3HG(B $B#1#9#9#1G/#27n(B $B#4F|(B ;;; $BBh#2HG(B $B#1#9#8#9G/#67n(B $B#1F|(B ;;; $BBh#1HG(B $B#1#9#8#8G/#77n#1#4F|(B ;;; $B;CDjHG(B $B#1#9#8#8G/#67n#2#4F|(B ;;;=================================================================== ;;; ;;; (eval-when (load) (require 'wnn-client)) ;;; (defvar egg-version "3.11 wnn7" "Version number of this version of Egg. ") ;;; Last modified date: Sun Sep 30 00:00:00 2001 ;;;; $B=$@5MW5a%j%9%H(B ;;;; read-hiragana-string, read-kanji-string $B$G;HMQ$9$kJ?2>L>F~NO%^%C%W$r(B roma-kana $B$K8GDj$7$J$$$GM_$7$$!%(B ;;;; $B=$@5%a%b(B ;;; 01.9.30 modified by OMRON SOFTWARE Co.,Ltd. ;;; $B%X%k%W%b!<%I$H%j!<%8%g%s;XDj$N4X?tL>$N=$@5(B ;;; 01.5.30 modified by OMRON SOFTWARE Co., Ltd. ;;; Wnn7 $B@\B3$N0Y$N5!G=DI2C!JF~NOM=B,!uO"A[JQ49!K(B ;;; XEmacs $B;HMQ$*$h$S(B egg v3.10 $B$H$N6&B8$N$?$a$N0lIt=$@5(B ;;; 95.6.5 modified by S.Tomura ;;; $BJQ49D>8e$KO"B3$7$FJQ49$9$k>l9g$rG'<1$9$k$?$a$K!"(B"-in-cont" $B$K4XO"$7$?(B ;;; $BItJ,$rDI2C$7$?!#!J$3$NItJ,$O>-Mh:F=$@5$9$kM=Dj!#!K(B ;;; 93.6.19 modified by T.Shingu ;;; egg:*in-fence-mode* should be buffer local. ;;; 93.6.4 modified by T.Shingu ;;; In its-defrule**, length is called instead of chars-in-string. ;;; 93.3.15 modified by T.Enami ;;; egg-self-insert-command simulates the original more perfectly. ;;; 92.12.20 modified by S.Tomura ;;; In its:simulate-input, sref is called instead of aref. ;;; 92.12.20 modified by T.Enami ;;; egg-self-insert-command calls cancel-undo-boundary to simulate original. ;;; 92.11.4 modified by M.Higashida ;;; read-hiragana-string sets minibuffer-preprompt correctly. ;;; 92.10.26, 92.10.30 modified by T.Saneto sanewo@pdp.crl.sony.co.jp ;;; typo fixed. ;;; 92.10.18 modified by K. Handa ;;; special-symbol-input $BMQ$N%F!<%V%k$r(B autoload $B$K!#(B ;;; busyu.el $B$N(B autoload $B$N;XDj$r(B mule-init.el $B$+$i(B egg.el $B$K0\$9!#(B ;;; 92.9.20 modified by S. Tomura ;;;; hiragana-region $B$NCn$N=$@5(B ;;;; 92.9.19 modified by Y. Kawabe ;;;; some typos ;;;; 92.9.19 modified by Y. Kawabe ;;;; menu $B$NI=<(4X78$N(B lenght $B$r(B string-width $B$KCV$-49$($k!%(B ;;; 92.8.19 modified for Mule Ver.0.9.6 by K.Handa ;;;; menu:select-from-menu calls string-width instead of length. ;;;; 92.8.1 modified by S. Tomura ;;;; internal mode $B$rDI2C!%(Bits:*internal-mode-alist* $BDI2C!%(B ;;;; 92.7.31 modified by S. Tomura ;;;; its-mode-map $B$,(B super mode map $B$r;}$D$h$&$KJQ99$7$?!%$3$l$K$h$j(B ;;;; mode map $B$,6&M-$G$-$k!%(B its-define-mode, get-next-map $B$J$I$rJQ99!%(B ;;;; get-next-map-locally $B$rDI2C!%(Bits-defrule** $B$rJQ99!%(B ;;;; 92.7.31 modified by S. Tomura ;;;; its:make-kanji-buffer , its:*kanji* $B4XO"%3!<%I$r:o=|$7$?!%(B ;;;; 92.7.31 modified by S. Tomura ;;;; egg:select-window-hook $B$r=$@5$7!$(Bminibuffer $B$+$i(B exit $B$9$k$H$-$K!$(B ;;;; $B3F ;;; Attribute bold can be used. ;;; Unnecessary '*' in comments of variables deleted. ;;; 92.7.8 modified for Mule Ver.0.9.5 by Y.Kawabe ;;; special-symbol-input keeps the position selected last. ;;; 92.7.8 modified for Mule Ver.0.9.5 by T.Shingu ;;; busyu-input and kakusuu-input are added in *symbol-input-menu*. ;;; 92.7.7 modified for Mule Ver.0.9.5 by K.Handa ;;; In egg:quit-mode, overwrite-mode is supported correctly. ;;; egg:*overwrite-mode-deleted-chars* is not used now. ;;; 92.6.26 modified for Mule Ver.0.9.5 by K.Handa ;;; Funtion dump-its-mode-map gets obsolete. ;;; 92.6.26 modified for Mule Ver.0.9.5 by M.Shikida ;;; Backquote ` is registered in *hankaku-alist* and *zenkaku-alist*. ;;; 92.6.17 modified for Mule Ver.0.9.5 by T.Shingu ;;; Bug in make-jis-second-level-code-alist fixed. ;;; 92.6.14 modified for Mule Ver.0.9.5 by T.Enami ;;; menu:select-from-menu is replaced with new version. ;;; 92.5.18 modified for Mule Ver.0.9.4 by T.Shingu ;;; lisp/wnn-egg.el is devided into two parts: this file and wnn*-egg.el. ;;;; ;;;; Mule Ver.0.9.3 $B0JA0(B ;;;; ;;;; April-15-92 for Mule Ver.0.9.3 ;;;; by T.Enami and K.Handa ;;;; notify-internal calls 'message' with correct argument. ;;;; April-11-92 for Mule Ver.0.9.3 ;;;; by T.Enami and K.Handa ;;;; minibuffer $B$+$iH4$1$k;~(B egg:select-window-hook $B$G(B egg:*input-mode* $B$r(B ;;;; t $B$K$9$k!#(Bhook $B$N7A$rBgI}=$@5!#(B ;;;; April-3-92 for Mule Ver.0.9.2 by T.Enami ;;;; minibuffer $B$+$iH4$1$k;~(B egg:select-window-hook $B$,(B new-buffer $B$N(B ;;;; egg:*mode-on* $B$J$I$r(B nil $B$K$7$F$$$k$N$r=$@5!#(B ;;;; Mar-22-92 by K.Handa ;;;; etags $B$,:n$k(B TAGS $B$KITI,MW$J$b$N$rF~$l$J$$$h$&$K$9$k$?$a4X?tL>JQ99(B ;;;; define-its-mode -> its-define-mode, defrule -> its-defrule ;;;; Mar-16-92 by K.Handa ;;;; global-map $B$X$N(B define-key $B$r(B mule-keymap $B$KJQ99!#(B ;;;; Mar-13-92 by K.Handa ;;;; Language specific part $B$r(B japanese.el,... $B$K0\$7$?!#(B ;;;; Feb-*-92 by K. Handa ;;;; nemacs 4 $B$G$O(B minibuffer-window-selected $B$,GQ;_$K$J$j!$4XO"$9$k%3!<%I$r:o=|$7$?!%(B ;;;; Jan-13-92 by S. Tomura ;;;; mc-emacs or nemacs 4 $BBP1~:n6H3+;O!%(B ;;;; Aug-9-91 by S. Tomura ;;;; ?\^ $B$r(B ?^ $B$K=$@5!%(B ;;;; menu $B$r(B key map $B$r8+$k$h$&$K$9$k!%(B ;;;; Jul-6-91 by S. Tomura ;;;; setsysdict $B$N(B error $B%a%C%;!<%8$rJQ99!%(B ;;;; Jun-11-91 by S. Tomura ;;;; its:*defrule-verbose* $B$rDI2C!%(B ;;;; ;;;; Mar-25-91 by S. Tomura ;;;; reset-its-mode $B$rGQ;_(B ;;;; Mar-23-91 by S. Tomura ;;;; read-hiragana-string $B$r=$@5!$(B read-kanji-string $B$rDI2C!$(B ;;;; isearch:read-kanji-string $B$r@_Dj!%(B ;;;; Mar-22-91 by S. Tomura ;;;; defrule-conditional, defrule-select-mode-temporally $B$rDI2C!#(B ;;;; for-each $B$N4J0WHG$H$7$F(B dolist $B$rDI2C!#(B ;;;; enable-double-n-syntax $B$r3hMQ!%$[$+$K(B use-kuten-for-comma, use-touten-for-period $B$rDI2C(B ;;;; Mar-5-91 by S. Tomura ;;;; roma-kana-word, henkan-word, roma-kanji-word $B$rDI2C$7$?!%(B ;;;; Jan-14-91 by S. Tomura ;;;; $BF~NOJ8;zJQ497O(B ITS(Input character Translation System) $B$r2~B$$9$k!%(B ;;;; $BJQ49$O:G:8:GD9JQ49$r9T$J$$!$JQ49$N$J$$$b$N$O$b$H$N$^$^$H$J$k!%(B ;;;; $B2~B$$NF05!$ON)LZ!w7D1~$5$s$N%O%s%0%kJ8;z$NF~NOMW5a$G$"$k!%(B ;;;; its:* $B$rDI2C$7$?!%$^$?=>Mh(B fence-self-insert-command $B$H(B roma-kana-region ;;;; $BFs2U=j$K$o$+$l$F$$$?%3!<%I$r(B its:translate-region $B$K$h$C$F0lK\2=$7$?!%(B ;;;; July-30-90 by S. Tomura ;;;; henkan-region $B$r(Boverwrite-mode $B$KBP1~$5$;$k!%JQ?t(B ;;;; egg:*henkan-fence-mode*, egg:*overwrite-mode-deleted-chars* ;;;; $B$rDI2C$7!$(Bhenkan-fence-region, henkan-region-internal, ;;;; quit-egg-mode $B$rJQ99$9$k!%(B ;;;; Mar-4-90 by K.Handa ;;;; New variable alphabet-mode-indicator, transparent-mode-indicator, ;;;; and henkan-mode-indicator. ;;;; Feb-27-90 by enami@ptgd.sony.co.jp ;;;; menu:select-from-menu $B$G#22U=j$"$k(B ((and (<= ?0 ch) (<= ch ?9)... ;;;; $B$N0lJ}$r(B ((and (<= ?0 ch) (<= ch ?9)... $B$K=$@5(B ;;;; Feb-07-89 ;;;; bunsetu-length-henko $B$NCf$N(B egg:*attribute-off $B$N0LCV$r(B KKCP $B$r8F$VA0$K(B ;;;; $BJQ99$9$k!#(B wnn-client $B$G$O(B KKCP $B$r8F$V$HJ8@a>pJs$,JQ2=$9$k!#(B ;;;; Feb-01-89 ;;;; henkan-goto-kouho $B$N(B egg:set-bunsetu-attribute $B$N0z?t(B ;;;; $B$N=gHV$,4V0c$C$F$$$?$N$r=$@5$7$?!#!J(Btoshi@isvax.isl.melco.co.jp ;;;; (Toshiyuki Ito)$B$N;XE&$K$h$k!#!K(B ;;;; Dec-25-89 ;;;; meta-flag t $B$N>l9g$NBP1~$r:F=$@5$9$k!#(B ;;;; overwrite-mode $B$G$N(B undo $B$r2~A1$9$k!#(B ;;;; Dec-21-89 ;;;; bug fixed by enami@ptdg.sony.co.jp ;;;; (fboundp 'minibuffer-window-selected ) ;;;; -->(boundp 'minibuffer-window-selected ) ;;;; self-insert-after-hook $B$r(B buffer local $B$K$7$FDj5A$r(B kanji.el $B$X0\F0!#(B ;;;; Dec-15-89 ;;;; kill-all-local-variables $B$NDj5A$r(B kanji.el $B$X0\F0$9$k!#(B ;;;; Dec-14-89 ;;;; meta-flag t $B$N>l9g$N=hM}$r=$@5$9$k(B ;;;; overwrite-mode $B$KBP1~$9$k!#(B ;;;; Dec-12-89 ;;;; egg:*henkan-open*, egg:*henkan-close* $B$rDI2C!#(B ;;;; egg:*henkan-attribute* $B$rDI2C(B ;;;; set-egg-fence-mode-format, set-egg-henkan-mode-format $B$rDI2C(B ;;;; Dec-12-89 ;;;; *bunpo-code* $B$K(B 1000: "$B$=$NB>(B" $B$rDI2C(B ;;;; Dec-11-89 ;;;; egg:*fence-attribute* $B$r?7@_(B ;;;; egg:*bunsetu-attribute* $B$r?7@_(B ;;;; Dec-11-89 ;;;; attribute-*-region $B$rMxMQ$9$k$h$&$KJQ99$9$k!#(B ;;;; menu:make-selection-list $B$O(B width $B$,>.$5$$;~$K(Bloop $B$9$k!#$3$l$r=$@5$7$?!#(B ;;;; Dec-10-89 ;;;; set-marker-type $B$rMxMQ$9$kJ}<0$KJQ99!#(B ;;;; Dec-07-89 ;;;; egg:search-path $B$rDI2C!#(B ;;;; egg-default-startup-file $B$rDI2C$9$k!#(B ;;;; Nov-22-89 ;;;; egg-startup-file $B$rDI2C$9$k!#(B ;;;; eggrc-search-path $B$r(B egg-startup-file-search-path $B$KL>A0JQ99!#(B ;;;; Nov-21-89 ;;;; Nemacs 3.2 $B$KBP1~$9$k!#(Bkanji-load* $B$rGQ;_$9$k!#(B ;;;; wnnfns.c $B$KBP1~$7$?=$@5$r2C$($k!#(B ;;;; *Notification* buffer $B$r8+$($J$/$9$k!#(B ;;;; Oct-2-89 ;;;; *zenkaku-alist* $B$N(B $BJ8;zDj?t$N=q$-J}$,4V0c$C$F$$$?!#(B ;;;; Sep-19-89 ;;;; toggle-egg-mode $B$N=$@5!J(Bkanji-flag$B!K(B ;;;; egg-self-insert-command $B$N=$@5(B $B!J(Bkanji-flag$B!K(B ;;;; Sep-18-89 ;;;; self-insert-after-hook $B$NDI2C(B ;;;; Sep-15-89 ;;;; EGG:open-wnn bug fix ;;;; provide wnn-egg feature ;;;; Sep-13-89 ;;;; henkan-kakutei-before-point $B$r=$@5$7$?!#(B ;;;; enter-fence-mode $B$NDI2C!#(B ;;;; egg-exit-hook $B$NDI2C!#(B ;;;; henkan-region-internal $B$NDI2C!#(Bhenkan-region$B$O(B point $B$r(Bmark $B$9$k!#(B ;;;; eggrc-search-path $B$NDI2C!#(B ;;;; Aug-30-89 ;;;; kanji-kanji-1st $B$rD{@5$7$?!#(B ;;;; May-30-89 ;;;; EGG:open-wnn $B$O(B get-wnn-host-name $B$,(B nil $B$N>l9g!"(B(system-name) $B$r;HMQ$9$k!#(B ;;;; May-9-89 ;;;; KKCP:make-directory added. ;;;; KKCP:file-access bug fixed. ;;;; set-default-usr-dic-directory modified. ;;;; Mar-16-89 ;;;; minibuffer-window-selected $B$r;H$C$F(B minibuffer $B$N(B egg-mode$BI=<(5!G=DI2C(B ;;;; Mar-13-89 ;;;; mode-line-format changed. ;;;; Feb-27-89 ;;;; henkan-saishou-bunsetu added ;;;; henkan-saichou-bunsetu added ;;;; M-< henkan-saishou-bunsetu ;;;; M-> henkan-saichou-bunsetu ;;;; Feb-14-89 ;;;; C-h in henkan mode: help-command added ;;;; Feb-7-89 ;;;; egg-insert-after-hook is added. ;;;; M-h fence-hiragana ;;;; M-k fence-katakana ;;;; M-> fence-zenkaku ;;;; M-< fence-hankaku ;;;; Dec-19-88 henkan-hiragana, henkan-katakara$B$rDI2C!'(B ;;;; M-h henkan-hiragana ;;;; M-k henkan-katakana ;;;; Ver. 2.00 kana2kanji.c $B$r;H$o$:(B wnn-client.el $B$r;HMQ$9$k$h$&$KJQ99!#(B ;;;; $B4XO"$7$F0lIt4X?t$rJQ99(B ;;;; Dec-2-88 special-symbol-input $B$rDI2C!((B ;;;; C-^ special-symbol-input ;;;; Nov-18-88 henkan-mode-map $B0lItJQ99!((B ;;;; M-i henkan-inspect-bunsetu ;;;; M-s henkan-select-kouho ;;;; C-g henkan-quit ;;;; Nov-18-88 jserver-henkan-kakutei $B$N;EMMJQ99$KH<$$!"(Bkakutei $B$N%3!<(B ;;;; $B%I$rJQ99$7$?!#(B ;;;; Nov-17-88 kakutei-before-point $B$G(B point $B0J9_$N4V0c$C$?ItJ,$NJQ49(B ;;;; $B$,IQEY>pJs$KEPO?$5$l$J$$$h$&$K=$@5$7$?!#$3$l$K$O(BKKCC:henkan-end ;;;; $B$N0lIt;EMM$HBP1~$9$k(Bkana2kanji.c$B$bJQ99$7$?!#(B ;;;; Nov-17-88 henkan-inspect-bunsetu $B$rDI2C$7$?!#(B ;;;; Nov-17-88 $B?7$7$$(B kana2kanji.c $B$KJQ99$9$k!#(B ;;;; Sep-28-88 defrule$B$,CM$H$7$F(Bnil$B$rJV$9$h$&$KJQ99$7$?!#(B ;;;; Aug-25-88 $BJQ493X=,$r@5$7$/9T$J$&$h$&$KJQ99$7$?!#(B ;;;; KKCP:henkan-kakutei$B$O(BKKCP:jikouho-list$B$r8F$s$@J8@a$KBP$7$F$N$_E,(B ;;;; $BMQ$G$-!"$=$l0J30$N>l9g$N7k2L$OJ]>Z$5$l$J$$!#$3$N>r7o$rK~$?$9$h$&(B ;;;; $B$K(BKKCP:jikouho-list$B$r8F$s$G$$$J$$J8@a$KBP$7$F$O(B ;;;; KKCP:henkan-kakutei$B$r8F$P$J$$$h$&$K$7$?!#(B ;;;; Aug-25-88 egg:do-auto-fill $B$r=$@5$7!"J#?t9T$K$o$?$k(Bauto-fill$B$r@5(B ;;;; $B$7$/9T$J$&$h$&$K=$@5$7$?!#(B ;;;; Aug-25-88 menu command$B$K(B\C-l: redraw $B$rDI2C$7$?!#(B ;;;; Aug-25-88 toroku-region$B$GEPO?$9$kJ8;zNs$+$i(Bno graphic character$B$r(B ;;;; $B<+F0E*$K=|$/$3$H$K$7$?!#(B (eval-when-compile (require 'wnn7egg-jsymbol)) ;;;---------------------------------------------------------------------- ;;; ;;; Utilities ;;; ;;;---------------------------------------------------------------------- ;;; ;;;; (if (and (featurep 'xemacs) (not (fboundp 'overlayp))) (require 'overlay)) (if (not (featurep 'xemacs)) (defun characterp (form) (numberp form)) ;; 97.2.4 Created by J.Hein to simulate Mule-2.3 (defun egg-read-event () "FSFmacs event emulator that shoves non key events into unread-command-events to facilitate translation from Mule-2.3" (let ((event (make-event)) ch key) (next-command-event event) (setq key (event-key event)) (if (and (key-press-event-p event) (not (event-matches-key-specifier-p event 'backspace))) (if (eq 0 (event-modifier-bits event)) (setq ch (or (event-to-character event) key)) (if (eq 1 (event-modifier-bits event)) (setq ch (if (characterp key) (or (int-to-char (- (char-to-int key) 96)) (int-to-char (- (char-to-int key) 64))) (event-to-character event))) (setq unread-command-events (list event)))) (setq unread-command-events (list event))) ch))) (defun coerce-string (form) (cond((stringp form) form) ((characterp form) (char-to-string form)))) (defun coerce-internal-string (form) (cond((stringp form) (if (= (length form) 1) (string-to-char form) form)) ((characterp form) form))) ;;; kill-all-local-variables $B$+$iJ]8n$9$k(B local variables $B$r;XDj$G$-$k(B ;;; $B$h$&$KJQ99$9$k!#(B (put 'egg:*input-mode* 'permanent-local t) (put 'egg:*mode-on* 'permanent-local t) (put 'its:*current-map* 'permanent-local t) (put 'mode-line-egg-mode 'permanent-local t) ;; undo functions. (make-variable-buffer-local (defvar egg-buffer-undo-list nil)) (make-variable-buffer-local (defvar egg-buffer-modified-flag nil)) (defun suspend-undo () (setq egg-buffer-undo-list buffer-undo-list egg-buffer-modified-flag (buffer-modified-p))) (defun resume-undo-list () (setq buffer-undo-list egg-buffer-undo-list) (if (not egg-buffer-modified-flag) (let ((time (visited-file-modtime))) (if (eq time 0) (setq time '(0 . 0))) (set 'buffer-undo-list (cons (cons t time) buffer-undo-list))))) ;;;---------------------------------------------------------------------- ;;; ;;; 16$B?JI=8=$N(BJIS $B4A;z%3!<%I$r(B minibuffer $B$+$iFI$_9~$`(B ;;; ;;;---------------------------------------------------------------------- ;;; ;;; User entry: jis-code-input ;;; (defun jis-code-input () (interactive) (insert-jis-code-from-minibuffer "JIS $B4A;z%3!<%I(B(16$B?J?tI=8=(B): ")) (defun insert-jis-code-from-minibuffer (prompt) (let ((str (read-from-minibuffer prompt)) val) (while (null (setq val (read-jis-code-from-string str))) (beep) (setq str (read-from-minibuffer prompt str))) (if (featurep 'xemacs) (insert (make-char (find-charset 'japanese-jisx0208) (car val) (cdr val))) (insert (make-char 'japanese-jisx0208 (car val) (cdr val)))))) (defun hexadigit-value (ch) (cond((and (<= ?0 ch) (<= ch ?9)) (- ch ?0)) ((and (<= ?a ch) (<= ch ?f)) (+ (- ch ?a) 10)) ((and (<= ?A ch) (<= ch ?F)) (+ (- ch ?A) 10)))) (defun read-jis-code-from-string (str) (if (and (= (length str) 4) (<= 2 (hexadigit-value (aref str 0))) (hexadigit-value (aref str 1)) (<= 2 (hexadigit-value (aref str 2))) (hexadigit-value (aref str 3))) (cons (+ (* 16 (hexadigit-value (aref str 0))) (hexadigit-value (aref str 1))) (+ (* 16 (hexadigit-value (aref str 2))) (hexadigit-value (aref str 3)))))) ;;;---------------------------------------------------------------------- ;;; ;;; $B!V$?$^$4!W(B Notification System ;;; ;;;---------------------------------------------------------------------- (defconst *notification-window* " *Notification* ") ;;;(defmacro notify (str &rest args) ;;; (list 'notify-internal ;;; (cons 'format (cons str args)))) (defun notify (str &rest args) (notify-internal (apply 'format (cons str args)))) (defun notify-internal (message &optional noerase) (save-excursion (set-buffer (get-buffer-create *notification-window*)) (goto-char (point-max)) (setq buffer-read-only nil) (insert (substring (current-time-string) 4 19) ":: " message ?\n ) (setq buffer-read-only t) (save-window-excursion (bury-buffer (current-buffer)))) (message "%s" message) ; 92.4.15 by T.Enami (if noerase nil (let ((focus-follows-mouse t)) (sleep-for 1)) (message ""))) ;;;(defmacro notify-yes-or-no-p (str &rest args) ;;; (list 'notify-yes-or-no-p-internal ;;; (cons 'format (cons str args)))) (defun notify-yes-or-no-p (str &rest args) (notify-yes-or-no-p-internal (apply 'format (cons str args)))) (defun notify-yes-or-no-p-internal (message) (save-window-excursion (pop-to-buffer *notification-window*) (goto-char (point-max)) (setq buffer-read-only nil) (insert (substring (current-time-string) 4 19) ":: " message ?\n ) (setq buffer-read-only t) (yes-or-no-p "$B$$$$$G$9$+!)(B"))) (defun notify-y-or-n-p (str &rest args) (notify-y-or-n-p-internal (apply 'format (cons str args)))) (defun notify-y-or-n-p-internal (message) (save-window-excursion (pop-to-buffer *notification-window*) (goto-char (point-max)) (setq buffer-read-only nil) (insert (substring (current-time-string) 4 19) ":: " message ?\n ) (setq buffer-read-only t) (y-or-n-p "$B$$$$$G$9$+!)(B"))) (defun select-notification () (interactive) (pop-to-buffer *notification-window*) (setq buffer-read-only t)) ;;;---------------------------------------------------------------------- ;;; ;;; Minibuffer Menu System ;;; ;;;---------------------------------------------------------------------- ;;; user-customizable variables (defvar menu:*display-item-value* nil "*Non-nil means values of items are displayed in minibuffer menu") ;;; The following will be localized, added only to pacify the compiler. (defvar menu:*cur-menu*) (defvar menu:*cur-selection*) (defvar menu:*cur-selections*) (defvar menu:*cur-element-no*) (defvar menu:*cur-selection-no*) (defvar menu:*cur-element-points*) (defvar menu:*menu-stack*) (defvar minibuffer-local-menu-map (make-sparse-keymap)) (if (featurep 'xemacs) (set-keymap-default-binding minibuffer-local-menu-map 'undefined)) (mapcar (lambda (elem) (define-key minibuffer-local-menu-map (car elem) (intern (format "menu:%s" (cdr elem))))) '( (" " . next-element) ("\C-a" . beginning-of-selection) ("\C-b" . previous-element) ("\C-d" . previous-element) ("\C-e" . end-of-selection) ("\C-f" . next-element) ("\C-g" . quit) ("\C-h" . previous-element) ("\C-i" . next-element) ("\C-j" . select) ("\C-l" . refresh) ("\C-m" . select) ("\C-n" . next-selection) ("\C-p" . previous-selection) ([backspace] . previous-element) ([clear] . quit) ([delete] . previous-element) ([down] . next-selection) ([kp-down] . next-selection) ([kp-enter] . select) ([kp-left] . previous-element) ([kp-right] . next-element) ([kp-tab] . next-element) ([kp-up] . previous-selection) ([left] . previous-element) ([next] . next-selection) ([prior] . previous-selection) ([return] . select) ([right] . next-element) ([tab] . next-element) ([up] . previous-selection) )) ;;; 0 .. 9 A .. Z a .. z and kp (if (featurep 'xemacs) (progn (mapcar (lambda (char) (define-key minibuffer-local-menu-map (char-to-string char) 'menu:goto-nth-element)) "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") ;; kp-0 .. kp-9 (mapcar (lambda (key) (define-key minibuffer-local-menu-map key 'menu:goto-nth-element)) (list [kp-0] [kp-1] [kp-2] [kp-3] [kp-4] [kp-5] [kp-6] [kp-7] [kp-8] [kp-9]))) (mapcar (lambda (char) (define-key minibuffer-local-menu-map (vector char) 'menu:goto-nth-element)) "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")) ;;; ;;; predicates and selectors for menu ;;; ;; ::= ( menu ) ;; ::= ( ... ) ;; ::= ( . ) | ;; | ( . ) | ;; :: = | ;; (defun menu:menup (value) (and (listp value) (eq (car value) 'menu))) (defun menu:menu-prompt (&optional menu) (car (cdr (or menu menu:*cur-menu*)))) (defun menu:menu-items (&optional menu) (car (cdr (cdr (or menu menu:*cur-menu*))))) (defun menu:menu-nth-item (n &optional menu) (nth n (menu:menu-items menu))) (defun menu:item-string (item) (cond ((stringp item) item) ((characterp item) (char-to-string item)) ((consp item) (let ((str (cond ((stringp (car item)) (car item)) ((characterp (car item)) (char-to-string (car item))) (t "")))) (if menu:*display-item-value* (format "%s [%s]" str (cdr item)) str))) (t ""))) (defun menu:item-value (item) (cond ((stringp item) item) ((characterp item) (char-to-string item)) ((consp item) (cdr item)) (t ""))) (defun menu:select-submenu (submenu) "Save the current selection state, and select a new menu." (setq menu:*menu-stack* (cons (list menu:*cur-selection* menu:*cur-selections* menu:*cur-element-no* menu:*cur-selection-no* menu:*cur-menu* menu:*cur-element-points*) menu:*menu-stack*)) (setq menu:*cur-menu* submenu)) (defun menu:select-saved-menu () "Restore the most recently stored selection state." (let ((save (car menu:*menu-stack*))) (setq menu:*menu-stack* (cdr menu:*menu-stack*)) (setq menu:*cur-selection* (nth 0 save);92.10.26 by T.Saneto menu:*cur-selections* (nth 1 save) menu:*cur-element-no* (nth 2 save) menu:*cur-selection-no* (nth 3 save) menu:*cur-menu* (nth 4 save) menu:*cur-element-points* (nth 5 save)))) ;;; ;;; constructors and selector for selection ;;; ;; ::= ( . ) ;; ... integer that means the absolute position in menu items ;; ::= ( ... ) ;; (defsubst menu:make-selection (pos elements) (cons pos elements)) (defsubst menu:selection-pos (&optional selection) (car (or selection menu:*cur-selection*))) (defsubst menu:selection-elements (&optional selection) (cdr (or selection menu:*cur-selection*))) (defsubst menu:selection-nth-element (&optional n selection) (nth (or n menu:*cur-element-no*) (menu:selection-elements selection))) (defsubst menu:selection-element-length (&optional selection) (length (menu:selection-elements selection))) (defun menu:make-selections (items width) "Make selection list from ITEMS so that each selection can fit with WIDTH." (let ((headpos 0) (pos 0) (size 0) revselections revelems item-string item-width) (while items (setq item-string (menu:item-string (car items))) (setq item-width (string-width item-string)) ;;; 92.9.19 by Y. Kawabe (cond ((and revelems (<= width (+ size 4 item-width))) (setq revselections (cons (menu:make-selection headpos (nreverse revelems)) revselections)) (setq revelems nil) (setq size 0) (setq headpos pos)) ((or (null (cdr items)) (<= width (+ size 4 item-width))) (setq revselections (cons (menu:make-selection headpos (nreverse (cons item-string revelems))) revselections)) (setq size 0) (setq headpos pos) (setq items (cdr items)) (setq pos (1+ pos))) (t ;;; 92.9.19 by Y. Kawabe (setq revelems (cons item-string revelems)) (setq size (+ size 4 item-width)) (setq items (cdr items)) (setq pos (1+ pos))))) (nreverse revselections))) (defun menu:setup-selections (window-width initpos) (setq menu:*cur-selections* (menu:make-selections (menu:menu-items) (- window-width ;;; 92.8.19 by K.Handa (string-width (menu:menu-prompt))))) (if initpos (let ((selections menu:*cur-selections*)) (setq menu:*cur-selection-no* 0) (while (and (cdr selections) (< (menu:selection-pos (car (cdr selections))) initpos)) (setq menu:*cur-selection-no* (1+ menu:*cur-selection-no*)) (setq selections (cdr selections))) (setq menu:*cur-element-no* (- initpos (menu:selection-pos (car selections))))))) ;;; utility (defun menu:check-number-range (i min max) (cond ((eq i 'max) max) ((eq i 'min) min) ((< i min) max) ((< max i) min) (t i))) ;;; ;;; main part of menu ;;; (defun menu:select-from-menu (menu &optional initial position) "Display menu in minibuffer and return the selected value. If INITIAL is non-nil integer list, it behaves as menu is selected using the path specified by INITIAL in advance. If POSITION is non-nil value, return value is a pair of the selected value and the chosen path (represented by an integer list)." (let ((menu:*cur-menu* menu) (menu:*window-width* (window-width (minibuffer-window))) menu:*cur-selection* menu:*cur-selections* menu:*cur-element-no* menu:*cur-selection-no* menu:*cur-element-points* menu:*menu-stack* menu:*select-positions* (pos 0) value finished) (if initial (progn (if (numberp initial) (setq initial (list initial))) (while (cdr initial) (setq value (menu:item-value (menu:menu-nth-item (car initial)))) (if (menu:menup value) (progn (menu:setup-selections menu:*window-width* (car initial)) (menu:select-submenu value))) (setq menu:*select-positions* (cons (car initial) menu:*select-positions*)) (setq initial (cdr initial))) (setq pos (car initial)))) (while (not finished) (menu:setup-selections menu:*window-width* pos) (add-hook 'minibuffer-setup-hook 'menu:minibuffer-setup) (unwind-protect (setq pos (read-from-minibuffer "" nil minibuffer-local-menu-map t 'menu:*select-positions*)) (remove-hook 'minibuffer-setup-hook 'menu:minibuffer-setup) (if quit-flag (setq pos nil quit-flag nil))) (cond (pos ; element selected (setcar menu:*select-positions* pos) (setq value (menu:item-value (menu:menu-nth-item pos))) (if (menu:menup value) (progn (menu:select-submenu value) (setq pos 0)) (setq finished t))) (menu:*menu-stack* ; quit (restore menu) (if (not (car menu:*select-positions*)) (setq menu:*select-positions* (cdr menu:*select-positions*))) (setq menu:*select-positions* (cdr menu:*select-positions*)) (menu:select-saved-menu)) (t ; really quit (setq quit-flag t) (setq menu:*select-positions* nil) (setq finished t)))) (if position (cons value (nreverse menu:*select-positions*)) value))) (defalias 'menu:minibuffer-setup 'menu:goto-selection) (defun menu:goto-selection (&optional sel-no elem-no) (setq menu:*cur-selection-no* (menu:check-number-range (or sel-no menu:*cur-selection-no*) 0 (1- (length menu:*cur-selections*)))) (setq menu:*cur-selection* (nth menu:*cur-selection-no* menu:*cur-selections*)) (erase-buffer) (insert (menu:menu-prompt)) (let ((elements (menu:selection-elements)) (i 0) revpoints) (while elements (setq revpoints (cons (+ (point) 2) revpoints)) (insert (if (<= i 9) (format " %d." i) (format " %c." (+ (- i 10) ?a))) (car elements)) (setq elements (cdr elements) i (1+ i))) (setq menu:*cur-element-points* (nreverse revpoints))) (menu:goto-element elem-no)) (defun menu:goto-element (&optional elem-no) (setq menu:*cur-element-no* (menu:check-number-range (or elem-no menu:*cur-element-no*) 0 (1- (menu:selection-element-length)))) (goto-char (nth menu:*cur-element-no* menu:*cur-element-points*))) (defun menu:beginning-of-selection () (interactive) (menu:goto-element 0)) (defun menu:end-of-selection () (interactive) (menu:goto-element (1- (menu:selection-element-length)))) (defun menu:next-selection () (interactive) (menu:goto-selection (1+ menu:*cur-selection-no*))) (defun menu:previous-selection () (interactive) (menu:goto-selection (1- menu:*cur-selection-no*))) (defun menu:next-element () (interactive) (if (< menu:*cur-element-no* (1- (menu:selection-element-length))) (menu:goto-element (1+ menu:*cur-element-no*)) (menu:goto-selection (1+ menu:*cur-selection-no*) 0))) (defun menu:previous-element () (interactive) (if (< 0 menu:*cur-element-no*) (menu:goto-element (1- menu:*cur-element-no*)) (menu:goto-selection (1- menu:*cur-selection-no*) 'max))) (defun menu:goto-nth-element () (interactive) (let ((ch (if (featurep 'xemacs) (event-to-character last-command-event) (if (integerp last-command-event) last-command-event (get last-command-event 'ascii-character)))) (elem-no-max (1- (menu:selection-element-length)))) (if ch (cond ((and (<= ?0 ch) (<= ch ?9) (<= ch (+ ?0 elem-no-max))) (menu:goto-element (- ch ?0))) ((and (<= ?a ch) (<= ch ?z) (<= (+ 10 ch) (+ ?a elem-no-max))) (menu:goto-element (+ 10 (- ch ?a)))) ((and (<= ?A ch) (<= ch ?Z) (<= (+ 10 ch) (+ ?A elem-no-max))) (menu:goto-element (+ 10 (- ch ?A)))))))) (defun menu:refresh () (interactive) (menu:goto-selection)) (defun menu:select () (interactive) (erase-buffer) (prin1 (+ (menu:selection-pos) menu:*cur-element-no*) (current-buffer)) (exit-minibuffer)) (defun menu:quit () (interactive) (erase-buffer) (prin1 nil (current-buffer)) (exit-minibuffer)) ;;;---------------------------------------------------------------------- ;;; ;;; $B0l3g7?JQ495!G=(B ;;; ;;;---------------------------------------------------------------------- ;;; ;;; $B$R$i$,$JJQ49(B ;;; (defun hiragana-paragraph () "hiragana paragraph at or after point." (interactive ) (save-excursion (forward-paragraph) (let ((end (point))) (backward-paragraph) (japanese-hiragana-region (point) end)))) (defun hiragana-sentence () "hiragana sentence at or after point." (interactive ) (save-excursion (forward-sentence) (let ((end (point))) (backward-sentence) (japanese-hiragana-region (point) end)))) ;;; ;;; $B%+%?%+%JJQ49(B ;;; (defun katakana-paragraph () "katakana paragraph at or after point." (interactive ) (save-excursion (forward-paragraph) (let ((end (point))) (backward-paragraph) (japanese-katakana-region (point) end)))) (defun katakana-sentence () "katakana sentence at or after point." (interactive ) (save-excursion (forward-sentence) (let ((end (point))) (backward-sentence) (japanese-katakana-region (point) end)))) ;;; ;;; $BH>3QJQ49(B ;;; (defun hankaku-paragraph () "hankaku paragraph at or after point." (interactive ) (save-excursion (forward-paragraph) (let ((end (point))) (backward-paragraph) (japanese-hankaku-region (point) end 'ascii-only)))) (defun hankaku-sentence () "hankaku sentence at or after point." (interactive ) (save-excursion (forward-sentence) (let ((end (point))) (backward-sentence) (japanese-hankaku-region (point) end 'ascii-only)))) (defun hankaku-word (arg) (interactive "p") (let ((start (point))) (forward-word arg) (japanese-hankaku-region start (point) 'ascii-only))) ;;; ;;; $BA43QJQ49(B ;;; (defun zenkaku-paragraph () "zenkaku paragraph at or after point." (interactive ) (save-excursion (forward-paragraph) (let ((end (point))) (backward-paragraph) (japanese-zenkaku-region (point) end)))) (defun zenkaku-sentence () "zenkaku sentence at or after point." (interactive ) (save-excursion (forward-sentence) (let ((end (point))) (backward-sentence) (japanese-zenkaku-region (point) end)))) (defun zenkaku-word (arg) (interactive "p") (let ((start (point))) (forward-word arg) (japanese-zenkaku-region start (point)))) ;;; ;;; $B%m!<%^;z$+$JJQ49(B ;;; (defun roma-kana-region (start end ) (interactive "r") (its:translate-region start end nil (its:get-mode-map "roma-kana"))) (defun roma-kana-paragraph () "roma-kana paragraph at or after point." (interactive ) (save-excursion (forward-paragraph) (let ((end (point))) (backward-paragraph) (roma-kana-region (point) end )))) (defun roma-kana-sentence () "roma-kana sentence at or after point." (interactive ) (save-excursion (forward-sentence) (let ((end (point))) (backward-sentence) (roma-kana-region (point) end )))) (defun roma-kana-word () "roma-kana word at or after point." (interactive) (save-excursion (re-search-backward "\\b\\w" nil t) (let ((start (point))) (re-search-forward "\\w\\b" nil t) (roma-kana-region start (point))))) ;;; ;;; $B%m!<%^;z4A;zJQ49(B ;;; (defun roma-kanji-region (start end) (interactive "r") (roma-kana-region start end) (save-restriction (narrow-to-region start (point)) (goto-char (point-min)) (replace-regexp "\\($B!!(B\\| \\)" "") (goto-char (point-max))) (if (wnn7-p) (wnn7-henkan-region-internal start (point)) (henkan-region-internal start (point)))) (defun roma-kanji-paragraph () "roma-kanji paragraph at or after point." (interactive ) (save-excursion (forward-paragraph) (let ((end (point))) (backward-paragraph) (roma-kanji-region (point) end )))) (defun roma-kanji-sentence () "roma-kanji sentence at or after point." (interactive ) (save-excursion (forward-sentence) (let ((end (point))) (backward-sentence) (roma-kanji-region (point) end )))) (defun roma-kanji-word () "roma-kanji word at or after point." (interactive) (save-excursion (re-search-backward "\\b\\w" nil t) (let ((start (point))) (re-search-forward "\\w\\b" nil t) (roma-kanji-region start (point))))) ;;;---------------------------------------------------------------------- ;;; ;;; $B!V$?$^$4!WF~NOJ8;zJQ497O(B ITS ;;; ;;;---------------------------------------------------------------------- (defun egg:member (elt list) (while (not (or (null list) (equal elt (car list)))) (setq list (cdr list))) list) ;;; ;;; Mode name --> map ;;; ;;; ITS mode name: string (defvar its:*mode-alist* nil) (defvar its:*internal-mode-alist* nil) (defun its:get-mode-map (name) (let ((map-pair (or (assoc name its:*mode-alist*) (assoc name its:*internal-mode-alist*)))) (cond ((null (cdr map-pair)) nil) ((stringp (cdr map-pair)) (let ((file (cdr map-pair)) (map its:*mode-alist*)) (while map (if (and (stringp (cdar map)) (string= (cdar map) file)) (setcdr (car map) nil)) (setq map (cdr map))) (load file) (cdr (assoc name its:*mode-alist*)))) (t (cdr map-pair))))) (defun its:set-mode-map (name map &optional internalp) (let ((place (assoc name (if internalp its:*internal-mode-alist* its:*mode-alist*)))) (if place (let ((mapplace (cdr place))) (if mapplace (progn (setcar mapplace (car map)) (setcdr mapplace (cdr map))) ;; map $B$rJ,2r$7$F(B cons $B$9$kI,MW$,$"$k$N$+$I$&$+(B ;; $BJ,$+$i$J$$$,>e$HF1$8$h$&$K$7$F$$$k!%(Bkatsuya (setcdr place (cons (car map) (cdr map))))) (setq place (cons name map)) (if internalp (setq its:*internal-mode-alist* (append its:*internal-mode-alist* (list place))) (setq its:*mode-alist* (append its:*mode-alist* (list place))))))) ;;; ;;; ITS mode indicators ;;; Mode name --> indicator ;;; (defun its:get-mode-indicator (name) (let ((map (its:get-mode-map name))) (if map (map-indicator map) name))) (defun its:set-mode-indicator (name indicator) (let ((map (its:get-mode-map name))) (if map (map-set-indicator map indicator) (its-define-mode name indicator)))) ;;; ;;; ITS mode declaration ;;; (defvar its:*processing-map* nil) (defun its-define-mode (name &optional indicator reset supers internalp) "its-mode NAME $B$rDj5AA*Br$9$k!%B>$N(B its-mode $B$,A*Br$5$l$k$^$G$O(B its-defrule $B$J$I$O(B NAME $B$KBP$7$F5,B'$rDI2C$9$k!%(BINDICATOR $B$,(B non-nil $B$N;~$K$O(B its-mode NAME $B$rA*Br$9$k$H(B mode-line $B$KI=<($5$l$k!%(BRESET $B$,(B non-nil $B$N;~$K$O(B its-mode $B$NDj5A$,6u$K$J$k!%(BSUPERS $B$O>e0L$N(B its-mode $BL>$r%j%9%H$G;XDj$9$k!%(BINTERNALP $B$O(B mode name $B$rFbItL>$H$9$k!%(B its-defrule, its-defrule-conditional, defule-select-mode-temporally $B$r(B $B;2>H(B" (if (null(its:get-mode-map name)) (progn (setq its:*processing-map* (make-map nil (or indicator name) nil (mapcar 'its:get-mode-map supers))) (its:set-mode-map name its:*processing-map* internalp) ) (progn (setq its:*processing-map* (its:get-mode-map name)) (if indicator (map-set-indicator its:*processing-map* indicator)) (if reset (progn (map-set-state its:*processing-map* nil) (map-set-alist its:*processing-map* nil) )) (if supers (progn (map-set-supers its:*processing-map* (mapcar 'its:get-mode-map supers)))))) nil) (defun its-autoload-mode-map (name file) (setq its:*mode-alist* (append its:*mode-alist* (list (cons name file))))) ;;; ;;; defrule related utilities ;;; (put 'for-each 'lisp-indent-hook 1) (defmacro for-each (vars &rest body) "(for-each ((VAR1 LIST1) ... (VARn LISTn)) . BODY) $B$OJQ?t(B VAR1 $B$NCM(B $B$r%j%9%H(B LIST1 $B$NMWAG$KB+G{$7!$!%!%!%JQ?t(B VARn $B$NCM$r%j%9%H(B LISTn $B$NMW(B $BAG$KB+G{$7$F(B BODY $B$ruBV$G$NI=<($r:n@.$9$k4X?t$r;XDj$9$k(B. $B4X?t$O(B map input action state $B$r0z?t$H$7$F8F$P$l!$>uBVI=<($NJ8;zNs$rJV$9!%(B") (defun its:default-make-terminal-state (map input action state) (cond(state state) (t input))) (defun its:make-terminal-state-hangul (map input action state) (cond((its:standard-actionp action) (action-output action)) (t nil))) (defvar its:make-non-terminal-state 'its:default-make-standard-non-terminal-state "$BHs=*C<$N>uBV$G$NI=<($r:n@.$9$k4X?t$r;XDj$9$k!%4X?t$O(B map input $B$r(B $B0z?t$H$7$F8F$P$l!$>uBVI=<($NJ8;zNs$rJV$9(B" ) (defun its:default-make-standard-non-terminal-state (map input) " ****" (concat (map-state-string map) (char-to-string (aref input (1- (length input)))))) (defun its-defrule (input output &optional next state map) "INPUT $B$,F~NO$5$l$k$H(B OUTPUT $B$KJQ49$9$k!%(BNEXT $B$,(B nil $B$G$J$$$H$-$OJQ(B $B49$7$?8e$K(B NEXT $B$,F~NO$5$l$?$h$&$KJQ49$rB3$1$k!%(BINPUT$B$,F~NO$5$l$?;~E@(B $B$GJQ49$,3NDj$7$F$$$J$$;~$O(B STATE $B$r%U%'%s%9>e$KI=<($9$k!%JQ49$,3NDj$7(B $B$F$$$J$$;~$KI=<($9$kJ8;zNs$OJQ?t(B its:make-terminal-state $B$*$h$S(B $BJQ?t(B its:make-non-terminal-state $B$K;X<($5$l$?4X?t$K$h$C$F@8@.$5$l$k!%JQ495,(B $BB'$O(B MAP $B$G;XDj$5$l$?JQ49I=$KEPO?$5$l$k!%(BMAP $B$,(B nil $B$N>l9g$O$b$C$H$b:G(B $B6a$K(B its-define-mode $B$5$l$?JQ49I=$KEPO?$5$l$k!%$J$*(B OUTPUT $B$,(B nil $B$N>l(B $B9g$O(B INPUT $B$KBP$9$kJQ495,B'$,:o=|$5$l$k!%(B" (its-defrule* input (its:make-standard-action output next) state (if (stringp map) map its:*processing-map*))) (defmacro its-defrule-conditional (input &rest conds) "(its-defrule-conditional INPUT ((COND1 OUTPUT1) ... (CONDn OUTPUTn)))$B$O(B INPUT $B$,F~NO$5$l$?;~$K>r7o(B CONDi $B$r=guBV(B STATE $B$rI=<($7!$>r7o(B CONDi $B$r(B $B=gl9g(B, its-defrule $B$N7Y9p$rM^@)$9$k(B") (defun its-defrule** (i input action state map) (cond((= (length input) i) ;93.6.4 by T.Shingu (map-set-state map (coerce-internal-string (funcall its:make-terminal-state map input action state))) (if (and its:*defrule-verbose* (map-action map)) (if action (notify "(its-defrule \"%s\" \"%s\" ) $B$r:FDj5A$7$^$7$?!%(B" input action) (notify "(its-defrule \"%s\" \"%s\" )$B$r:o=|$7$^$7$?!%(B" input (map-action map)))) (if (and (null action) (map-terminalp map)) nil (progn (map-set-action map action) map))) (t (if (featurep 'xemacs) (let((newmap (or (get-next-map-locally map (aref input i)) (make-map (funcall its:make-non-terminal-state map (substring input 0 (+ i (char-bytes (aref input i))))))))) (set-next-map map (aref input i) (its-defrule** (+ i (char-bytes (aref input i))) input action state newmap))) (let((newmap (or (get-next-map-locally map (aref input i)) (make-map (funcall its:make-non-terminal-state map (substring input 0 (1+ i))))))) (set-next-map map (aref input i) (its-defrule** (1+ i) input action state newmap)))) (if (and (null (map-action map)) (map-terminalp map)) nil map)))) ;;; ;;; map: ;;; ;;; ::= ( ( . ) ... ) ;;; ::= ( nil ) ;;; ::= ( .... ) ;;; ::= ( ) ;;; ::= | ( ) .... (defun make-map (&optional state action alist supers) (list state action alist supers)) (defun map-topmap-p (map) (null (map-state map))) (defun map-supers (map) (nth 3 map)) (defun map-set-supers (map val) (setcar (nthcdr 3 map) val)) (defun map-terminalp (map) (null (map-alist map))) (defun map-state (map) (nth 0 map)) (defun map-state-string (map) (coerce-string (map-state map))) (defun map-set-state (map val) (setcar (nthcdr 0 map) val)) (defun map-indicator (map) (map-action map)) (defun map-set-indicator (map indicator) (map-set-action map indicator)) (defun map-action (map) (nth 1 map)) (defun map-set-action (map val) (setcar (nthcdr 1 map) val)) (defun map-alist (map) (nth 2 map)) (defun map-set-alist (map alist) (setcar (nthcdr 2 map) alist)) (defun get-action (map) (if (null map) nil (let ((action (map-action map))) (cond((its:standard-actionp action) action) ((symbolp action) (condition-case nil (funcall action) (error nil))) (t (condition-case nil (eval action) (error nil))))))) (defun action-output (action) (cond((stringp action) action) (t (car action)))) (defun action-next (action) (cond((stringp action) nil) (t (car (cdr action))))) (defun get-next-map (map ch) (or (cdr (assq ch (map-alist map))) (if (map-topmap-p map) (let ((supers (map-supers map)) (result nil)) (while supers (setq result (get-next-map (car supers) ch)) (if result (setq supers nil) (setq supers (cdr supers)))) result)))) (defun get-next-map-locally (map ch) (cdr (assq ch (map-alist map)))) (defun set-next-map (map ch val) (let ((place (assq ch (map-alist map)))) (if place (if val (setcdr place val) (map-set-alist map (delq place (map-alist map)))) (if val (map-set-alist map (cons (cons ch val) (map-alist map))) val)))) (defun its:simple-actionp (action) (stringp action)) (defun collect-simple-action (map) (if (map-terminalp map) (if (its:simple-actionp (map-action map)) (list (map-action map)) nil) (let ((alist (map-alist map)) (result nil)) (while alist (setq result ;;; 92.9.19 by Y. Kawabe (append (collect-simple-action (cdr (car alist))) result)) (setq alist (cdr alist))) result))) ;;;---------------------------------------------------------------------- ;;; ;;; Runtime translators ;;; ;;;---------------------------------------------------------------------- (defun its:simulate-input (i j input map) (if (featurep 'xemacs) (while (<= i j) (setq map (get-next-map map (aref input i))) ;92.12.26 by S.Tomura (setq i (+ i (char-bytes (aref input i))))) ;92.12.26 by S.Tomura (while (<= i j) (setq map (get-next-map map (aref input i))) ;92.12.26 by S.Tomura (setq i (1+ i)))) ;92.12.26 by S.Tomura map) ;;; meta-flag $B$,(B on $B$N;~$K$O!"F~NO%3!<%I$K(B \200 $B$r(B or $B$7$?$b$N$,F~NO$5(B ;;; $B$l$k!#$3$NItJ,$N;XE&$OEl9)Bg$NCf@n(B $B5.G7$5$s$K$h$k!#(B ;;; pointted by nakagawa@titisa.is.titech.ac.jp Dec-11-89 ;;; ;;; emacs $B$G$O(B $BJ8;z%3!<%I$O(B 0-127 $B$G07$&!#(B ;;; (defvar its:*buff-s* (make-marker)) (defvar its:*buff-e* (make-marker)) (set-marker-insertion-type its:*buff-e* t) ;;; STATE unread ;;; |<-s p->|<- e ->| ;;; s : ch0 state0 map0 ;;; +1: ch1 state1 map1 ;;; .... ;;; (point): ;;; longest matching region : [s m] ;;; suspending region: [m point] ;;; unread region : [point e] (defvar its:*maxlevel* 10) (defvar its:*maps* (make-vector its:*maxlevel* nil)) (defvar its:*actions* (make-vector its:*maxlevel* nil)) (defvar its:*inputs* (make-vector its:*maxlevel* 0)) (defvar its:*level* 0) (defun its:resize (size) (if (<= its:*maxlevel* size) (setq its:*maxlevel* size its:*maps* (make-vector size nil) its:*actions* (make-vector size nil) its:*inputs* (make-vector size 0)))) (defun its:reset-maps (&optional init) (setq its:*level* 0) (if init (aset its:*maps* its:*level* init))) (defun its:current-map () (aref its:*maps* its:*level*)) (defun its:previous-map () (aref its:*maps* (max 0 (1- its:*level*)))) (defun its:level () its:*level*) (defun its:enter-newlevel (map ch output) (setq its:*level* (1+ its:*level*)) (aset its:*maps* its:*level* map) (aset its:*inputs* its:*level* ch) (aset its:*actions* its:*level* output)) (defvar its:*char-from-buff* nil) (defvar its:*interactive* t) (defun its:reset-input () (setq its:*char-from-buff* nil)) (defun its:flush-input-before-point (from) (save-excursion (while (<= from its:*level*) (its:insert-char (aref its:*inputs* from)) (setq from (1+ from))))) (if (featurep 'xemacs) (progn (defun its:peek-char () (if (= (point) its:*buff-e*) (if its:*interactive* (let ((ch (egg-read-event))) (if ch (progn (setq unread-command-events (list (character-to-event ch))) ch) nil)) nil) (char-after (point)))) (defun its:read-char () (if (= (point) its:*buff-e*) (progn (setq its:*char-from-buff* nil) (if its:*interactive* (egg-read-event) nil)) (let ((ch (char-after (point)))) (setq its:*char-from-buff* t) (delete-char 1) ch))) (defun its:push-char (ch) (if its:*char-from-buff* (save-excursion (its:insert-char ch)) (if ch (setq unread-command-events (list (character-to-event ch)))))) (defun its:insert-char (ch) (insert ch)) (defun its:ordinal-charp (ch) (and (characterp ch) (<= ch 127) (eq (lookup-key fence-mode-map (char-to-string ch)) 'fence-self-insert-command))) (defun its:delete-charp (ch) (and (characterp ch) (<= ch 127) (eq (lookup-key fence-mode-map (char-to-string ch)) 'fence-backward-delete-char))) (defun its:tabp (ch) (and (characterp ch) (<= ch 127) (eq (lookup-key fence-mode-map (char-to-string ch)) 'egg-predict-start-parttime))) (defvar egg:fence-buffer nil "Buffer fence is active in") (defun fence-self-insert-command () (interactive) (if (not (eq (current-buffer) egg:fence-buffer)) nil ;; #### This is to bandaid a deep event-handling bug (let ((ch (event-to-character last-command-event))) (cond((or (not egg:*input-mode*) (null (get-next-map its:*current-map* ch))) (insert ch)) (t (insert ch) (its:translate-region (1- (point)) (point) t)))))) ) (defun its:peek-char () (if (= (point) its:*buff-e*) (if its:*interactive* (setq unread-command-events (list (read-event))) nil) (following-char))) (defun its:read-char () (if (= (point) its:*buff-e*) (progn (setq its:*char-from-buff* nil) (if its:*interactive* (read-char-exclusive) nil)) (let ((ch (following-char))) (setq its:*char-from-buff* t) (delete-char 1) ch))) (defun its:push-char (ch) (if its:*char-from-buff* (save-excursion (its:insert-char ch)) (if ch (setq unread-command-events (list ch))))) (defun its:insert-char (ch) (insert ch)) (defun its:ordinal-charp (ch) (and (numberp ch) (<= 0 ch) (<= ch 127) (eq (lookup-key fence-mode-map (char-to-string ch)) 'fence-self-insert-command))) (defun its:delete-charp (ch) (and (numberp ch) (<= 0 ch) (<= ch 127) (eq (lookup-key fence-mode-map (char-to-string ch)) 'fence-backward-delete-char))) (defun its:tabp (ch) (and (numberp ch) (<= 0 ch) (<= ch 127) (eq (lookup-key fence-mode-map (char-to-string ch)) 'egg-predict-start-parttime))) (defun fence-self-insert-command () (interactive) (cond((or (not egg:*input-mode*) (null (get-next-map its:*current-map* last-command-event))) (insert last-command-event)(beep)) (t (insert last-command-event) (its:translate-region (1- (point)) (point) t)))) ) ;;; ;;; its: completing-read system ;;; (defun its:all-completions (string alist &optional pred) "A variation of all-completions.\n\ Arguments are STRING, ALIST and optional PRED. ALIST must be no obarray." (let ((tail alist) (allmatches nil)) (while tail (let* ((elt (car tail)) (eltstring (car elt))) (setq tail (cdr tail)) (if (and (stringp eltstring) (<= (length string) (length eltstring)) ;;;(not (= (aref eltstring 0) ? )) (string-equal string (substring eltstring 0 (length string)))) (if (or (and pred (if (if (eq pred 'commandp) (commandp elt) (funcall pred elt)))) (null pred)) (setq allmatches (cons elt allmatches)))))) (nreverse allmatches))) (defun its:temp-echo-area-contents (message) (let ((inhibit-quit inhibit-quit) (point-max (point-max))) (goto-char point-max) (insert message) (goto-char point-max) (setq inhibit-quit t) (sit-for 2 nil) ;;; 92.9.19 by Y. Kawabe, 92.10.30 by T.Saneto (delete-region (point) (point-max)) (if quit-flag (progn (setq quit-flag nil) (if (featurep 'xemacs) (setq unread-command-events (list (character-to-event ?\^G))) (setq unread-command-events (list ?\^G))))))) (defun car-string-lessp (item1 item2) (string-lessp (car item1) (car item2))) (defun its:minibuffer-completion-help () "Display a list of possible completions of the current minibuffer contents." (interactive) (let ((completions)) (message "Making completion list...") (setq completions (its:all-completions (buffer-string) minibuffer-completion-table minibuffer-completion-predicate)) (if (null completions) (progn ;;; 92.9.19 by Y. Kawabe (beep) (its:temp-echo-area-contents " [No completions]")) (with-output-to-temp-buffer "*Completions*" (display-completion-list (sort completions 'car-string-lessp)))) nil)) (defconst its:minibuffer-local-completion-map (copy-keymap minibuffer-local-completion-map)) (define-key its:minibuffer-local-completion-map "?" 'its:minibuffer-completion-help) (define-key its:minibuffer-local-completion-map " " 'its:minibuffer-completion-help) (defconst its:minibuffer-local-must-match-map (copy-keymap minibuffer-local-must-match-map)) (define-key its:minibuffer-local-must-match-map "?" 'its:minibuffer-completion-help) (define-key its:minibuffer-local-must-match-map " " 'its:minibuffer-completion-help) (fset 'si:all-completions (symbol-function 'all-completions)) (fset 'si:minibuffer-completion-help (symbol-function 'minibuffer-completion-help)) (defun its:completing-read (prompt table &optional predicate require-match initial-input) "See completing-read" (let ((minibuffer-local-completion-map its:minibuffer-local-completion-map) (minibuffer-local-must-match-map its:minibuffer-local-must-match-map) (completion-auto-help nil)) (completing-read prompt table predicate t initial-input))) (defvar its:*completing-input-menu* '(menu "Which?" nil)) ;92.10.26 by T.Saneto (defun its:completing-input (map) ;;; (let ((action (get-action map))) (cond((and (null action) (= (length (map-alist map)) 1)) (its:completing-input (cdr (nth 0 (map-alist map))))) (t (setcar (nthcdr 2 its:*completing-input-menu*) (map-alist map)) (let ((values (menu:select-from-menu its:*completing-input-menu* 0 t))) (cond((consp values) ;;; get input char from menu ) (t (its:completing-input map)))))))) (defvar its:*make-menu-from-map-result* nil) (defun its:make-menu-from-map (map) (let ((its:*make-menu-from-map-result* nil)) (its:make-menu-from-map* map "") (list 'menu "Which?" (reverse its:*make-menu-from-map-result*) ))) (defun its:make-menu-from-map* (map string) (let ((action (get-action map))) (if action (setq its:*make-menu-from-map-result* (cons (format "%s[%s]" string (action-output action)) its:*make-menu-from-map-result*))) (let ((alist (map-alist map))) (while alist (its:make-menu-from-map* (cdr (car alist)) (concat string (char-to-string (car (car alist))))) (setq alist (cdr alist)))))) (defvar its:*make-alist-from-map-result* nil) (defun its:make-alist-from-map (map &optional string) (let ((its:*make-alist-from-map-result* nil)) (its:make-alist-from-map* map (or string "")) (reverse its:*make-alist-from-map-result*))) (defun its:make-alist-from-map* (map string) (let ((action (get-action map))) (if action (setq its:*make-alist-from-map-result* (cons (list string (let ((action-output (action-output action))) (cond((and (consp action-output) (characterp (car action-output))) (format "%s..." (nth (car action-output) (cdr action-output)))) ((stringp action-output) action-output) (t (format "%s" action-output))))) its:*make-alist-from-map-result*))) (let ((alist (map-alist map))) (while alist (its:make-alist-from-map* (cdr (car alist)) (concat string (char-to-string (car (car alist))))) (setq alist (cdr alist)))))) (defvar its:*select-alternative-output-menu* '(menu "Which?" nil)) (defun its:select-alternative-output (action-output) ;;;; action-output : (pos item1 item2 item3 ....) (let ((point (point)) (output (cdr action-output)) (ch 0)) (while (not (eq ch ?\^L)) (insert "<" (nth (car action-output)output) ">") (setq ch (if (featurep 'xemacs) (egg-read-event) (read-event))) (cond ((eq ch ?\^N) (setcar action-output (mod (1+ (car action-output)) (length output)))) ((eq ch ?\^P) (setcar action-output (if (= 0 (car action-output)) (1- (length output)) (1- (car action-output))))) ((eq ch ?\^M) (setcar (nthcdr 2 its:*select-alternative-output-menu* ) output) (let ((values (menu:select-from-menu its:*select-alternative-output-menu* (car action-output) t))) (cond((consp values) (setcar action-output (nth 1 values)) (setq ch ?\^L))))) ((eq ch ?\^L) ) (t (beep) )) (delete-region point (point))) (if its:*insert-output-string* (funcall its:*insert-output-string* (nth (car action-output) output)) (insert (nth (car action-output) output))))) ;;; translate until ;;; interactive --> not ordinal-charp ;;; or ;;; not interactive --> end of input (defvar its:*insert-output-string* nil) (defvar its:*display-status-string* nil) (defun its:translate-region (start end its:*interactive* &optional topmap) (set-marker its:*buff-s* start) (set-marker its:*buff-e* end) (its:reset-input) (goto-char its:*buff-s*) (let ((topmap (or topmap its:*current-map*)) (map nil) (ch nil) (action nil) (newmap nil) (inhibit-quit t) (its-quit-flag nil) (echo-keystrokes 0)) (setq map topmap) (its:reset-maps topmap) (while (not its-quit-flag) (setq ch (its:read-char)) (when (wnn7-p) ; input efficiency (egg-predict-inc-input-length)) ; key input count (setq newmap (get-next-map map ch)) (setq action (get-action newmap)) (cond ((and its:*interactive* (not its:*char-from-buff*) (characterp ch) (= ch ?\^@)) (delete-region its:*buff-s* (point)) (let ((i 1)) (while (<= i its:*level*) (insert (aref its:*inputs* i)) (setq i (1+ i)))) (let ((inputs (its:completing-read "ITS:>" (its:make-alist-from-map topmap) nil t (buffer-substring its:*buff-s* (point))))) (delete-region its:*buff-s* (point)) (save-excursion (insert inputs)) (its:reset-maps) (setq map topmap) )) ((or (null newmap) (and (map-terminalp newmap) (null action))) (cond((and its:*interactive* (its:delete-charp ch)) (delete-region its:*buff-s* (point)) (cond((= its:*level* 0) (setq its-quit-flag t)) ((= its:*level* 1) (its:insert-char (aref its:*inputs* 1)) (setq its-quit-flag t)) (t (its:flush-input-before-point (1+ its:*level*)) (setq its:*level* (1- its:*level*)) (setq map (its:current-map)) (if (and its:*interactive* its:*display-status-string*) (funcall its:*display-status-string* (map-state map)) (insert (map-state map))) ))) ((and its:*interactive* (its:tabp ch)) ; (setq its-quit-flag t)) ; (t (let ((output nil)) (let ((i its:*level*) (newlevel (1+ its:*level*))) (aset its:*inputs* newlevel ch) (while (and (< 0 i) (null output)) (if (and (aref its:*actions* i) (its:simulate-input (1+ i) newlevel its:*inputs* topmap)) (setq output i)) (setq i (1- i))) (if (null output) (let ((i its:*level*)) (while (and (< 0 i) (null output)) (if (aref its:*actions* i) (setq output i)) (setq i (1- i))))) (cond(output (delete-region its:*buff-s* (point)) (cond((its:standard-actionp (aref its:*actions* output)) (let ((action-output (action-output (aref its:*actions* output)))) (if (and (not its:*interactive*) (consp action-output)) (setq action-output (nth (car action-output) (cdr action-output)))) (cond((stringp action-output) (if (and its:*interactive* its:*insert-output-string*) (funcall its:*insert-output-string* action-output) (insert action-output))) ((consp action-output) (its:select-alternative-output action-output) ) (t (beep) (beep) ))) (set-marker its:*buff-s* (point)) (its:push-char ch) (its:flush-input-before-point (1+ output)) (if (action-next (aref its:*actions* output)) (save-excursion (insert (action-next (aref its:*actions* output))))) ) ((symbolp (aref its:*actions* output)) (its:push-char ch) (funcall (aref its:*actions* output)) (its:reset-maps its:*current-map*) (setq topmap its:*current-map*) (set-marker its:*buff-s* (point))) (t (its:push-char ch) ;92.10.26 by T.Saneto (eval (aref its:*actions* output)) (its:reset-maps its:*current-map*) (setq topmap its:*current-map*) (set-marker its:*buff-s* (point)) )) ) ((= 0 its:*level*) (cond ((or (its:ordinal-charp ch) its:*char-from-buff*) (its:insert-char ch)) (t (setq its-quit-flag t)))) ((< 0 its:*level*) (delete-region its:*buff-s* (point)) (its:insert-char (aref its:*inputs* 1)) (set-marker its:*buff-s* (point)) (its:push-char ch) (its:flush-input-before-point 2))))) (cond((null ch) (setq its-quit-flag t)) ((not its-quit-flag) (its:reset-maps) (set-marker its:*buff-s* (point)) (setq map topmap)))))) ((map-terminalp newmap) (its:enter-newlevel (setq map newmap) ch action) (delete-region its:*buff-s* (point)) (let ((output nil) (m nil) (i (1- its:*level*))) (while (and (< 0 i) (null output)) (if (and (aref its:*actions* i) (setq m (its:simulate-input (1+ i) its:*level* its:*inputs* topmap)) (not (map-terminalp m))) (setq output i)) (setq i (1- i))) (cond((null output) (cond ((its:standard-actionp action) (let ((action-output (action-output action))) (if (and (not its:*interactive*) (consp action-output)) (setq action-output (nth (car action-output) (cdr action-output)))) (cond((stringp action-output) (if (and its:*interactive* its:*insert-output-string*) (funcall its:*insert-output-string* action-output) (insert action-output)) ; (if (and (wnn7-p) (egg-predict-realtime-p)) ; (egg-predict-start-realtime))) ; ((consp action-output) (its:select-alternative-output action-output) ) (t (beep) (beep) ))) (cond((null (action-next action)) (cond ((and (= (point) its:*buff-e*) its:*interactive* (its:delete-charp (its:peek-char))) nil) (t (set-marker its:*buff-s* (point)) (its:reset-maps) (setq map topmap) ))) (t (save-excursion (insert (action-next action))) (set-marker its:*buff-s* (point)) (its:reset-maps) (setq map topmap)))) ((symbolp action) (funcall action) (its:reset-maps its:*current-map*) (setq topmap its:*current-map*) (setq map topmap) (set-marker its:*buff-s* (point))) (t (eval action) (its:reset-maps its:*current-map*) (setq topmap its:*current-map*) (setq map topmap) (set-marker its:*buff-s* (point))))) (t (if (and its:*interactive* its:*display-status-string*) (funcall its:*display-status-string* (map-state map)) (insert (map-state map))))))) ((null action) (delete-region its:*buff-s* (point)) (if (and its:*interactive* its:*display-status-string*) (funcall its:*display-status-string* (map-state newmap)) (insert (map-state newmap))) ; (if (and (wnn7-p) (egg-predict-realtime-p)) ; (egg-predict-start-realtime)) ; (its:enter-newlevel (setq map newmap) ch action)) (t (its:enter-newlevel (setq map newmap) ch action) (delete-region its:*buff-s* (point)) (if (and its:*interactive* its:*display-status-string*) (funcall its:*display-status-string* (map-state map)) (insert (map-state map))) (if (and (wnn7-p) (egg-predict-realtime-p)) ; (egg-predict-start-realtime)) ; ))) (set-marker its:*buff-s* nil) (set-marker its:*buff-e* nil) (if (featurep 'xemacs) (if (and its:*interactive* ch) (setq unread-command-events (list (character-to-event ch)))) (if (and its:*interactive* ch) (setq unread-command-events (list ch)))) )) ;;;---------------------------------------------------------------------- ;;; ;;; ITS-map dump routine: ;;; ;;;---------------------------------------------------------------------- ;;;;; ;;;;; User entry: dump-its-mode-map ;;;;; ;; 92.6.26 by K.Handa (defun dump-its-mode-map (name filename) "Obsolete." (interactive) (message "This function is obsolete in the current version of Mule.")) ;;; ;;; EGG mode variables ;;; (defvar egg:*mode-on* nil "T if egg mode is on.") (make-variable-buffer-local 'egg:*mode-on*) (set-default 'egg:*mode-on* nil) (defvar egg:*input-mode* t "T if egg map is active.") (make-variable-buffer-local 'egg:*input-mode*) (set-default 'egg:*input-mode* t) (defvar egg:*in-fence-mode* nil "T if in fence mode.") (make-variable-buffer-local 'egg:*in-fence-mode*) (set-default 'egg:*in-fence-mode* nil) (defvar its:*current-map* nil) ;;(setq-default its:*current-map* (its:get-mode-map "roma-kana")) (make-variable-buffer-local 'its:*current-map*) (defvar its:*previous-map* nil) (make-variable-buffer-local 'its:*previous-map*) (setq-default its:*previous-map* nil) ;;;---------------------------------------------------------------------- ;;; ;;; Mode line control functions; ;;; ;;;---------------------------------------------------------------------- (defconst mode-line-egg-mode "--") (make-variable-buffer-local 'mode-line-egg-mode) (defvar mode-line-egg-mode-in-minibuffer "--" "global variable") (defun egg:find-symbol-in-tree (item tree) (if (consp tree) (or (egg:find-symbol-in-tree item (car tree)) (egg:find-symbol-in-tree item (cdr tree))) (equal item tree))) ;;; ;;; nemacs Ver. 3.0 $B$G$O(B Fselect_window $B$,JQ99$K$J$j!"(Bminibuffer-window ;;; $BB>$N(B window $B$H$N4V$G=PF~$j$,$"$k$H!"(Bmode-line $B$N99?7$r9T$J$$!"JQ?t(B ;;; minibuffer-window-selected $B$NCM$,99?7$5$l$k(B ;;; ;;; nemacs Ver. 4 $B$G$O(B Fselect_window $B$,JQ99$K$J$j!$(Bselect-window-hook ;;; $B$,Dj5A$5$l$?!%$3$l$K$H$b$J$$=>Mh!$:FDj5A$7$F$$$?(B select-window, ;;; other-window, keyborad-quit, abort-recursive-edit, exit-minibuffer ;;; $B$r:o=|$7$?!%(B (defconst display-minibuffer-mode-in-minibuffer t) (defconst display-minibuffer-mode nil) (defvar minibuffer-preprompt nil) (defvar minibuffer-window-selected nil) (defun egg:select-window-hook (old new) (if (and (eq old (minibuffer-window)) (not (eq new (minibuffer-window)))) (save-excursion (set-buffer (window-buffer (minibuffer-window))) (if (featurep 'xemacs) (set-minibuffer-preprompt nil) (setq minibuffer-preprompt nil)) (setq egg:*mode-on* (default-value 'egg:*mode-on*) egg:*input-mode* (default-value 'egg:*input-mode*) egg:*in-fence-mode* (default-value 'egg:*in-fence-mode*)))) (if (eq new (minibuffer-window)) (setq minibuffer-window-selected t) (setq minibuffer-window-selected nil))) (defun egg:minibuffer-entry-hook () (setq minibuffer-window-selected t)) (defun egg:minibuffer-exit-hook () "Call upon exit from minibuffer" (if (featurep 'xemacs) (set-minibuffer-preprompt nil) (setq minibuffer-preprompt nil)) (setq minibuffer-window-selected nil) (save-excursion (set-buffer (window-buffer (minibuffer-window))) (setq egg:*mode-on* (default-value 'egg:*mode-on*) egg:*input-mode* (default-value 'egg:*input-mode*) egg:*in-fence-mode* (default-value 'egg:*in-fence-mode*)))) ;;; ;;; ;;; (defvar its:*reset-modeline-format* nil) ;;; ;;; minibuffer $B$G$N%b!<%II=<($r$9$k$?$a$K(B nemacs 4 $B$GDj5A$5$l$?(B ;;; minibuffer-preprompt $B$rMxMQ$9$k!%(B ;;; (defconst egg:minibuffer-preprompt '("[" nil "]")) (defvar egg-yosoku-mode nil "$BF~NOM=B,%b!<%I(B") (defun mode-line-egg-mode-update (str) (if (and (wnn7-p) egg-yosoku-mode egg:*mode-on* egg:*input-mode*) (setq str (concat str "$BM=(B"))) (if (eq (current-buffer) (window-buffer (minibuffer-window))) (if display-minibuffer-mode-in-minibuffer (progn (aset (nth 0 egg:minibuffer-preprompt) 0 (if its:*previous-map* ?\< ?\[)) (setcar (nthcdr 1 egg:minibuffer-preprompt) str) (aset (nth 2 egg:minibuffer-preprompt) 0 (if its:*previous-map* ?\> ?\])) (if (featurep 'xemacs) (set-minibuffer-preprompt (concat (car egg:minibuffer-preprompt) (car (nthcdr 1 egg:minibuffer-preprompt)) (car (nthcdr 2 egg:minibuffer-preprompt)))) (setq minibuffer-preprompt egg:minibuffer-preprompt))) (setq display-minibuffer-mode t mode-line-egg-mode-in-minibuffer str)) (setq display-minibuffer-mode nil mode-line-egg-mode str)) (if (featurep 'xemacs) (redraw-modeline t) ;; nemacs 4 only(update-mode-lines) (set-buffer-modified-p (buffer-modified-p)))) ;;(mode-line-egg-mode-update mode-line-egg-mode) ;;; ;;; egg mode line display ;;; (defvar alphabet-mode-indicator "aA") (defvar transparent-mode-indicator "--") (defun egg:mode-line-display () (mode-line-egg-mode-update (cond((and egg:*in-fence-mode* (not egg:*input-mode*)) alphabet-mode-indicator) ((and egg:*mode-on* egg:*input-mode*) (map-indicator its:*current-map*)) (t transparent-mode-indicator)))) (defun egg:toggle-egg-mode-on-off () (interactive) (setq egg:*mode-on* (not egg:*mode-on*)) (egg:mode-line-display)) (defun its:select-mode (name) (interactive (list (completing-read "ITS mode: " its:*mode-alist*))) (if (its:get-mode-map name) (progn (setq its:*current-map* (its:get-mode-map name)) (egg:mode-line-display)) (beep))) (defvar its:*select-mode-menu* '(menu "Mode:" nil)) (defun its:select-mode-from-menu () (interactive) (setcar (nthcdr 2 its:*select-mode-menu*) its:*mode-alist*) (setq its:*current-map* (menu:select-from-menu its:*select-mode-menu*)) (egg:mode-line-display)) (defvar its:*standard-modes* nil) ;; (list (its:get-mode-map "roma-kana") ;; (its:get-mode-map "roma-kata") ;; (its:get-mode-map "downcase") ;; (its:get-mode-map "upcase") ;; (its:get-mode-map "zenkaku-downcase") ;; (its:get-mode-map "zenkaku-upcase")) ;; "List of standard mode-map of EGG.") (defun its:find (map list) (let ((n 0)) (while (and list (not (eq map (car list)))) (setq list (cdr list) n (1+ n))) (if list n nil))) (defun its:next-mode () (interactive) (let ((pos (its:find its:*current-map* its:*standard-modes*))) (setq its:*current-map* (nth (% (1+ pos) (length its:*standard-modes*)) its:*standard-modes*)) (egg:mode-line-display))) (defun its:previous-mode () (interactive) (let ((pos (its:find its:*current-map* its:*standard-modes*))) (setq its:*current-map* (nth (1- (if (= pos 0) (length its:*standard-modes*) pos)) its:*standard-modes*)) (egg:mode-line-display))) (defun its:select-hiragana () (interactive) (its:select-mode "roma-kana")) (defun its:select-katakana () (interactive) (its:select-mode "roma-kata")) (defun its:select-downcase () (interactive) (its:select-mode "downcase")) (defun its:select-upcase () (interactive) (its:select-mode "upcase")) (defun its:select-zenkaku-downcase () (interactive) (its:select-mode "zenkaku-downcase")) (defun its:select-zenkaku-upcase () (interactive) (its:select-mode "zenkaku-upcase")) (defun its:select-mode-temporally (name) (interactive (list (completing-read "ITS mode: " its:*mode-alist*))) (let ((map (its:get-mode-map name))) (if map (progn (if (null its:*previous-map*) (setq its:*previous-map* its:*current-map*)) (setq its:*current-map* map) (egg:mode-line-display)) (beep)))) (defun its:select-previous-mode () (interactive) (if (null its:*previous-map*) (beep) (setq its:*current-map* its:*previous-map* its:*previous-map* nil) (egg:mode-line-display))) (defun toggle-egg-mode () (interactive) (if egg:*mode-on* (fence-toggle-egg-mode) (progn (setq egg:*mode-on* t) (egg:mode-line-display)))) (defun fence-toggle-egg-mode () (interactive) (if its:*current-map* (progn (setq egg:*input-mode* (not egg:*input-mode*)) (egg:mode-line-display)) (beep))) ;;; ;;; Changes on Global map ;;; (defvar si:*global-map* (copy-keymap global-map)) (substitute-key-definition 'self-insert-command 'egg-self-insert-command global-map) ;; $BF~NOM=B,D>A0EPO?:o=|MQ$NBP1~(B (substitute-key-definition 'delete-backward-char 'egg-delete-backward-char global-map) (substitute-key-definition 'backward-delete-char-untabify 'egg-backward-delete-char-untabify global-map) (if (featurep 'xemacs) ;; wire us into pending-delete (put 'egg-self-insert-command 'pending-delete t)) ;;; ;;; Currently entries C-\ and C-^ at global-map are undefined. ;;; ;; Make this no-op if LEIM interface is used. (cond ((featurep 'wnn7egg-leim) t) (t (define-key global-map "\C-\\" 'toggle-egg-mode)) ) ;; #### Should hide bindings like this, too? However, `convert-region' ;; probably isn't going to be a LEIM feature, it's really pretty ;; Japanese and Korean specific. (define-key global-map "\C-x " 'wnn7-henkan-region) ;; 92.3.16 by K.Handa ;; global-map => mule-keymap (define-key mule-keymap "m" 'its:select-mode-from-menu) (define-key mule-keymap ">" 'its:next-mode) (define-key mule-keymap "<" 'its:previous-mode) (define-key mule-keymap "h" 'its:select-hiragana) (define-key mule-keymap "k" 'its:select-katakana) (define-key mule-keymap "q" 'its:select-downcase) (define-key mule-keymap "Q" 'its:select-upcase) (define-key mule-keymap "z" 'its:select-zenkaku-downcase) (define-key mule-keymap "Z" 'its:select-zenkaku-upcase) ;;; ;;; auto fill controll ;;; (defun egg:do-auto-fill () (if (and auto-fill-function (not buffer-read-only) (> (current-column) fill-column)) (let ((ocolumn (current-column))) (funcall auto-fill-function) (while (and (< fill-column (current-column)) (< (current-column) ocolumn)) (setq ocolumn (current-column)) (funcall auto-fill-function))))) ;;;---------------------------------------------------------------------- ;;; ;;; Egg fence mode ;;; ;;;---------------------------------------------------------------------- (defvar egg:*fence-open* "|" "*$B%U%'%s%9$N;OE@$r<($9J8;zNs(B") (defvar egg:*fence-close* "|" "*$B%U%'%s%9$N=*E@$r<($9J8;zNs(B") (defvar egg:*fence-face* nil "*$B%U%'%s%9I=<($KMQ$$$k(B face $B$^$?$O(B nil") (if (featurep 'xemacs) (make-variable-buffer-local (defvar egg:*fence-extent* nil "$B%U%'%s%9I=<(MQ(B extent")) (make-variable-buffer-local (defvar egg:*fence-overlay* nil "$B%U%'%s%9I=<(MQ(B overlay"))) (defvar egg:*face-alist* '(("nil" . nil) ("highlight" . highlight) ("modeline" . modeline) ("inverse" . modeline) ("underline" . underline) ("bold" . bold) ("region" . region))) (defun set-egg-fence-mode-format (open close &optional face) "fence mode $B$NI=<(J}K!$r@_Dj$9$k!#(BOPEN $B$O%U%'%s%9$N;OE@$r<($9J8;zNs$^$?$O(B nil$B!#(B\n\ CLOSE$B$O%U%'%s%9$N=*E@$r<($9J8;zNs$^$?$O(B nil$B!#(B\n\ $BBh(B3$B0z?t(B FACE $B$,;XDj$5$l$F(B nil $B$G$J$1$l$P!"%U%'%s%96h4V$NI=<($K$=$l$r;H$&!#(B" (interactive (list (read-string "$B%U%'%s%93+;OJ8;zNs(B: ") (read-string "$B%U%'%s%9=*N;J8;zNs(B: ") (cdr (assoc (completing-read "$B%U%'%s%9I=<(B0@-(B: " egg:*face-alist*) egg:*face-alist*)))) (if (and (or (stringp open) (null open)) (or (stringp close) (null close)) (or (null face) (memq face (face-list)))) (progn (setq egg:*fence-open* (or open "") egg:*fence-close* (or close "") egg:*fence-face* face) (if (featurep 'xemacs) (if (extentp egg:*fence-extent*) (set-extent-property egg:*fence-extent* 'face egg:*fence-face*)) (if (overlayp egg:*fence-overlay*) (overlay-put egg:*fence-overlay* 'face egg:*fence-face*))) t) (error "Wrong type of argument: %s %s %s" open close face))) (defvar egg:*region-start* nil) (make-variable-buffer-local 'egg:*region-start*) (set-default 'egg:*region-start* nil) (defvar egg:*region-end* nil) (make-variable-buffer-local 'egg:*region-end*) (set-default 'egg:*region-end* nil) ;;(defvar egg:*global-map-backup* nil) ;;(defvar egg:*local-map-backup* nil) ;;; Moved to kanji.el ;;; (defvar self-insert-after-hook nil ;;; "Hook to run when extended self insertion command exits. Should take ;;; two arguments START and END correspoding to character position.") (defvar self-insert-after-hook nil "Hook to run when extended self insertion command exits. Should take two arguments START and END correspoding to character position.") (defvar egg:*self-insert-non-undo-count* 0 "counter to hold repetition of egg-self-insert-command.") (defvar egg-insert-after-hook nil) (make-variable-buffer-local 'egg-insert-after-hook) (defun egg:cancel-undo-boundary () "Cancel undo boundary for egg-self-insert-command" (if (eq last-command 'egg-self-insert-command) (if (and (consp buffer-undo-list) ;; if car is nil. (null (car buffer-undo-list)) (< egg:*self-insert-non-undo-count* 20)) ;; treat consecutive 20 self-insert commands as a single undo chunk. ;; `20' is a magic number copied from keyboard.c (setq buffer-undo-list (cdr buffer-undo-list) egg:*self-insert-non-undo-count* (1+ egg:*self-insert-non-undo-count*)) (setq egg:*self-insert-non-undo-count* 1)))) (if (featurep 'xemacs) (defun egg-self-insert-command (arg) (interactive "p") (if (and (not buffer-read-only) egg:*mode-on* egg:*input-mode* (not egg:*in-fence-mode*) ;;; inhibit recursive fence mode (not (= (event-to-character last-command-event) ? ))) (progn (if (wnn7-p); $BM=B,D>A0EPO?:o=|(B & $BM=B,A08e>pJs%/%j%"(B (egg-predict-check-reset-connective)) (egg:enter-fence-mode-and-self-insert)) (progn ;; treat continuous 20 self insert as a single undo chunk. ;; `20' is a magic number copied from keyboard.c (if (or ;92.12.20 by T.Enami (not (eq last-command 'egg-self-insert-command)) (>= egg:*self-insert-non-undo-count* 20)) (setq egg:*self-insert-non-undo-count* 1) (cancel-undo-boundary) (setq egg:*self-insert-non-undo-count* (1+ egg:*self-insert-non-undo-count*))) (self-insert-command arg) (if egg-insert-after-hook (run-hooks 'egg-insert-after-hook)) (if self-insert-after-hook (if (<= 1 arg) (funcall self-insert-after-hook (- (point) arg) (point))) (if (= (event-to-character last-command-event) ? ) (egg:do-auto-fill)))))) (defun egg-self-insert-command (arg) (interactive "p") (if (and (not buffer-read-only) egg:*mode-on* egg:*input-mode* (not egg:*in-fence-mode*) ;;; inhibit recursive fence mode (not (= last-command-event ? ))) (progn (if (wnn7-p); $BM=B,D>A0EPO?:o=|(B & $BM=B,A08e>pJs%/%j%"(B (egg-predict-check-reset-connective)) (egg:enter-fence-mode-and-self-insert)) (progn (if (and (eq last-command 'egg-self-insert-command) (> last-command-char ? )) (egg:cancel-undo-boundary)) (self-insert-command arg) (if egg-insert-after-hook (run-hooks 'egg-insert-after-hook)) (if self-insert-after-hook (if (<= 1 arg) (funcall self-insert-after-hook (- (point) arg) (point))) (if (= last-command-event ? ) (egg:do-auto-fill))))))) ;; ;; $BA03NDjJQ49=hM}4X?t(B ;; (defvar egg:*fence-open-backup* nil) (defvar egg:*fence-close-backup* nil) (defvar egg:*fence-face-backup* nil) (defconst egg:*fence-open-in-cont* "+" "*$BA03NDj>uBV$G$N(B *fence-open*") (defconst egg:*fence-close-in-cont* t "*$BA03NDj>uBV$G$N(B *fence-close*") (defconst egg:*fence-face-in-cont* t "*$BA03NDj>uBV$G$N(B *fence-face*") (defun set-egg-fence-mode-format-in-cont (open close face) "$BA03NDj>uBV$G$N(B fence mode $B$NI=<(J}K!$r@_Dj$9$k!#(BOPEN $B$O%U%'%s%9$N;OE@$r<($9J8(B $B;zNs!"(Bt $B$^$?$O(B nil$B!#(B\n\ CLOSE$B$O%U%'%s%9$N=*E@$r<($9J8;zNs!"(Bt $B$^$?$O(B nil$B!#(B\n\ FACE $B$O(B nil $B$G$J$1$l$P!"%U%'%s%96h4V$NI=<($K$=$l$r;H$&!#(B\n\ $B$=$l$>$l$NCM$,(B t $B$N>l9g!"DL>o$N(B egg:*fence-open* $BEy$NCM$r0z$-7Q$0!#(B" (interactive (list (read-string "$B%U%'%s%93+;OJ8;zNs(B: ") (read-string "$B%U%'%s%9=*N;J8;zNs(B: ") (cdr (assoc (completing-read "$B%U%'%s%9I=<(B0@-(B: " egg:*face -alist*) egg:*face-alist*)))) (if (and (or (stringp open) (eq open t) (null open)) (or (stringp close) (eq close t) (null close)) (or (null face) (eq face t) (memq face (face-list)))) (progn (setq egg:*fence-open-in-cont* (or open "") egg:*fence-close-in-cont* (or close "") egg:*fence-face-in-cont* face) (if (featurep 'xemacs) (if (extentp egg:*fence-extent*) (set-extent-property egg:*fence-extent* 'face egg:*fence-face*)) (if (overlayp egg:*fence-overlay*) (overlay-put egg:*fence-overlay* 'face egg:*fence-face*))) t) (error "Wrong type of argument: %s %s %s" open close face))) (defvar *in-cont-flag* nil "$BD>A0$KJQ49$7$?D>8e$NF~NO$+$I$&$+$r<($9!#(B") (defvar *in-cont-backup-flag* nil) (defun egg:check-fence-in-cont () (if *in-cont-flag* (progn (setq *in-cont-backup-flag* t) (setq egg:*fence-open-backup* egg:*fence-open*) (setq egg:*fence-close-backup* egg:*fence-close*) (setq egg:*fence-face-backup* egg:*fence-face*) (or (eq egg:*fence-open-in-cont* t) (setq egg:*fence-open* egg:*fence-open-in-cont*)) (or (eq egg:*fence-close-in-cont* t) (setq egg:*fence-close* egg:*fence-close-in-cont*)) (or (eq egg:*fence-face-in-cont* t) (setq egg:*fence-face* egg:*fence-face-in-cont*))))) (defun egg:restore-fence-in-cont () "Restore egg:*fence-open* and egg:*fence-close*" (if *in-cont-backup-flag* (progn (setq egg:*fence-open* egg:*fence-open-backup*) (setq egg:*fence-close* egg:*fence-close-backup*) (setq egg:*fence-face* egg:*fence-face-backup*))) (setq *in-cont-backup-flag* nil) ) (defun egg:enter-fence-mode-and-self-insert () (if (wnn7-p) (setq *in-cont-flag* (memq last-command '(wnn7-henkan-kakutei wnn7-henkan-kakutei-and-self-insert))) (setq *in-cont-flag* (memq last-command '(henkan-kakutei henkan-kakutei-and-self-insert)))) (enter-fence-mode) (setq unread-command-events (list last-command-event))) (defun egg:fence-face-on () (if egg:*fence-face* (if (featurep 'xemacs) (progn (if (extentp egg:*fence-extent*) (set-extent-endpoints egg:*fence-extent* egg:*region-start* egg:*region-end*) (setq egg:*fence-extent* (make-extent egg:*region-start* egg:*region-end*)) (set-extent-property egg:*fence-extent* 'start-open nil) (set-extent-property egg:*fence-extent* 'end-open nil) (set-extent-property egg:*fence-extent* 'detachable nil)) (set-extent-face egg:*fence-extent* egg:*fence-face*)) (progn (or (overlayp egg:*fence-overlay*) (setq egg:*fence-overlay* (make-overlay 1 1 nil nil t))) (if egg:*fence-face* (or (eq egg:*fence-face* (overlay-get egg:*fence-overlay* 'face)) (overlay-put egg:*fence-overlay* 'face egg:*fence-face*))) (move-overlay egg:*fence-overlay* egg:*region-start* egg:*region-end*))))) (defun egg:fence-face-off () (if (featurep 'xemacs) (and egg:*fence-face* (extentp egg:*fence-extent*) (detach-extent egg:*fence-extent*)) (and egg:*fence-face* (overlayp egg:*fence-overlay*) (delete-overlay egg:*fence-overlay*)))) (defun enter-fence-mode () ;;;(buffer-flush-undo (current-buffer)) (suspend-undo) ;;;(and (boundp 'disable-undo) (setq disable-undo t)) (if (featurep 'xemacs) (setq egg:*in-fence-mode* t egg:fence-buffer (current-buffer)) (setq egg:*in-fence-mode* t)) (when (wnn7-p) ; input efficiency (egg-predict-check-start-time) (egg-predict-check-start-input)) (egg:mode-line-display) (egg:check-fence-in-cont) ; for Wnn6 (insert egg:*fence-open*) (or (markerp egg:*region-start*) (setq egg:*region-start* (make-marker))) (set-marker egg:*region-start* (point)) (insert egg:*fence-close*) (or (markerp egg:*region-end*) (set-marker-insertion-type (setq egg:*region-end* (make-marker)) t)) (set-marker egg:*region-end* egg:*region-start*) (egg:fence-face-on) (goto-char egg:*region-start*) ) (defun henkan-fence-region-or-single-space () (interactive) (if egg:*input-mode* (henkan-fence-region) (insert ? ))) (defvar egg:*henkan-fence-mode* nil) (defun henkan-fence-region () (interactive) (setq egg:*henkan-fence-mode* t) (egg:fence-face-off) (if (wnn7-p) (progn (when egg-predict-status (egg-predict-clear)) (wnn7-henkan-region-internal egg:*region-start* egg:*region-end* )) (henkan-region-internal egg:*region-start* egg:*region-end* ))) (defun fence-katakana () (interactive) (japanese-katakana-region egg:*region-start* egg:*region-end*)) (defun fence-hiragana () (interactive) (japanese-hiragana-region egg:*region-start* egg:*region-end*)) (defun fence-hankaku () (interactive) (japanese-hankaku-region egg:*region-start* egg:*region-end* 'ascii-only)) (defun fence-zenkaku () (interactive) (japanese-zenkaku-region egg:*region-start* egg:*region-end*)) (defun fence-backward-char () (interactive) (if (< egg:*region-start* (point)) (backward-char) (beep))) (defun fence-forward-char () (interactive) (if (< (point) egg:*region-end*) (forward-char) (beep))) (defun fence-beginning-of-line () (interactive) (goto-char egg:*region-start*)) (defun fence-end-of-line () (interactive) (goto-char egg:*region-end*)) (defun fence-transpose-chars (arg) (interactive "P") (if (and (< egg:*region-start* (point)) (< (point) egg:*region-end*)) (transpose-chars arg) (beep))) (defun egg:exit-if-empty-region () (if (= egg:*region-start* egg:*region-end*) (fence-exit-mode))) (defun fence-delete-char () (interactive) (if (< (point) egg:*region-end*) (progn (delete-char 1) (egg:exit-if-empty-region)) (beep))) (defun fence-backward-delete-char () (interactive) (if (< egg:*region-start* (point)) (progn (delete-char -1) (if (and (wnn7-p) (egg-predict-realtime-p)) (egg-predict-start-realtime)) (egg:exit-if-empty-region)) (beep))) (defun fence-kill-line () (interactive) (delete-region (point) egg:*region-end*) (egg:exit-if-empty-region)) (defun fence-exit-mode () (interactive) ;; "aA" $B$N>uBV$+$i(B "--" $B$N>uBV$KLa$k$H!J(Bfence-toggle-egg-mode $B$,9T$o$l$F(B ;; transparent-mode $B$KLa$k$H!K(Binput-method $B$N(B status $B$HL7=b$7$F$7$^$&!#(B ;; $B$=$3$G!"(Balphabet-mode $B$N8e$O!"(Btransparent-mode $B$KLa$i$J$$$h$&$K(B ;; input-mode $B%U%i%0$rLa$9(B (if (equal mode-line-egg-mode "aA") (setq egg:*input-mode* t)) (egg:fence-face-off) (setq egg:*in-fence-mode* nil) (let ((kakutei-string (buffer-substring egg:*region-start* egg:*region-end*))) (delete-region (- egg:*region-start* (length egg:*fence-open*)) egg:*region-start*) (delete-region egg:*region-start* egg:*region-end*) (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*fence-close*))) (goto-char egg:*region-start*) (when (wnn7-p) (egg-predict-clear)) (resume-undo-list) (insert kakutei-string) (when (wnn7-p) (if (> (length kakutei-string) 0) (progn (egg-predict-inc-kakutei-length) ;;; (egg-predict-toroku kakutei-string))))) (if its:*previous-map* (setq its:*current-map* its:*previous-map* its:*previous-map* nil)) (egg:quit-egg-mode)) (if (not (featurep 'xemacs)) (defun delete-text-in-column (from to) "Delete the text between column FROM and TO (exclusive) of the current line. Nil of FORM or TO means the current column. If there's a charcter across the borders, the character is replaced with the same width of spaces before deleting." (save-excursion (let (p1 p2) (if from (progn (setq p1 (move-to-column from)) (if (> p1 from) (progn (delete-char -1) (insert-char ? (- p1 (current-column))) (forward-char (- from p1)))))) (setq p1 (point)) (if to (progn (setq p2 (move-to-column to)) (if (> p2 to) (progn (delete-char -1) (insert-char ? (- p2 (current-column))) (forward-char (- to p2)))))) (setq p2 (point)) (delete-region p1 p2))))) (defvar egg-exit-hook nil "Hook to run when egg exits. Should take two arguments START and END correspoding to character position.") (defun egg:quit-egg-mode () (egg:mode-line-display) (if overwrite-mode (let ((str (buffer-substring egg:*region-end* egg:*region-start*))) (delete-text-in-column nil (+ (current-column) (string-width str))))) (egg:restore-fence-in-cont) ; for Wnn6 (setq egg:*henkan-fence-mode* nil) (if self-insert-after-hook (funcall self-insert-after-hook egg:*region-start* egg:*region-end*) (if egg-exit-hook (funcall egg-exit-hook egg:*region-start* egg:*region-end*) (if (not (= egg:*region-start* egg:*region-end*)) (egg:do-auto-fill)))) (set-marker egg:*region-start* nil) (set-marker egg:*region-end* nil) (when (wnn7-p) (egg-predict-check-end)) (if egg-insert-after-hook (run-hooks 'egg-insert-after-hook)) ) (defun fence-cancel-input () (interactive) (delete-region egg:*region-start* egg:*region-end*) (fence-exit-mode)) (defun egg-lang-switch-callback () "Do whatever processing is necessary when the language-environment changes." (if egg:*in-fence-mode* (progn (its:reset-input) (fence-kill-operation))) ;; (let ((func (get current-language-environment 'set-egg-environ))) ;; (if (not (null func)) ;; (funcall func))) (egg:mode-line-display)) (if (featurep 'xemacs) (defun fence-mode-help-command () "Display fence mode help" (interactive "_") (let ((w (selected-window))) (describe-function 'wnn7-egg-mode) (ding) (select-window w))) (defun fence-mode-help-command () "Display fence mode help" (interactive) (let ((w (selected-window))) (describe-function 'wnn7-egg-mode) (ding) (select-window w)))) (if (featurep 'xemacs) (defvar fence-mode-map (make-sparse-keymap)) (defvar fence-mode-map (append '(keymap (t . undefined) (?\C-x keymap (t . undefined))) function-key-map)) (defvar fence-mode-esc-map nil) (define-prefix-command 'fence-mode-esc-map) (define-key fence-mode-map "\e" fence-mode-esc-map) (define-key fence-mode-map [escape] fence-mode-esc-map) (define-key fence-mode-esc-map [t] 'undefined)) (substitute-key-definition 'egg-self-insert-command 'fence-self-insert-command fence-mode-map global-map) (if (featurep 'xemacs) (set-keymap-default-binding fence-mode-map 'undefined)) (define-key fence-mode-map "\eh" 'fence-hiragana) (define-key fence-mode-map "\ek" 'fence-katakana) (define-key fence-mode-map "\e<" 'fence-hankaku) (define-key fence-mode-map "\e>" 'fence-zenkaku) (define-key fence-mode-map "\e\C-h" 'its:select-hiragana) (define-key fence-mode-map "\e\C-k" 'its:select-katakana) (define-key fence-mode-map "\eq" 'its:select-downcase) (define-key fence-mode-map "\eQ" 'its:select-upcase) (define-key fence-mode-map "\ez" 'its:select-zenkaku-downcase) (define-key fence-mode-map "\eZ" 'its:select-zenkaku-upcase) (define-key fence-mode-map " " 'henkan-fence-region-or-single-space) (define-key fence-mode-map "\C-@" 'henkan-fence-region) ;;(define-key fence-mode-map [(control \ )] 'henkan-fence-region) (define-key fence-mode-map "\C-\ " 'henkan-fence-region) (define-key fence-mode-map "\C-a" 'fence-beginning-of-line) (define-key fence-mode-map "\C-b" 'fence-backward-char) (define-key fence-mode-map "\C-c" 'fence-cancel-input) (define-key fence-mode-map "\C-d" 'fence-delete-char) (define-key fence-mode-map "\C-e" 'fence-end-of-line) (define-key fence-mode-map "\C-f" 'fence-forward-char) (define-key fence-mode-map "\C-g" 'fence-cancel-input) (define-key fence-mode-map "\C-h" 'fence-mode-help-command) (define-key fence-mode-map "\C-i" 'egg-predict-start-parttime); for wnn7 (define-key fence-mode-map "\C-k" 'fence-kill-line) (define-key fence-mode-map "\C-l" 'fence-exit-mode) (define-key fence-mode-map "\C-m" 'fence-exit-mode) ;;; RET (define-key fence-mode-map "\C-q" 'its:select-previous-mode) (define-key fence-mode-map "\C-t" 'fence-transpose-chars) (define-key fence-mode-map "\C-w" 'henkan-fence-region) (define-key fence-mode-map "\C-z" 'eval-expression) (define-key fence-mode-map "\C-\\" 'fence-toggle-egg-mode) (define-key fence-mode-map "\C-_" 'jis-code-input) (define-key fence-mode-map "\177" 'fence-backward-delete-char) (define-key fence-mode-map [backspace] 'fence-backward-delete-char) (define-key fence-mode-map [clear] 'fence-cancel-input) (define-key fence-mode-map [delete] 'fence-backward-delete-char) (define-key fence-mode-map [help] 'fence-mode-help-command) (when (featurep 'xemacs) (define-key fence-mode-map [kp-enter] 'fence-exit-mode) (define-key fence-mode-map [kp-left] 'fence-backward-char) (define-key fence-mode-map [kp-right] 'fence-forward-char)) (define-key fence-mode-map [left] 'fence-backward-char) (define-key fence-mode-map [return] 'fence-exit-mode) (define-key fence-mode-map [right] 'fence-forward-char) (unless (assq 'egg:*in-fence-mode* minor-mode-map-alist) (setq minor-mode-map-alist (cons (cons 'egg:*in-fence-mode* fence-mode-map) minor-mode-map-alist))) ;;;---------------------------------------------------------------------- ;;; ;;; Read hiragana from minibuffer ;;; ;;;---------------------------------------------------------------------- (defvar egg:*minibuffer-local-hiragana-map* (copy-keymap minibuffer-local-map)) (substitute-key-definition 'egg-self-insert-command 'fence-self-insert-command egg:*minibuffer-local-hiragana-map* global-map) (defun read-hiragana-string (prompt &optional initial-input) (save-excursion (let ((minibuff (window-buffer (minibuffer-window)))) (set-buffer minibuff) (setq egg:*input-mode* t egg:*mode-on* t its:*current-map* (its:get-mode-map "roma-kana")) (mode-line-egg-mode-update (its:get-mode-indicator its:*current-map*)))) (read-from-minibuffer prompt initial-input egg:*minibuffer-local-hiragana-map*)) (defun read-kanji-string (prompt &optional initial-input) (save-excursion (let ((minibuff (window-buffer (minibuffer-window)))) (set-buffer minibuff) (setq egg:*input-mode* t egg:*mode-on* t its:*current-map* (its:get-mode-map "roma-kana")) (mode-line-egg-mode-update (its:get-mode-indicator "roma-kana")))) (read-from-minibuffer prompt initial-input)) (defconst isearch:read-kanji-string 'read-kanji-string) ;;; $B5-9fF~NO(B (defvar special-symbol-input-point nil) (defun special-symbol-input () (interactive) (require 'wnn7egg-jsymbol) ;; 92.7.8 by Y.Kawabe (let ((item (menu:select-from-menu *symbol-input-menu* special-symbol-input-point t)) (code t)) (and (listp item) (setq code (car item) special-symbol-input-point (cdr item))) ;; end of patch (cond((stringp code) (insert code)) ((consp code) (eval code)) ))) ;;(autoload 'busyu-input "busyu" nil t) ;92.10.18 by K.Handa ;;(autoload 'kakusuu-input "busyu" nil t) ;92.10.18 by K.Handa (its-autoload-mode-map "roma-kana" "its-v309/hira.el") (its-autoload-mode-map "roma-kata" "its-v309/kata.el") (its-autoload-mode-map "downcase" "its-v309/hankaku.el") (its-autoload-mode-map "upcase" "its-v309/hankaku.el") (its-autoload-mode-map "zenkaku-downcase" "its-v309/zenkaku.el") (its-autoload-mode-map "zenkaku-upcase" "its-v309/zenkaku.el") (setq-default its:*current-map* (its:get-mode-map "roma-kana")) (setq its:*standard-modes* (append (list (its:get-mode-map "roma-kana") (its:get-mode-map "roma-kata") (its:get-mode-map "downcase") (its:get-mode-map "upcase") (its:get-mode-map "zenkaku-downcase") (its:get-mode-map "zenkaku-upcase")) its:*standard-modes*)) (defun wnn7-egg-mode () "Install and start the egg input method. The keys that are defined for the fence mode (which is the translation part of egg) are:\\{fence-mode-map}" (interactive) (define-key global-map "\C-^" 'special-symbol-input) (let ((newmodeline (list 'display-minibuffer-mode-in-minibuffer ;; minibuffer mode in minibuffer (list (list 'its:*previous-map* "<" "[") 'mode-line-egg-mode (list 'its:*previous-map* ">" "]") ) ;; minibuffer mode in mode line (list (list 'minibuffer-window-selected (list 'display-minibuffer-mode "m" " ") " ") (list 'its:*previous-map* "<" "[") (list 'minibuffer-window-selected (list 'display-minibuffer-mode 'mode-line-egg-mode-in-minibuffer 'mode-line-egg-mode) 'mode-line-egg-mode) (list 'its:*previous-map* ">" "]") )))) (if (featurep 'xemacs) (if (not (egg:find-symbol-in-tree 'mode-line-egg-mode modeline-format)) (setq-default modeline-format (cons newmodeline modeline-format))) (if (not (egg:find-symbol-in-tree 'mode-line-egg-mode mode-line-format)) (setq-default mode-line-format (cons newmodeline mode-line-format)))) (if (featurep 'xemacs) (progn ;; put us into the modeline of all existing buffers (mapc (lambda (buf) (save-excursion (set-buffer buf) (if (not (egg:find-symbol-in-tree 'mode-line-egg-mode modeline-format)) (setq modeline-format (cons newmodeline modeline-format))))) (buffer-list))))) (if (boundp 'select-window-hook) (add-hook 'select-window-hook 'egg:select-window-hook) (add-hook 'minibuffer-exit-hook 'egg:minibuffer-exit-hook) (add-hook 'minibuffer-entry-hook 'egg:minibuffer-entry-hook)) (mode-line-egg-mode-update mode-line-egg-mode) (if its:*reset-modeline-format* (if (featurep 'xemacs) (setq-default modeline-format (cdr modeline-format)) (setq-default mode-line-format (cdr mode-line-format)))) ;; if set-lang-environment has already been called, ;; call egg-lang-switch-callback (if (not (null current-language-environment)) (egg-lang-switch-callback)) ) ;;(defun wnn7-p () ;; (if current-input-method ;; (string-match "japanese-egg-wnn7" current-input-method))) (provide 'wnn7egg) ;;; wnn7egg.el ends here wnn7egg-1.02.orig/elisp/emacs20/its-v309/0040755000764400003210000000000007474174160020014 5ustar ishikawaishikawawnn7egg-1.02.orig/elisp/emacs20/its-v309/han-kata.el0100644000764400003210000002211407474174160022017 0ustar ishikawaishikawa;; Basic Roma-to-HankakuKana (jisx0201) Translation Table for Egg ;; This file is part of Egg on Mule (Japanese Environment) ;; Egg is distributed in the forms of patches to GNU ;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC ;; LICENSE which is distributed along with GNU Emacs by the ;; Free Software Foundation. ;; Egg is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. See the GNU EMACS GENERAL PUBLIC LICENSE for ;; more details. ;; You should have received a copy of the GNU EMACS GENERAL ;; PUBLIC LICENSE along with Nemacs; see the file COPYING. ;; If not, write to the Free Software Foundation, 675 Mass ;; Ave, Cambridge, MA 02139, USA. ;;; 92.9.24 created for Mule Ver.0.9.6 by K.Shibata (require 'japan-util) (its-define-mode "roma-han-kata" "(I1'(B" t) (dolist (aa '("k" "s" "t" "h" "y" "r" "w" "g" "z" "d" "b" "p" "c" "f" "j" "v")) (its-defrule (concat aa aa) "(I/(B" aa)) (its-defrule "tch" "(I/(B" "ch") (dolist (q1 '("b" "m" "p")) (its-defrule (concat "m" q1) "(I](B" q1)) (its-defrule "N" "(I](B") (defvar enable-double-n-syntax nil "*Enable \"nn\" input for \"(I](B\" ") (its-defrule-conditional "n" ((not enable-double-n-syntax) "(I](B") (t nil)) (its-defrule-conditional "nn" ( enable-double-n-syntax "(I](B") (t nil)) (its-defrule "n'" "(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 "a" "(I1(B") (its-defrule "i" "(I2(B") (its-defrule "u" "(I3(B") (its-defrule "e" "(I4(B") (its-defrule "o" "(I5(B") (its-defrule "ka" "(I6(B") (its-defrule "ki" "(I7(B") (its-defrule "ku" "(I8(B") (its-defrule "ke" "(I9(B") (its-defrule "ko" "(I:(B") (its-defrule "kya" "(I7,(B") (its-defrule "kyu" "(I7-(B") (its-defrule "kye" "(I7*(B") (its-defrule "kyo" "(I7.(B") (its-defrule "sa" "(I;(B") (its-defrule "si" "(I<(B") (its-defrule "su" "(I=(B") (its-defrule "se" "(I>(B") (its-defrule "so" "(I?(B") (its-defrule "sya" "(I<,(B") (its-defrule "syu" "(I<-(B") (its-defrule "sye" "(I<*(B") (its-defrule "syo" "(I<.(B") (its-defrule "sha" "(I<,(B") (its-defrule "shi" "(I<(B") (its-defrule "shu" "(I<-(B") (its-defrule "she" "(I<*(B") (its-defrule "sho" "(I<.(B") (its-defrule "ta" "(I@(B") (its-defrule "ti" "(IA(B") (its-defrule "tu" "(IB(B") (its-defrule "te" "(IC(B") (its-defrule "to" "(ID(B") (its-defrule "tya" "(IA,(B") (its-defrule "tyi" "(IC((B") (its-defrule "tyu" "(IA-(B") (its-defrule "tye" "(IA*(B") (its-defrule "tyo" "(IA.(B") (its-defrule "tsu" "(IB(B") (its-defrule "cha" "(IA,(B") (its-defrule "chi" "(IA(B") (its-defrule "chu" "(IA-(B") (its-defrule "che" "(IA*(B") (its-defrule "cho" "(IA.(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 "ha" "(IJ(B") (its-defrule "hi" "(IK(B") (its-defrule "hu" "(IL(B") (its-defrule "he" "(IM(B") (its-defrule "ho" "(IN(B") (its-defrule "hya" "(IK,(B") (its-defrule "hyu" "(IK-(B") (its-defrule "hye" "(IK*(B") (its-defrule "hyo" "(IK.(B") (its-defrule "fa" "(IL'(B") (its-defrule "fi" "(IL((B") (its-defrule "fu" "(IL(B") (its-defrule "fe" "(IL*(B") (its-defrule "fo" "(IL+(B") (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 "ye" "(I2*(B") (its-defrule "yo" "(IV(B") (its-defrule "ra" "(IW(B") (its-defrule "ri" "(IX(B") (its-defrule "ru" "(IY(B") (its-defrule "re" "(IZ(B") (its-defrule "ro" "(I[(B") (its-defrule "la" "(IW(B") (its-defrule "li" "(IX(B") (its-defrule "lu" "(IY(B") (its-defrule "le" "(IZ(B") (its-defrule "lo" "(I[(B") (its-defrule "rya" "(IX,(B") (its-defrule "ryu" "(IX-(B") (its-defrule "rye" "(IX*(B") (its-defrule "ryo" "(IX.(B") (its-defrule "lya" "(IX,(B") (its-defrule "lyu" "(IX-(B") (its-defrule "lye" "(IX*(B") (its-defrule "lyo" "(IX.(B") (its-defrule "wa" "(I\(B") (its-defrule "wu" "(I3(B") (its-defrule "wo" "(I&(B") (its-defrule "ga" "(I6^(B") (its-defrule "gi" "(I7^(B") (its-defrule "gu" "(I8^(B") (its-defrule "ge" "(I9^(B") (its-defrule "go" "(I:^(B") (its-defrule "gya" "(I7^,(B") (its-defrule "gyu" "(I7^-(B") (its-defrule "gye" "(I7^*(B") (its-defrule "gyo" "(I7^.(B") (its-defrule "za" "(I;^(B") (its-defrule "zi" "(I<^(B") (its-defrule "zu" "(I=^(B") (its-defrule "ze" "(I>^(B") (its-defrule "zo" "(I?^(B") (its-defrule "zya" "(I<^,(B") (its-defrule "zyu" "(I<^-(B") (its-defrule "zye" "(I<^*(B") (its-defrule "zyo" "(I<^.(B") (its-defrule "ja" "(I<^,(B") (its-defrule "ji" "(I<^(B") (its-defrule "ju" "(I<^-(B") (its-defrule "je" "(I<^*(B") (its-defrule "jo" "(I<^.(B") (its-defrule "da" "(I@^(B") (its-defrule "di" "(IA^(B") (its-defrule "du" "(IB^(B") (its-defrule "de" "(IC^(B") (its-defrule "do" "(ID^(B") (its-defrule "dya" "(IA^,(B") (its-defrule "dyi" "(IA^((B") (its-defrule "dyu" "(IA^-(B") (its-defrule "dye" "(IA^*(B") (its-defrule "dyo" "(IA^.(B") (its-defrule "ba" "(IJ^(B") (its-defrule "bi" "(IK^(B") (its-defrule "bu" "(IL^(B") (its-defrule "be" "(IM^(B") (its-defrule "bo" "(IN^(B") (its-defrule "va" "(I3^'(B") (its-defrule "vi" "(I3^((B") (its-defrule "vu" "(I3^(B") (its-defrule "ve" "(I3^*(B") (its-defrule "vo" "(I3^+(B") (its-defrule "bya" "(IK^,(B") (its-defrule "byu" "(IK^-(B") (its-defrule "bye" "(IK^*(B") (its-defrule "byo" "(IK^.(B") (its-defrule "pa" "(IJ_(B") (its-defrule "pi" "(IK_(B") (its-defrule "pu" "(IL_(B") (its-defrule "pe" "(IM_(B") (its-defrule "po" "(IN_(B") (its-defrule "pya" "(IK_,(B") (its-defrule "pyu" "(IK_-(B") (its-defrule "pye" "(IK_*(B") (its-defrule "pyo" "(IK_.(B") (its-defrule "kwi" "(I8((B") (its-defrule "kwu" "(I8(B") (its-defrule "kwe" "(I8*(B") (its-defrule "kwo" "(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 "xka" "(I6(B") (its-defrule "xke" "(I9(B") (its-defrule "xti" "(IC((B") (its-defrule "xdi" "(IA^((B") (its-defrule "xdu" "(ID^)(B") (its-defrule "xde" "(IA^*(B") (its-defrule "xdo" "(ID^+(B") (its-defrule "xwi" "(I3((B") (its-defrule "xwe" "(I3*(B") (its-defrule "xwo" "(I3+(B") (its-defrule "-" "(I0(B") (its-defrule "[" "(I"(B") (its-defrule "]" "(I#(B") (its-defrule "z/" "(I%(B") (defvar use-kuten-for-period t "*(IK_X5D^$B$r6gE@$KJQ49$9$k(B") (defvar use-touten-for-comma t "*(I:]O$B$rFIE@$KJQ49$9$k(B") (its-defrule-conditional "." (use-kuten-for-period "(I!(B") (t ".")) (its-defrule-conditional "," (use-touten-for-comma "(I$(B") (t ",")) (its-defrule (concat zenkaku-escape ",") "$B!$(B") (its-defrule (concat zenkaku-escape ".") "$B!%(B") (defun its:select-hankaku-katakana () (interactive) (its:select-mode "roma-han-kata")) (define-key mule-keymap "x" 'its:select-hankaku-katakana) (define-key fence-mode-map "\e\C-x" 'its:select-hankaku-katakana) ;;; ;;; JISX 0201 fence mode ;;; (defun fence-hankaku-katakana () (interactive) (japanese-katakana-region egg:*region-start* egg:*region-end* t)) (defun fence-katakana () (interactive) (japanese-katakana-region egg:*region-start* egg:*region-end*)) (defun fence-hiragana () (interactive) (japanese-katakana-region egg:*region-start* egg:*region-end*) (japanese-hiragana-region egg:*region-start* egg:*region-end*)) (define-key fence-mode-map "\ex" 'fence-hankaku-katakana) wnn7egg-1.02.orig/elisp/emacs20/its-v309/hankaku.el0100644000764400003210000000477707474174160021774 0ustar ishikawaishikawa;; Basic Roma-to-Kana Translation Table for Egg ;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) ;; This file is part of Egg on Nemacs (Japanese Environment) ;; Egg is distributed in the forms of patches to GNU ;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC ;; LICENSE which is distributed along with GNU Emacs by the ;; Free Software Foundation. ;; Egg is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. See the GNU EMACS GENERAL PUBLIC LICENSE for ;; more details. ;; You should have received a copy of the GNU EMACS GENERAL ;; PUBLIC LICENSE along with Nemacs; see the file COPYING. ;; If not, write to the Free Software Foundation, 675 Mass ;; Ave, Cambridge, MA 02139, USA. ;; 92.3.16 modified for Mule Ver.0.9.1 by K.Handa ;; 92.3.23 modified for Mule Ver.0.9.1 by K.Handa ;; defrule -> its-defrule, define-its-mode -> its-define-mode (defvar digit-characters '( "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" )) (defvar symbol-characters '( " " "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" "-" "=" "`" "\\" "|" "_" "+" "~" "[" "]" "{" "}" ":" ";" "\"" "'" "<" ">" "?" "/" "," "." )) (defvar downcase-alphabets '("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")) (defvar upcase-alphabets '("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")) ;;;; ;;;; ;;;; ;; 92.3.16 by K.Handa ;;(define-its-mode "downcase" " a a" t) (its-define-mode "downcase" "aa" t) (dolist (digit digit-characters) (its-defrule digit digit)) (dolist (symbol symbol-characters) (its-defrule symbol symbol)) (dolist (downcase downcase-alphabets) (its-defrule downcase downcase)) (dolist (upcase upcase-alphabets) (its-defrule upcase upcase)) ;;;; ;;;; ;;;; (defun upcase-character (ch) (if (and (<= ?a ch) (<= ch ?z)) (+ ?A (- ch ?a)) ch)) ;; 92.3.16 by K.Handa ;;(define-its-mode "upcase" " a A" t) (its-define-mode "upcase" "aA" t);;; 93.7.21 by S.Tomura (dolist (digit digit-characters) (its-defrule digit digit)) (dolist (symbol symbol-characters) (its-defrule symbol symbol)) (dolist (downcase downcase-alphabets) (its-defrule downcase (char-to-string (upcase-character (string-to-char downcase))))) (dolist (upcase upcase-alphabets) (its-defrule upcase upcase)) wnn7egg-1.02.orig/elisp/emacs20/its-v309/hira.el0100644000764400003210000004762207474174160021271 0ustar ishikawaishikawa;; Basic Roma-to-Kana Translation Table for Egg ;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) ;; This file is part of Egg on Nemacs (Japanese Environment) ;; Egg is distributed in the forms of patches to GNU ;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC ;; LICENSE which is distributed along with GNU Emacs by the ;; Free Software Foundation. ;; Egg is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. See the GNU EMACS GENERAL PUBLIC LICENSE for ;; more details. ;; You should have received a copy of the GNU EMACS GENERAL ;; PUBLIC LICENSE along with Nemacs; see the file COPYING. ;; If not, write to the Free Software Foundation, 675 Mass ;; Ave, Cambridge, MA 02139, USA. ;; 90.3.2 modified for Nemacs Ver.3.3.1 ;; by jiro@math.keio.ac.jp (TANAKA Jiro) ;; proposal of keybinding for JIS symbols ;; 92.3.23 modified for Mule Ver.0.9.1 by K.Handa ;; defrule -> its-defrule, define-its-mode -> its-define-mode ;; 92.7.6 modified for Mule Ver.0.9.5 by K.Handa ;; New rules added. (its-define-mode "roma-kana" "$B$"(B" t) (its-defrule-select-mode-temporally "q" "downcase") (its-defrule-select-mode-temporally "Q" "zenkaku-downcase") ;;; $B!V$C!W$NF~NO(B (dolist (aa '("k" "s" "t" "h" "y" "r" "w" "g" "z" "d" "b" "p" "c" "f" "j" "v")) (its-defrule (concat aa aa) "$B$C(B" aa)) (its-defrule "tch" "$B$C(B" "ch") ;;; $B!V$s!W$NF~NO(B (dolist (q1 '("b" "m" "p")) (its-defrule (concat "m" q1) "$B$s(B" q1)) (its-defrule "N" "$B$s(B") (its-defrule "n'" "$B$s(B") (defvar enable-double-n-syntax nil "*\"nn\"$B$r(B\"$B$s(B\"$B$KJQ49$9$k(B") (its-defrule "n" "$B$s(B") (its-defrule-conditional* "nn" "$B$s(B" nil (enable-double-n-syntax "$B$s(B") (t nil)) ;; 92.7.6 by Y.Kawabe ;;(dolist (aa '("k" "s" "t" "c" "h" "f" "m" "y" "r" "l" ;; "w" "g" "z" "j" "d" "b" "v" "p" "x")) ;; (its-defrule (concat "n" aa) "$B$s(B" aa)) ;; end of patch (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") (its-defrule "ka" "$B$+(B") (its-defrule "ki" "$B$-(B") (its-defrule "ku" "$B$/(B") (its-defrule "ke" "$B$1(B") (its-defrule "ko" "$B$3(B") (its-defrule "kya" "$B$-$c(B") (its-defrule "kyu" "$B$-$e(B") (its-defrule "kye" "$B$-$'(B") (its-defrule "kyo" "$B$-$g(B") (its-defrule "sa" "$B$5(B") (its-defrule "si" "$B$7(B") (its-defrule "su" "$B$9(B") (its-defrule "se" "$B$;(B") (its-defrule "so" "$B$=(B") (its-defrule "sya" "$B$7$c(B") (its-defrule "syu" "$B$7$e(B") (its-defrule "sye" "$B$7$'(B") (its-defrule "syo" "$B$7$g(B") (its-defrule "sha" "$B$7$c(B") (its-defrule "shi" "$B$7(B") (its-defrule "shu" "$B$7$e(B") (its-defrule "she" "$B$7$'(B") (its-defrule "sho" "$B$7$g(B") (its-defrule "ta" "$B$?(B") (its-defrule "ti" "$B$A(B") (its-defrule "tu" "$B$D(B") (its-defrule "te" "$B$F(B") (its-defrule "to" "$B$H(B") (its-defrule "tya" "$B$A$c(B") (its-defrule "tyi" "$B$F$#(B") (its-defrule "tyu" "$B$A$e(B") (its-defrule "tye" "$B$A$'(B") (its-defrule "tyo" "$B$A$g(B") (its-defrule "tsu" "$B$D(B") (its-defrule "cha" "$B$A$c(B") (its-defrule "chi" "$B$A(B") (its-defrule "chu" "$B$A$e(B") (its-defrule "che" "$B$A$'(B") (its-defrule "cho" "$B$A$g(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 "ha" "$B$O(B") (its-defrule "hi" "$B$R(B") (its-defrule "hu" "$B$U(B") (its-defrule "he" "$B$X(B") (its-defrule "ho" "$B$[(B") (its-defrule "hya" "$B$R$c(B") (its-defrule "hyu" "$B$R$e(B") (its-defrule "hye" "$B$R$'(B") (its-defrule "hyo" "$B$R$g(B") (its-defrule "fa" "$B$U$!(B") (its-defrule "fi" "$B$U$#(B") (its-defrule "fu" "$B$U(B") (its-defrule "fe" "$B$U$'(B") (its-defrule "fo" "$B$U$)(B") (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 "ye" "$B$$$'(B") (its-defrule "yo" "$B$h(B") (its-defrule "ra" "$B$i(B") (its-defrule "ri" "$B$j(B") (its-defrule "ru" "$B$k(B") (its-defrule "re" "$B$l(B") (its-defrule "ro" "$B$m(B") (its-defrule "la" "$B$i(B") (its-defrule "li" "$B$j(B") (its-defrule "lu" "$B$k(B") (its-defrule "le" "$B$l(B") (its-defrule "lo" "$B$m(B") (its-defrule "rya" "$B$j$c(B") (its-defrule "ryu" "$B$j$e(B") (its-defrule "rye" "$B$j$'(B") (its-defrule "ryo" "$B$j$g(B") (its-defrule "lya" "$B$j$c(B") (its-defrule "lyu" "$B$j$e(B") (its-defrule "lye" "$B$j$'(B") (its-defrule "lyo" "$B$j$g(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 "ga" "$B$,(B") (its-defrule "gi" "$B$.(B") (its-defrule "gu" "$B$0(B") (its-defrule "ge" "$B$2(B") (its-defrule "go" "$B$4(B") (its-defrule "gya" "$B$.$c(B") (its-defrule "gyu" "$B$.$e(B") (its-defrule "gye" "$B$.$'(B") (its-defrule "gyo" "$B$.$g(B") (its-defrule "za" "$B$6(B") (its-defrule "zi" "$B$8(B") (its-defrule "zu" "$B$:(B") (its-defrule "ze" "$B$<(B") (its-defrule "zo" "$B$>(B") (its-defrule "zya" "$B$8$c(B") (its-defrule "zyu" "$B$8$e(B") (its-defrule "zye" "$B$8$'(B") (its-defrule "zyo" "$B$8$g(B") (its-defrule "ja" "$B$8$c(B") (its-defrule "ji" "$B$8(B") (its-defrule "ju" "$B$8$e(B") (its-defrule "je" "$B$8$'(B") (its-defrule "jo" "$B$8$g(B") ;; 92.7.6 by Y.Kawabe (its-defrule "jya" "$B$8$c(B") (its-defrule "jyu" "$B$8$e(B") (its-defrule "jye" "$B$8$'(B") (its-defrule "jyo" "$B$8$g(B") ;; end of patch (its-defrule "da" "$B$@(B") (its-defrule "di" "$B$B(B") (its-defrule "du" "$B$E(B") (its-defrule "de" "$B$G(B") (its-defrule "do" "$B$I(B") (its-defrule "dya" "$B$B$c(B") (its-defrule "dyi" "$B$G$#(B") (its-defrule "dyu" "$B$B$e(B") (its-defrule "dye" "$B$B$'(B") (its-defrule "dyo" "$B$B$g(B") (its-defrule "ba" "$B$P(B") (its-defrule "bi" "$B$S(B") (its-defrule "bu" "$B$V(B") (its-defrule "be" "$B$Y(B") (its-defrule "bo" "$B$\(B") (its-defrule "va" "$B%t$!(B") (its-defrule "vi" "$B%t$#(B") (its-defrule "vu" "$B%t(B") (its-defrule "ve" "$B%t$'(B") (its-defrule "vo" "$B%t$)(B") (its-defrule "bya" "$B$S$c(B") (its-defrule "byu" "$B$S$e(B") (its-defrule "bye" "$B$S$'(B") (its-defrule "byo" "$B$S$g(B") (its-defrule "pa" "$B$Q(B") (its-defrule "pi" "$B$T(B") (its-defrule "pu" "$B$W(B") (its-defrule "pe" "$B$Z(B") (its-defrule "po" "$B$](B") (its-defrule "pya" "$B$T$c(B") (its-defrule "pyu" "$B$T$e(B") (its-defrule "pye" "$B$T$'(B") (its-defrule "pyo" "$B$T$g(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 "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 Symbols (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!*(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!<(B") ;;; JIS 213c ;;;(its-defrule "-" "$B!](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!1(B") (its-defrule "[" "$B!V(B") ;;(its-defrule "[" "$B!N(B") (its-defrule "]" "$B!W(B") ;;(its-defrule "]" "$B!O(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") (defvar use-kuten-for-period t "*$B%T%j%*%I$r6gE@$KJQ49$9$k(B") (defvar use-touten-for-comma t "*$B%3%s%^$rFIE@$KJQ49$9$k(B") (its-defrule-conditional "." (use-kuten-for-period "$B!#(B") (t "$B!%(B")) (its-defrule-conditional "," (use-touten-for-comma "$B!"(B") (t "$B!$(B")) ;;; Escape character to Zenkaku inputs (defvar zenkaku-escape "Z") ;;; Escape character to Hankaku inputs (defvar hankaku-escape "~") ;;; ;;; Zenkaku inputs ;;; (its-defrule (concat zenkaku-escape "0") "$B#0(B") (its-defrule (concat zenkaku-escape "1") "$B#1(B") (its-defrule (concat zenkaku-escape "2") "$B#2(B") (its-defrule (concat zenkaku-escape "3") "$B#3(B") (its-defrule (concat zenkaku-escape "4") "$B#4(B") (its-defrule (concat zenkaku-escape "5") "$B#5(B") (its-defrule (concat zenkaku-escape "6") "$B#6(B") (its-defrule (concat zenkaku-escape "7") "$B#7(B") (its-defrule (concat zenkaku-escape "8") "$B#8(B") (its-defrule (concat zenkaku-escape "9") "$B#9(B") (its-defrule (concat zenkaku-escape "A") "$B#A(B") (its-defrule (concat zenkaku-escape "B") "$B#B(B") (its-defrule (concat zenkaku-escape "C") "$B#C(B") (its-defrule (concat zenkaku-escape "D") "$B#D(B") (its-defrule (concat zenkaku-escape "E") "$B#E(B") (its-defrule (concat zenkaku-escape "F") "$B#F(B") (its-defrule (concat zenkaku-escape "G") "$B#G(B") (its-defrule (concat zenkaku-escape "H") "$B#H(B") (its-defrule (concat zenkaku-escape "I") "$B#I(B") (its-defrule (concat zenkaku-escape "J") "$B#J(B") (its-defrule (concat zenkaku-escape "K") "$B#K(B") (its-defrule (concat zenkaku-escape "L") "$B#L(B") (its-defrule (concat zenkaku-escape "M") "$B#M(B") (its-defrule (concat zenkaku-escape "N") "$B#N(B") (its-defrule (concat zenkaku-escape "O") "$B#O(B") (its-defrule (concat zenkaku-escape "P") "$B#P(B") (its-defrule (concat zenkaku-escape "Q") "$B#Q(B") (its-defrule (concat zenkaku-escape "R") "$B#R(B") (its-defrule (concat zenkaku-escape "S") "$B#S(B") (its-defrule (concat zenkaku-escape "T") "$B#T(B") (its-defrule (concat zenkaku-escape "U") "$B#U(B") (its-defrule (concat zenkaku-escape "V") "$B#V(B") (its-defrule (concat zenkaku-escape "W") "$B#W(B") (its-defrule (concat zenkaku-escape "X") "$B#X(B") (its-defrule (concat zenkaku-escape "Y") "$B#Y(B") (its-defrule (concat zenkaku-escape "Z") "$B#Z(B") (its-defrule (concat zenkaku-escape "a") "$B#a(B") (its-defrule (concat zenkaku-escape "b") "$B#b(B") (its-defrule (concat zenkaku-escape "c") "$B#c(B") (its-defrule (concat zenkaku-escape "d") "$B#d(B") (its-defrule (concat zenkaku-escape "e") "$B#e(B") (its-defrule (concat zenkaku-escape "f") "$B#f(B") (its-defrule (concat zenkaku-escape "g") "$B#g(B") (its-defrule (concat zenkaku-escape "h") "$B#h(B") (its-defrule (concat zenkaku-escape "i") "$B#i(B") (its-defrule (concat zenkaku-escape "j") "$B#j(B") (its-defrule (concat zenkaku-escape "k") "$B#k(B") (its-defrule (concat zenkaku-escape "l") "$B#l(B") (its-defrule (concat zenkaku-escape "m") "$B#m(B") (its-defrule (concat zenkaku-escape "n") "$B#n(B") (its-defrule (concat zenkaku-escape "o") "$B#o(B") (its-defrule (concat zenkaku-escape "p") "$B#p(B") (its-defrule (concat zenkaku-escape "q") "$B#q(B") (its-defrule (concat zenkaku-escape "r") "$B#r(B") (its-defrule (concat zenkaku-escape "s") "$B#s(B") (its-defrule (concat zenkaku-escape "t") "$B#t(B") (its-defrule (concat zenkaku-escape "u") "$B#u(B") (its-defrule (concat zenkaku-escape "v") "$B#v(B") (its-defrule (concat zenkaku-escape "w") "$B#w(B") (its-defrule (concat zenkaku-escape "x") "$B#x(B") (its-defrule (concat zenkaku-escape "y") "$B#y(B") (its-defrule (concat zenkaku-escape "z") "$B#z(B") (its-defrule (concat zenkaku-escape " ") "$B!!(B") (its-defrule (concat zenkaku-escape "!") "$B!*(B") (its-defrule (concat zenkaku-escape "@") "$B!w(B") (its-defrule (concat zenkaku-escape "#") "$B!t(B") (its-defrule (concat zenkaku-escape "$") "$B!p(B") (its-defrule (concat zenkaku-escape "%") "$B!s(B") (its-defrule (concat zenkaku-escape "^") "$B!0(B") (its-defrule (concat zenkaku-escape "&") "$B!u(B") (its-defrule (concat zenkaku-escape "*") "$B!v(B") (its-defrule (concat zenkaku-escape "(") "$B!J(B") (its-defrule (concat zenkaku-escape ")") "$B!K(B") (its-defrule (concat zenkaku-escape "-") "$B!](B") (its-defrule (concat zenkaku-escape "=") "$B!a(B") (its-defrule (concat zenkaku-escape "`") "$B!.(B") (its-defrule (concat zenkaku-escape "\\") "$B!o(B") (its-defrule (concat zenkaku-escape "|") "$B!C(B") (its-defrule (concat zenkaku-escape "_") "$B!2(B") (its-defrule (concat zenkaku-escape "+") "$B!\(B") (its-defrule (concat zenkaku-escape "~") "$B!1(B") (its-defrule (concat zenkaku-escape "[") "$B!N(B") (its-defrule (concat zenkaku-escape "]") "$B!O(B") (its-defrule (concat zenkaku-escape "{") "$B!P(B") (its-defrule (concat zenkaku-escape "}") "$B!Q(B") (its-defrule (concat zenkaku-escape ":") "$B!'(B") (its-defrule (concat zenkaku-escape ";") "$B!((B") (its-defrule (concat zenkaku-escape "\"") "$B!I(B") (its-defrule (concat zenkaku-escape "'") "$B!G(B") (its-defrule (concat zenkaku-escape "<") "$B!c(B") (its-defrule (concat zenkaku-escape ">") "$B!d(B") (its-defrule (concat zenkaku-escape "?") "$B!)(B") (its-defrule (concat zenkaku-escape "/") "$B!?(B") (its-defrule (concat zenkaku-escape ",") "$B!$(B") (its-defrule (concat zenkaku-escape ".") "$B!%(B") ;;; ;;; Hankaku inputs ;;; ;;(defvar escd '("-" "," "." "/" ";" ":" "[" "\\" "]" "^" "~")) ;;(its-defrule '("x" escd) '(escd)) (defvar digit-characters '( "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" )) (defvar symbol-characters '( " " "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" "-" "=" "`" "\\" "|" "_" "+" "~" "[" "]" "{" "}" ":" ";" "\"" "'" "<" ">" "?" "/" "," "." )) (defvar downcase-alphabets '("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")) (defvar upcase-alphabets '("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")) (dolist (digit digit-characters) (its-defrule (concat hankaku-escape digit) digit)) (dolist (symbol symbol-characters) (its-defrule (concat hankaku-escape symbol) symbol)) (dolist (downcase downcase-alphabets) (its-defrule (concat hankaku-escape downcase) downcase)) (dolist (upcase upcase-alphabets) (its-defrule (concat hankaku-escape upcase) upcase)) ;;; proposal key bindings for JIS symbols ;;; 90.3.2 by jiro@math.keio.ac.jp (TANAKA Jiro) (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") ; z- (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") ; zr (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") ; zp (its-defrule "z[" "$B!X(B") (its-defrule "z{" "$B!L(B") ; z[ (its-defrule "z]" "$B!Y(B") (its-defrule "z}" "$B!M(B") ; z] ; 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") ; zc (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") ; z. (its-defrule "z/" "$B!&(B") (its-defrule "z?" "$B!g(B") ; z/ ;;; Commented out by K.Handa. Already defined in a different way. ;(its-defrule "va" "$B%t%!(B") ;(its-defrule "vi" "$B%t%#(B") ;(its-defrule "vu" "$B%t(B") ;(its-defrule "ve" "$B%t%'(B") ;(its-defrule "vo" "$B%t%)(B") wnn7egg-1.02.orig/elisp/emacs20/its-v309/kanainput.el0100644000764400003210000002700107474174160022325 0ustar ishikawaishikawa;; Basic translation table to input KANA with ASCII keyboard ;; Created by DEMIZU Norotishi on 1994.1.26 ;; $Id: kanainput.el,v 1.1 2001/03/03 05:20:21 fukita Exp $ ;; ;; $BG[I[>r7o$O(B GNU GENERAL PUBLIC LICENSE $B$K=>$$$^$9!#(B ;; ;; $B$3$l$O(B ASCII $BG[Ns$N%-!<%\!<%I$G$+$JF~NO$G2>L>4A;zJQ49$r$9$k$?$a$N(B ;; $BJQ49%k!<%k$r5-$7$?(B lisp $B$G$9!#;H$$J}$O3QJ8;z!"(BJIS $B5-9fF~NO$NItJ,$O(B its/hira.el $B$HF1$8$K$7$^$7$?!#(B ;; $BF~NO$N$?$a$N(B prefix $B$O0J2<$NDL$j!#(B ;; Q: $BA43QF~NO(B (Quote $B$H3P$($k(B) ; k-zenkaku-escape $B$GDj5A2DG=(B ;; A: $BH>3QF~NO(B (Ascii $B$H3P$($k(B) ; k-hankaku-escape $B$GDj5A2DG=(B ;; S: $B5-9fF~NO(B (Symbol $B$H3P$($k(B) ; k-symbols-escape $B$GDj5A2DG=(B ;; ;;$B!V$+$JF~NO;~$NG[Ns!W(B ;; $B$L!*(B $B$U!w(B $B$"$!(B $B$&$%(B $B$($'(B $B$*$)(B $B$d$c(B $B$f$e(B $B$h$g(B $B$o$r(B $B$[$m(B $B$X!\(B $B! 90.3.2) ;; $B!{!|(B $B"&"'(B $B"$"%(B $B"""#(B $B!~"!(B $B!y!z(B $B!}!r(B $B!q!_(B $B!i!Z(B $B!j![(B $B!A!h(B $B!b!^(B $B!-!/(B ;; $B!T!R(B $B!U!S(B ____ $B!9!8(B $B!:!x(B $B!o(B__ ____ ____ ____ $B")",(B $B!X!L(B $B!Y!M(B ;; ____$B!3!4(B $B!5!6(B $B!7"*(B $B!>!=(B $B"+(B__ $B"-!2(B $B",!1(B $B"*(B__ $B!+!,(B $B!F!H(B $B!@!B(B ;; ____ :-:-)$B!;!n(B $B"(!`(B $B!k"+(B $B!l"-(B $B!m".(B $B!E!e(B $B!D!f(B $B!&!g(B ;; ;;$B!VA[Dj$7$F$$$k(B ASCII $B%-!<%\!<%I$NG[Ns!W(B($BH>3Q!"A43QF~NO;~$b(B) ;; 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ `~ ;; qQ wW eE rR tT yY uU iI oO pP [{ ]} ;; aA sS dD fF gG hH jJ kK lL ;: '" \| ;; zZ xX cC vV bB nN mM ,< .> /? ;; ;; kanainput.el 1.1 -> 1.2: ;; o $B5-9fF~NO(B prefix $B$r(B "X" $B$+$i(B "S" $B$K$7$?!#(B ;; o $B0J2<$NF~NOJ}K!$r4JC1$K$9$k$?$aJQ99$7$?!#(B ;; $B!V$p!W(B "W4E" --> "WE" ;; $B!V$q!W(B "W4%" --> "W%" ;; $B!V%t!W(B "W4[" --> "W[" ;; o $B0J2<$NF~NO7k2L$rJQ99$7$?!#K\J*$N(B Quote $B$K$9$k$?$a!#(B ;; "Q\\" $B!V!o!W(B-->$B!V!@!W(B ;; "Q~" $B!V!1!W(B-->$B!V!A!W(B ;; o $B0J2<$N%k!<%k$rDI2C$7$?!#(B ;; "Sy" -->$B!V!o!W(B ;; "SJ" -->$B!V!2!W(B ;; "Sk" -->$B!V!1!W(B ;; o $B3F%k!<%k$K$D$$$F(B its-defrule $B$r=q$$$F$$$?$N$r!"(B ;; $B4JC1$N$?$aI=%Y!<%9$K$7$?!#(B ;; (its-define-mode "kanainput" "$B$+(B" t) (defvar k-zenkaku-escape "Q") ; $BA43QF~NO$N(B prefix (defvar k-hankaku-escape "A") ; $BH>3QF~NO$N(B prefix (defvar k-symbols-escape "S") ; $B5-9fF~NO$N(B prefix (defun its:make-terminal-state-kanainput (map input action state) (cond((its:standard-actionp action) (action-output action)) (t nil))) (let ((its:make-terminal-state 'its:make-terminal-state-kanainput)) ;; $B$+$JF~NOMQ(B (dolist (normal-pair '( ;; $B@62;(B ("3" "$B$"(B") ("e" "$B$$(B") ("4" "$B$&(B") ("5" "$B$((B") ("6" "$B$*(B") ("t" "$B$+(B") ("g" "$B$-(B") ("h" "$B$/(B") ("'" "$B$1(B") ("b" "$B$3(B") ("x" "$B$5(B") ("d" "$B$7(B") ("r" "$B$9(B") ("p" "$B$;(B") ("c" "$B$=(B") ("q" "$B$?(B") ("a" "$B$A(B") ("z" "$B$D(B") ("w" "$B$F(B") ("s" "$B$H(B") ("u" "$B$J(B") ("i" "$B$K(B") ("1" "$B$L(B") ("," "$B$M(B") ("k" "$B$N(B") ("f" "$B$O(B") ("v" "$B$R(B") ("2" "$B$U(B") ("=" "$B$X(B") ("-" "$B$[(B") ("j" "$B$^(B") ("n" "$B$_(B") ("\\" "$B$`(B") ("/" "$B$a(B") ("m" "$B$b(B") ("7" "$B$d(B") ("8" "$B$f(B") ("9" "$B$h(B") ("o" "$B$i(B") ("l" "$B$j(B") ("." "$B$k(B") (";" "$B$l(B") ("|" "$B$m(B") ("0" "$B$o(B") ("WE" "$B$p(B") ("W%" "$B$q(B") (")" "$B$r(B") ("y" "$B$s(B") ;; $BBy2;(B ("t[" "$B$,(B") ("g[" "$B$.(B") ("h[" "$B$0(B") ("'[" "$B$2(B") ("b[" "$B$4(B") ("x[" "$B$6(B") ("d[" "$B$8(B") ("r[" "$B$:(B") ("p[" "$B$<(B") ("c[" "$B$>(B") ("q[" "$B$@(B") ("a[" "$B$B(B") ("z[" "$B$E(B") ("w[" "$B$G(B") ("s[" "$B$I(B") ("f[" "$B$P(B") ("v[" "$B$S(B") ("2[" "$B$V(B") ("=[" "$B$Y(B") ("-[" "$B$\(B") ;; $BH>By2;(B ("f]" "$B$Q(B") ("v]" "$B$T(B") ("2]" "$B$W(B") ("=]" "$B$Z(B") ("-]" "$B$](B") ;; $B>.$5$J;z(B ("#" "$B$!(B") ("E" "$B$#(B") ("$" "$B$%(B") ("%" "$B$'(B") ("^" "$B$)(B") ("&" "$B$c(B") ("*" "$B$e(B") ("(" "$B$g(B") ("T" "$B%u(B") ("\"" "$B%v(B") ("Z" "$B$C(B") ("W0" "$B$n(B") ("W#" "$B$n(B") ;; $B$=$NB>(B ("W[" "$B%t(B") ("W" "$B$&(B") ;; $B5-9f(B ("<" "$B!"(B") (">" "$B!#(B") (":" "$B!&(B") ("?" "$B!)(B") ("{" "$B!V(B") ("}" "$B!W(B") ("[" "$B!+(B") ("]" "$B!,(B") ("`" "$B!<(B") ;; $B%7%U%H%-!<2!2<;~$N07$$(B ("G" "$B$-(B") ("H" "$B$/(B") ("B" "$B$3(B") ("X" "$B$5(B") ("D" "$B$7(B") ("R" "$B$9(B") ("P" "$B$;(B") ("C" "$B$=(B") ("U" "$B$J(B") ("I" "$B$K(B") ("K" "$B$N(B") ("F" "$B$O(B") ("V" "$B$R(B") ("J" "$B$^(B") ("N" "$B$_(B") ("M" "$B$b(B") ("O" "$B$i(B") ("L" "$B$j(B") ("Y" "$B$s(B") ("!" "$B!*(B") ("@" "$B!w(B") ("+" "$B!\(B") ("~" "$B!A(B") ("_" "$B$m(B");;; $B!V$m!W$,$"$k%-!<%\!<%IMQ(B )) (its-defrule (car normal-pair) (car (cdr normal-pair)))) ;; $BA43QF~NO(B (dolist (zenkaku-pair '( (" " "$B!!(B") ("!" "$B!*(B") ("\"" "$B!I(B") ("#" "$B!t(B") ; 20--24 ("$" "$B!p(B") ("%" "$B!s(B") ("&" "$B!u(B") ("'" "$B!G(B") ; 25--27 ("(" "$B!J(B") (")" "$B!K(B") ("*" "$B!v(B") ("+" "$B!\(B") ; 28--2b ("," "$B!$(B") ("-" "$B!](B") ("." "$B!%(B") ("/" "$B!?(B") ; 2c--2f ("0" "$B#0(B") ("1" "$B#1(B") ("2" "$B#2(B") ("3" "$B#3(B") ; 30--33 ("4" "$B#4(B") ("5" "$B#5(B") ("6" "$B#6(B") ("7" "$B#7(B") ; 34--37 ("8" "$B#8(B") ("9" "$B#9(B") (":" "$B!'(B") (";" "$B!((B") ; 38--3b ("<" "$B!c(B") ("=" "$B!a(B") (">" "$B!d(B") ("?" "$B!)(B") ; 3c--3f ("@" "$B!w(B") ("A" "$B#A(B") ("B" "$B#B(B") ("C" "$B#C(B") ; 40--43 ("D" "$B#D(B") ("E" "$B#E(B") ("F" "$B#F(B") ("G" "$B#G(B") ; 44--47 ("H" "$B#H(B") ("I" "$B#I(B") ("J" "$B#J(B") ("K" "$B#K(B") ; 48--4b ("L" "$B#L(B") ("M" "$B#M(B") ("N" "$B#N(B") ("O" "$B#O(B") ; 4c--4f ("P" "$B#P(B") ("Q" "$B#Q(B") ("R" "$B#R(B") ("S" "$B#S(B") ; 50--53 ("T" "$B#T(B") ("U" "$B#U(B") ("V" "$B#V(B") ("W" "$B#W(B") ; 54--57 ("X" "$B#X(B") ("Y" "$B#Y(B") ("Z" "$B#Z(B") ("[" "$B!N(B") ; 58--5a ("\\" "$B!@(B") ("]" "$B!O(B") ("^" "$B!0(B") ("_" "$B!2(B") ; 5b--5f ("`" "$B!.(B") ("a" "$B#a(B") ("b" "$B#b(B") ("c" "$B#c(B") ; 60--63 ("d" "$B#d(B") ("e" "$B#e(B") ("f" "$B#f(B") ("g" "$B#g(B") ; 64--67 ("h" "$B#h(B") ("i" "$B#i(B") ("j" "$B#j(B") ("k" "$B#k(B") ; 68--6b ("l" "$B#l(B") ("m" "$B#m(B") ("n" "$B#n(B") ("o" "$B#o(B") ; 6c--6f ("p" "$B#p(B") ("q" "$B#q(B") ("r" "$B#r(B") ("s" "$B#s(B") ; 70--73 ("t" "$B#t(B") ("u" "$B#u(B") ("v" "$B#v(B") ("w" "$B#w(B") ; 74--77 ("x" "$B#x(B") ("y" "$B#y(B") ("z" "$B#z(B") ("{" "$B!P(B") ; 78--7b ("|" "$B!C(B") ("}" "$B!Q(B") ("~" "$B!A(B") ; 7c--7e )) (its-defrule (concat k-zenkaku-escape (car zenkaku-pair)) (car (cdr zenkaku-pair)))) ;; $BH>3QF~NO(B (dolist (character '( "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" " " "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" "-" "=" "`" "\\" "|" "_" "+" "~" "[" "]" "{" "}" ":" ";" "\"" "'" "<" ">" "?" "/" "," "." "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" "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 k-hankaku-escape character) character)) ;;; proposal key bindings for JIS symbols ;;; 90.3.2 by jiro@math.keio.ac.jp (TANAKA Jiro) ;;; $B!V!o!W!"!V!1!W!"!V!2!W(B are added ;;; 94.2.4 by nori-d@is.aist-nara.ac.jp (DEMIZU Noritoshi) (dolist (symbols-pair '( ("1" "$B!{(B") ("2" "$B"&(B") ("3" "$B"$(B") ("4" "$B""(B") ("5" "$B!~(B") ("6" "$B!y(B") ("7" "$B!}(B") ("8" "$B!q(B") ("9" "$B!i(B") ("0" "$B!j(B") ("-" "$B!A(B") ("=" "$B!b(B") ("\\" "$B!@(B") ("`" "$B!-(B") ("!" "$B!|(B") ("@" "$B"'(B") ("#" "$B"%(B") ("$" "$B"#(B") ("%" "$B"!(B") ("^" "$B!z(B") ("&" "$B!r(B") ("*" "$B!_(B") ("(" "$B!Z(B") (")" "$B![(B") ("_" "$B!h(B") ("+" "$B!^(B") ("|" "$B!B(B") ("~" "$B!/(B") ("q" "$B!T(B") ("w" "$B!U(B") ("r" "$B!9(B") ("t" "$B!:(B") ("y" "$B!o(B") ("Q" "$B!R(B") ("W" "$B!S(B") ("R" "$B!8(B") ("T" "$B!x(B") ("p" "$B")(B") ("[" "$B!X(B") ("]" "$B!Y(B") ("P" "$B",(B") ("{" "$B!L(B") ("}" "$B!M(B") ("s" "$B!3(B") ("d" "$B!5(B") ("f" "$B!7(B") ("g" "$B!>(B") ("S" "$B!4(B") ("D" "$B!6(B") ("F" "$B"*(B") ("G" "$B!=(B") ("h" "$B"+(B") ("j" "$B"-(B") ("k" "$B",(B") ("l" "$B"*(B") ("J" "$B!2(B") ("K" "$B!1(B") (";" "$B!+(B") (":" "$B!,(B") ("\'" "$B!F(B") ("\"" "$B!H(B") ("x" ":-") ("c" "$B!;(B") ("v" "$B"((B") ("b" "$B!k(B") ("n" "$B!l(B") ("X" ":-)") ("C" "$B!n(B") ("V" "$B!`(B") ("B" "$B"+(B") ("N" "$B"-(B") ("m" "$B!m(B") ("," "$B!E(B") ("." "$B!D(B") ("/" "$B!&(B") ("M" "$B".(B") ("<" "$B!e(B") (">" "$B!f(B") ("?" "$B!g(B") )) (its-defrule (concat k-symbols-escape (car symbols-pair)) (car (cdr symbols-pair)))) ) wnn7egg-1.02.orig/elisp/emacs20/its-v309/kata.el0100644000764400003210000004676007474174160021270 0ustar ishikawaishikawa;; Basic Roma-to-KataKana Translation Table for Egg ;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) ;; This file is part of Egg on Nemacs (Japanese Environment) ;; Egg is distributed in the forms of patches to GNU ;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC ;; LICENSE which is distributed along with GNU Emacs by the ;; Free Software Foundation. ;; Egg is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. See the GNU EMACS GENERAL PUBLIC LICENSE for ;; more details. ;; You should have received a copy of the GNU EMACS GENERAL ;; PUBLIC LICENSE along with Nemacs; see the file COPYING. ;; If not, write to the Free Software Foundation, 675 Mass ;; Ave, Cambridge, MA 02139, USA. ;; 90.3.2 modified for Nemacs Ver.3.3.1 ;; by jiro@math.keio.ac.jp (TANAKA Jiro) ;; proposal of keybinding for JIS symbols ;; 92.3.16 modified for Mule Ver.0.9.1 by K.Handa ;; 92.3.23 modified for Mule Ver.0.9.1 by K.Handa ;; defrule -> its-defrule, define-its-mode -> its-define-mode ;; 92.3.16 by K.Handa ;;(define-its-mode "roma-kata" " a$B%"(B" t) (its-define-mode "roma-kata" "$B%"(B" t) (dolist (aa '("k" "s" "t" "h" "y" "r" "w" "g" "z" "d" "b" "p" "c" "f" "j" "v")) (its-defrule (concat aa aa) "$B%C(B" aa)) (its-defrule "tch" "$B%C(B" "ch") (dolist (q1 '("b" "m" "p")) (its-defrule (concat "m" q1) "$B%s(B" q1)) (its-defrule "N" "$B%s(B") (defvar enable-double-n-syntax nil "*Enable \"nn\" input for \"$B%s(B\" ") (its-defrule-conditional "n" ((not enable-double-n-syntax) "$B%s(B") (t nil)) (its-defrule-conditional "nn" ( enable-double-n-syntax "$B%s(B") (t nil)) (its-defrule "n'" "$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") (its-defrule "ka" "$B%+(B") (its-defrule "ki" "$B%-(B") (its-defrule "ku" "$B%/(B") (its-defrule "ke" "$B%1(B") (its-defrule "ko" "$B%3(B") (its-defrule "kya" "$B%-%c(B") (its-defrule "kyu" "$B%-%e(B") (its-defrule "kye" "$B%-%'(B") (its-defrule "kyo" "$B%-%g(B") (its-defrule "sa" "$B%5(B") (its-defrule "si" "$B%7(B") (its-defrule "su" "$B%9(B") (its-defrule "se" "$B%;(B") (its-defrule "so" "$B%=(B") (its-defrule "sya" "$B%7%c(B") (its-defrule "syu" "$B%7%e(B") (its-defrule "sye" "$B%7%'(B") (its-defrule "syo" "$B%7%g(B") (its-defrule "sha" "$B%7%c(B") (its-defrule "shi" "$B%7(B") (its-defrule "shu" "$B%7%e(B") (its-defrule "she" "$B%7%'(B") (its-defrule "sho" "$B%7%g(B") (its-defrule "ta" "$B%?(B") (its-defrule "ti" "$B%A(B") (its-defrule "tu" "$B%D(B") (its-defrule "te" "$B%F(B") (its-defrule "to" "$B%H(B") (its-defrule "tya" "$B%A%c(B") (its-defrule "tyi" "$B%F%#(B") (its-defrule "tyu" "$B%A%e(B") (its-defrule "tye" "$B%A%'(B") (its-defrule "tyo" "$B%A%g(B") (its-defrule "tsu" "$B%D(B") (its-defrule "cha" "$B%A%c(B") (its-defrule "chi" "$B%A(B") (its-defrule "chu" "$B%A%e(B") (its-defrule "che" "$B%A%'(B") (its-defrule "cho" "$B%A%g(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 "ha" "$B%O(B") (its-defrule "hi" "$B%R(B") (its-defrule "hu" "$B%U(B") (its-defrule "he" "$B%X(B") (its-defrule "ho" "$B%[(B") (its-defrule "hya" "$B%R%c(B") (its-defrule "hyu" "$B%R%e(B") (its-defrule "hye" "$B%R%'(B") (its-defrule "hyo" "$B%R%g(B") (its-defrule "fa" "$B%U%!(B") (its-defrule "fi" "$B%U%#(B") (its-defrule "fu" "$B%U(B") (its-defrule "fe" "$B%U%'(B") (its-defrule "fo" "$B%U%)(B") (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 "ye" "$B%$%'(B") (its-defrule "yo" "$B%h(B") (its-defrule "ra" "$B%i(B") (its-defrule "ri" "$B%j(B") (its-defrule "ru" "$B%k(B") (its-defrule "re" "$B%l(B") (its-defrule "ro" "$B%m(B") (its-defrule "la" "$B%i(B") (its-defrule "li" "$B%j(B") (its-defrule "lu" "$B%k(B") (its-defrule "le" "$B%l(B") (its-defrule "lo" "$B%m(B") (its-defrule "rya" "$B%j%c(B") (its-defrule "ryu" "$B%j%e(B") (its-defrule "rye" "$B%j%'(B") (its-defrule "ryo" "$B%j%g(B") (its-defrule "lya" "$B%j%c(B") (its-defrule "lyu" "$B%j%e(B") (its-defrule "lye" "$B%j%'(B") (its-defrule "lyo" "$B%j%g(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 "ga" "$B%,(B") (its-defrule "gi" "$B%.(B") (its-defrule "gu" "$B%0(B") (its-defrule "ge" "$B%2(B") (its-defrule "go" "$B%4(B") (its-defrule "gya" "$B%.%c(B") (its-defrule "gyu" "$B%.%e(B") (its-defrule "gye" "$B%.%'(B") (its-defrule "gyo" "$B%.%g(B") (its-defrule "za" "$B%6(B") (its-defrule "zi" "$B%8(B") (its-defrule "zu" "$B%:(B") (its-defrule "ze" "$B%<(B") (its-defrule "zo" "$B%>(B") (its-defrule "zya" "$B%8%c(B") (its-defrule "zyu" "$B%8%e(B") (its-defrule "zye" "$B%8%'(B") (its-defrule "zyo" "$B%8%g(B") (its-defrule "ja" "$B%8%c(B") (its-defrule "ji" "$B%8(B") (its-defrule "ju" "$B%8%e(B") (its-defrule "je" "$B%8%'(B") (its-defrule "jo" "$B%8%g(B") (its-defrule "da" "$B%@(B") (its-defrule "di" "$B%B(B") (its-defrule "du" "$B%E(B") (its-defrule "de" "$B%G(B") (its-defrule "do" "$B%I(B") (its-defrule "dya" "$B%B%c(B") (its-defrule "dyi" "$B%G%#(B") (its-defrule "dyu" "$B%B%e(B") (its-defrule "dye" "$B%B%'(B") (its-defrule "dyo" "$B%B%g(B") (its-defrule "ba" "$B%P(B") (its-defrule "bi" "$B%S(B") (its-defrule "bu" "$B%V(B") (its-defrule "be" "$B%Y(B") (its-defrule "bo" "$B%\(B") (its-defrule "va" "$B%t%!(B") (its-defrule "vi" "$B%t%#(B") (its-defrule "vu" "$B%t(B") (its-defrule "ve" "$B%t%'(B") (its-defrule "vo" "$B%t%)(B") (its-defrule "bya" "$B%S%c(B") (its-defrule "byu" "$B%S%e(B") (its-defrule "bye" "$B%S%'(B") (its-defrule "byo" "$B%S%g(B") (its-defrule "pa" "$B%Q(B") (its-defrule "pi" "$B%T(B") (its-defrule "pu" "$B%W(B") (its-defrule "pe" "$B%Z(B") (its-defrule "po" "$B%](B") (its-defrule "pya" "$B%T%c(B") (its-defrule "pyu" "$B%T%e(B") (its-defrule "pye" "$B%T%'(B") (its-defrule "pyo" "$B%T%g(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 "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 "xwa" "$B%n(B") (its-defrule "xwi" "$B%&%#(B") (its-defrule "xwe" "$B%&%'(B") (its-defrule "xwo" "$B%&%)(B") ;;; Zenkaku Symbols (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!*(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!<(B") ;;; JIS 213c ;;;(its-defrule "-" "$B!](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!1(B") (its-defrule "[" "$B!V(B") ;;(its-defrule "[" "$B!N(B") (its-defrule "]" "$B!W(B") ;;(its-defrule "]" "$B!O(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") (defvar use-kuten-for-period t "*$B%T%j%*%I$r6gE@$KJQ49$9$k(B") (defvar use-touten-for-comma t "*$B%3%s%^$rFIE@$KJQ49$9$k(B") (its-defrule-conditional "." (use-kuten-for-period "$B!#(B") (t "$B!%(B")) (its-defrule-conditional "," (use-touten-for-comma "$B!"(B") (t "$B!$(B")) ;;; Escape character to Zenkaku inputs (defvar zenkaku-escape "Z") ;;; Escape character to Hankaku inputs (defvar hankaku-escape "~") ;;; ;;; Zenkaku inputs ;;; (its-defrule (concat zenkaku-escape "0") "$B#0(B") (its-defrule (concat zenkaku-escape "1") "$B#1(B") (its-defrule (concat zenkaku-escape "2") "$B#2(B") (its-defrule (concat zenkaku-escape "3") "$B#3(B") (its-defrule (concat zenkaku-escape "4") "$B#4(B") (its-defrule (concat zenkaku-escape "5") "$B#5(B") (its-defrule (concat zenkaku-escape "6") "$B#6(B") (its-defrule (concat zenkaku-escape "7") "$B#7(B") (its-defrule (concat zenkaku-escape "8") "$B#8(B") (its-defrule (concat zenkaku-escape "9") "$B#9(B") (its-defrule (concat zenkaku-escape "A") "$B#A(B") (its-defrule (concat zenkaku-escape "B") "$B#B(B") (its-defrule (concat zenkaku-escape "C") "$B#C(B") (its-defrule (concat zenkaku-escape "D") "$B#D(B") (its-defrule (concat zenkaku-escape "E") "$B#E(B") (its-defrule (concat zenkaku-escape "F") "$B#F(B") (its-defrule (concat zenkaku-escape "G") "$B#G(B") (its-defrule (concat zenkaku-escape "H") "$B#H(B") (its-defrule (concat zenkaku-escape "I") "$B#I(B") (its-defrule (concat zenkaku-escape "J") "$B#J(B") (its-defrule (concat zenkaku-escape "K") "$B#K(B") (its-defrule (concat zenkaku-escape "L") "$B#L(B") (its-defrule (concat zenkaku-escape "M") "$B#M(B") (its-defrule (concat zenkaku-escape "N") "$B#N(B") (its-defrule (concat zenkaku-escape "O") "$B#O(B") (its-defrule (concat zenkaku-escape "P") "$B#P(B") (its-defrule (concat zenkaku-escape "Q") "$B#Q(B") (its-defrule (concat zenkaku-escape "R") "$B#R(B") (its-defrule (concat zenkaku-escape "S") "$B#S(B") (its-defrule (concat zenkaku-escape "T") "$B#T(B") (its-defrule (concat zenkaku-escape "U") "$B#U(B") (its-defrule (concat zenkaku-escape "V") "$B#V(B") (its-defrule (concat zenkaku-escape "W") "$B#W(B") (its-defrule (concat zenkaku-escape "X") "$B#X(B") (its-defrule (concat zenkaku-escape "Y") "$B#Y(B") (its-defrule (concat zenkaku-escape "Z") "$B#Z(B") (its-defrule (concat zenkaku-escape "a") "$B#a(B") (its-defrule (concat zenkaku-escape "b") "$B#b(B") (its-defrule (concat zenkaku-escape "c") "$B#c(B") (its-defrule (concat zenkaku-escape "d") "$B#d(B") (its-defrule (concat zenkaku-escape "e") "$B#e(B") (its-defrule (concat zenkaku-escape "f") "$B#f(B") (its-defrule (concat zenkaku-escape "g") "$B#g(B") (its-defrule (concat zenkaku-escape "h") "$B#h(B") (its-defrule (concat zenkaku-escape "i") "$B#i(B") (its-defrule (concat zenkaku-escape "j") "$B#j(B") (its-defrule (concat zenkaku-escape "k") "$B#k(B") (its-defrule (concat zenkaku-escape "l") "$B#l(B") (its-defrule (concat zenkaku-escape "m") "$B#m(B") (its-defrule (concat zenkaku-escape "n") "$B#n(B") (its-defrule (concat zenkaku-escape "o") "$B#o(B") (its-defrule (concat zenkaku-escape "p") "$B#p(B") (its-defrule (concat zenkaku-escape "q") "$B#q(B") (its-defrule (concat zenkaku-escape "r") "$B#r(B") (its-defrule (concat zenkaku-escape "s") "$B#s(B") (its-defrule (concat zenkaku-escape "t") "$B#t(B") (its-defrule (concat zenkaku-escape "u") "$B#u(B") (its-defrule (concat zenkaku-escape "v") "$B#v(B") (its-defrule (concat zenkaku-escape "w") "$B#w(B") (its-defrule (concat zenkaku-escape "x") "$B#x(B") (its-defrule (concat zenkaku-escape "y") "$B#y(B") (its-defrule (concat zenkaku-escape "z") "$B#z(B") (its-defrule (concat zenkaku-escape " ") "$B!!(B") (its-defrule (concat zenkaku-escape "!") "$B!*(B") (its-defrule (concat zenkaku-escape "@") "$B!w(B") (its-defrule (concat zenkaku-escape "#") "$B!t(B") (its-defrule (concat zenkaku-escape "$") "$B!p(B") (its-defrule (concat zenkaku-escape "%") "$B!s(B") (its-defrule (concat zenkaku-escape "^") "$B!0(B") (its-defrule (concat zenkaku-escape "&") "$B!u(B") (its-defrule (concat zenkaku-escape "*") "$B!v(B") (its-defrule (concat zenkaku-escape "(") "$B!J(B") (its-defrule (concat zenkaku-escape ")") "$B!K(B") (its-defrule (concat zenkaku-escape "-") "$B!](B") (its-defrule (concat zenkaku-escape "=") "$B!a(B") (its-defrule (concat zenkaku-escape "`") "$B!.(B") (its-defrule (concat zenkaku-escape "\\") "$B!o(B") (its-defrule (concat zenkaku-escape "|") "$B!C(B") (its-defrule (concat zenkaku-escape "_") "$B!2(B") (its-defrule (concat zenkaku-escape "+") "$B!\(B") (its-defrule (concat zenkaku-escape "~") "$B!1(B") (its-defrule (concat zenkaku-escape "[") "$B!N(B") (its-defrule (concat zenkaku-escape "]") "$B!O(B") (its-defrule (concat zenkaku-escape "{") "$B!P(B") (its-defrule (concat zenkaku-escape "}") "$B!Q(B") (its-defrule (concat zenkaku-escape ":") "$B!'(B") (its-defrule (concat zenkaku-escape ";") "$B!((B") (its-defrule (concat zenkaku-escape "\"") "$B!I(B") (its-defrule (concat zenkaku-escape "'") "$B!G(B") (its-defrule (concat zenkaku-escape "<") "$B!c(B") (its-defrule (concat zenkaku-escape ">") "$B!d(B") (its-defrule (concat zenkaku-escape "?") "$B!)(B") (its-defrule (concat zenkaku-escape "/") "$B!?(B") (its-defrule (concat zenkaku-escape ",") "$B!$(B") (its-defrule (concat zenkaku-escape ".") "$B!%(B") ;;; ;;; Hankaku inputs ;;; ;;(defvar escd '("-" "," "." "/" ";" ":" "[" "\\" "]" "^" "~")) ;;(its-defrule '("x" escd) '(escd)) (defvar digit-characters '( "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" )) (defvar symbol-characters '( " " "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" "-" "=" "`" "\\" "|" "_" "+" "~" "[" "]" "{" "}" ":" ";" "\"" "'" "<" ">" "?" "/" "," "." )) (defvar downcase-alphabets '("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")) (defvar upcase-alphabets '("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")) (dolist (digit digit-characters) (its-defrule (concat hankaku-escape digit) digit)) (dolist (symbol symbol-characters) (its-defrule (concat hankaku-escape symbol) symbol)) (dolist (downcase downcase-alphabets) (its-defrule (concat hankaku-escape downcase) downcase)) (dolist (upcase upcase-alphabets) (its-defrule (concat hankaku-escape upcase) upcase)) ;;; proposal key bindings for JIS symbols ;;; 90.3.2 by jiro@math.keio.ac.jp (TANAKA Jiro) (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") ; z- (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") ; zr (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") ; zp (its-defrule "z[" "$B!X(B") (its-defrule "z{" "$B!L(B") ; z[ (its-defrule "z]" "$B!Y(B") (its-defrule "z}" "$B!M(B") ; z] ; 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") ; zc (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") ; z. (its-defrule "z/" "$B!&(B") (its-defrule "z?" "$B!g(B") ; z/ ;;; Commented out by K.Handa. Already defined in a different way. ;(its-defrule "va" "$B%t%!(B") ;(its-defrule "vi" "$B%t%#(B") ;(its-defrule "vu" "$B%t(B") ;(its-defrule "ve" "$B%t%'(B") ;(its-defrule "vo" "$B%t%)(B") wnn7egg-1.02.orig/elisp/emacs20/its-v309/zenkaku.el0100644000764400003210000001547007474174160022012 0ustar ishikawaishikawa;; Basic Roma-to-Kana Translation Table for Egg ;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) ;; This file is part of Egg on Nemacs (Japanese Environment) ;; Egg is distributed in the forms of patches to GNU ;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC ;; LICENSE which is distributed along with GNU Emacs by the ;; Free Software Foundation. ;; Egg is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. See the GNU EMACS GENERAL PUBLIC LICENSE for ;; more details. ;; You should have received a copy of the GNU EMACS GENERAL ;; PUBLIC LICENSE along with Nemacs; see the file COPYING. ;; If not, write to the Free Software Foundation, 675 Mass ;; Ave, Cambridge, MA 02139, USA. ;; 92.3.16 modified for Mule Ver.0.9.1 by K.Handa ;; 92.3.23 modified for Mule Ver.0.9.1 by K.Handa ;; defrule -> its-defrule, define-its-mode -> its-define-mode ;;; 92.12.31 modified for Mule Ver.0.9.7.1 ;;; by A.Tanaka ;;; Mode indicator of "zenkaku-upcase" fixed. ;; 92.3.16 by K.Handa ;;(define-its-mode "zenkaku-downcase" " a$B#a(B" t) (its-define-mode "zenkaku-downcase" "$B#a(B" t) (its-defrule "0" "$B#0(B") (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 "A" "$B#A(B") (its-defrule "B" "$B#B(B") (its-defrule "C" "$B#C(B") (its-defrule "D" "$B#D(B") (its-defrule "E" "$B#E(B") (its-defrule "F" "$B#F(B") (its-defrule "G" "$B#G(B") (its-defrule "H" "$B#H(B") (its-defrule "I" "$B#I(B") (its-defrule "J" "$B#J(B") (its-defrule "K" "$B#K(B") (its-defrule "L" "$B#L(B") (its-defrule "M" "$B#M(B") (its-defrule "N" "$B#N(B") (its-defrule "O" "$B#O(B") (its-defrule "P" "$B#P(B") (its-defrule "Q" "$B#Q(B") (its-defrule "R" "$B#R(B") (its-defrule "S" "$B#S(B") (its-defrule "T" "$B#T(B") (its-defrule "U" "$B#U(B") (its-defrule "V" "$B#V(B") (its-defrule "W" "$B#W(B") (its-defrule "X" "$B#X(B") (its-defrule "Y" "$B#Y(B") (its-defrule "Z" "$B#Z(B") (its-defrule "a" "$B#a(B") (its-defrule "b" "$B#b(B") (its-defrule "c" "$B#c(B") (its-defrule "d" "$B#d(B") (its-defrule "e" "$B#e(B") (its-defrule "f" "$B#f(B") (its-defrule "g" "$B#g(B") (its-defrule "h" "$B#h(B") (its-defrule "i" "$B#i(B") (its-defrule "j" "$B#j(B") (its-defrule "k" "$B#k(B") (its-defrule "l" "$B#l(B") (its-defrule "m" "$B#m(B") (its-defrule "n" "$B#n(B") (its-defrule "o" "$B#o(B") (its-defrule "p" "$B#p(B") (its-defrule "q" "$B#q(B") (its-defrule "r" "$B#r(B") (its-defrule "s" "$B#s(B") (its-defrule "t" "$B#t(B") (its-defrule "u" "$B#u(B") (its-defrule "v" "$B#v(B") (its-defrule "w" "$B#w(B") (its-defrule "x" "$B#x(B") (its-defrule "y" "$B#y(B") (its-defrule "z" "$B#z(B") (its-defrule " " "$B!!(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!](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!1(B") (its-defrule "[" "$B!N(B") (its-defrule "]" "$B!O(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") (its-defrule "," "$B!$(B") (its-defrule "." "$B!%(B") ;;; ;;; ;;; (its-define-mode "zenkaku-upcase" "$B#A(B" t) ;92.12.31 by A.Tanaka (its-defrule "0" "$B#0(B") (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 "A" "$B#A(B") (its-defrule "B" "$B#B(B") (its-defrule "C" "$B#C(B") (its-defrule "D" "$B#D(B") (its-defrule "E" "$B#E(B") (its-defrule "F" "$B#F(B") (its-defrule "G" "$B#G(B") (its-defrule "H" "$B#H(B") (its-defrule "I" "$B#I(B") (its-defrule "J" "$B#J(B") (its-defrule "K" "$B#K(B") (its-defrule "L" "$B#L(B") (its-defrule "M" "$B#M(B") (its-defrule "N" "$B#N(B") (its-defrule "O" "$B#O(B") (its-defrule "P" "$B#P(B") (its-defrule "Q" "$B#Q(B") (its-defrule "R" "$B#R(B") (its-defrule "S" "$B#S(B") (its-defrule "T" "$B#T(B") (its-defrule "U" "$B#U(B") (its-defrule "V" "$B#V(B") (its-defrule "W" "$B#W(B") (its-defrule "X" "$B#X(B") (its-defrule "Y" "$B#Y(B") (its-defrule "Z" "$B#Z(B") (its-defrule "a" "$B#A(B") (its-defrule "b" "$B#B(B") (its-defrule "c" "$B#C(B") (its-defrule "d" "$B#D(B") (its-defrule "e" "$B#E(B") (its-defrule "f" "$B#F(B") (its-defrule "g" "$B#G(B") (its-defrule "h" "$B#H(B") (its-defrule "i" "$B#I(B") (its-defrule "j" "$B#J(B") (its-defrule "k" "$B#K(B") (its-defrule "l" "$B#L(B") (its-defrule "m" "$B#M(B") (its-defrule "n" "$B#N(B") (its-defrule "o" "$B#O(B") (its-defrule "p" "$B#P(B") (its-defrule "q" "$B#Q(B") (its-defrule "r" "$B#R(B") (its-defrule "s" "$B#S(B") (its-defrule "t" "$B#T(B") (its-defrule "u" "$B#U(B") (its-defrule "v" "$B#V(B") (its-defrule "w" "$B#W(B") (its-defrule "x" "$B#X(B") (its-defrule "y" "$B#Y(B") (its-defrule "z" "$B#Z(B") (its-defrule " " "$B!!(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!](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!1(B") (its-defrule "[" "$B!N(B") (its-defrule "]" "$B!O(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") (its-defrule "," "$B!$(B") (its-defrule "." "$B!%(B") wnn7egg-1.02.orig/elisp/emacs20/eggrc-wnn70100644000764400003210000001571007474174160020420 0ustar ishikawaishikawa;; Wnn7Egg is Egg modified for Wnn7, and the current maintainer ;; is OMRON SOFTWARE Co., Ltd. ;; ;; This file is part of Wnn7Egg. (base code is eggrc) ;; ;;; ------------------------------------------------------------------ ;;; ;;; Wnn7Egg (Wnn "なな"たまご)--- Wnn7 Emacs Client ;;; ;;; Wnn7Egg は、「たまご第3版」v3.09 をベースに 「たまご第4版」の通信、 ;;; ライブラリ部を組み込んだ、Wnn7 の為の専用クライアントです。 ;;; ;;; すべてのソースが Emacs Lisp で記述されているので、Wnn SDK/Library を必要 ;;; とせず、GNU Emacs 及び XEmacs 環境で使用することができます。使用許諾条件 ;;; は GPL です。 ;;; ;;; GNU Emacs 20.3 以降、XEmacs 21.x 以降で動作確認しています。 ;;; ;;; ;;; Wnn7Egg は Wnn7 の機能である楽々入力(入力予測)、連想変換をサポート ;;; しています。 ;;; ;;; 「たまご」と独立/共存できるように、影響する主要な関数/変数名を ;;; "wnn7..." という形に変更しています。 ;;; ;;; ------------------------------------------------------------------ ;; -*-Emacs-Lisp-*- ;; Standard Start Up File for EGG ;; Copyright (C) 1992 Free Software Foundation, Inc. ;; This file is part of Mule (MULtilingual Enhancement of GNU Emacs). ;; Mule is free software distributed in the form of patches to GNU Emacs. ;; 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 1, or (at your option) ;; any later version. ;; Mule 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, 675 Mass Ave, Cambridge, MA 02139, USA. ;;; Version 1.0 ;;; Written by Satoru.Tomura@etl.jp 1988 ;;; modified for LUNA'default ryuji@nfa.ncl.omron.junet ;;; ;;; modified for Wnn V4 - Use compatible library of Wnn v3 ;;; Copyright 1989 OMRON Tateisi Electronics, Co. ;;; 1989 7/12 by H.Kuribayashi kuri@frf.oron.junet ;;; 92.5.19 modified for Wnn V4 by T.Shingu ;;; Use non compatible library. ;;; 93.1.8 file names of frequency and private dictionary ware adjusted ;;; to Wnn version 4.1. ;;; 93.4.2 dictianary, frequency files are set up on normal/reverse ;;; environment individually. ;;; 93.6.30 specifying default user directory to make customize easily ;;; suggested by K.Sakai (defvar wnn-usr-dic-dir (concat "usr/" (user-login-name))) (defun wnn7-jserver-setup () (wnn7-set-reverse nil) (wnn7-set-fuzokugo "system/kougo.fzk") (wnn7-add-fisys-dict "system/fisd" (concat wnn-usr-dic-dir "/fisd.h") t) (wnn7-add-fiusr-dict (concat wnn-usr-dic-dir "/fiud") "" t nil) (wnn7-add-dict "system/kihon.dic" (concat wnn-usr-dic-dir "/kihon.h") 6 nil t) (wnn7-add-dict "system/symbol.dic" (concat wnn-usr-dic-dir "/symbol.h") 1 nil t) ;; (wnn7-add-dict "system/symbol_noat.dic" ;; (concat wnn-usr-dic-dir "/symbol_noat.h") 1 nil t) (wnn7-add-dict "system/tel.dic" (concat wnn-usr-dic-dir "/tel.h") 1 nil t) (wnn7-add-dict "system/zip.dic" (concat wnn-usr-dic-dir "/zip.h") 1 nil t) (wnn7-add-dict "system/tankan.dic" "" 1 nil nil) (wnn7-add-dict "system/tankan2.dic" "" 1 nil nil) (wnn7-add-dict "system/ikeiji.dic" "" 1 nil nil) (wnn7-add-dict "system/rensou.dic" "" 1 nil nil) (wnn7-add-dict (concat wnn-usr-dic-dir "/ud") "" 15 t t) (wnn7-add-dict "option/jinmei.dic" (concat wnn-usr-dic-dir "/jinmei.h") 1 nil t) (wnn7-add-dict "option/chimei.dic" (concat wnn-usr-dic-dir "/chimei.h") 1 nil t) (wnn7-add-dict "option/address.dic" (concat wnn-usr-dic-dir "/address.h") 1 nil t) (wnn7-add-dict "option/station.dic" (concat wnn-usr-dic-dir "/station.h") 1 nil t) (wnn7-add-dict "option/kana_english.dic" (concat wnn-usr-dic-dir "/kana_english.h") 1 nil t) (wnn7-add-dict "option/enterprise.dic" (concat wnn-usr-dic-dir "/enterprise.h") 1 nil t) (wnn7-add-dict "option/airport.dic" (concat wnn-usr-dic-dir "/airport.h") 1 nil t) (wnn7-add-dict "option/university.dic" (concat wnn-usr-dic-dir "/university.h") 1 nil t) (wnn7-add-dict "option/zoo.dic" (concat wnn-usr-dic-dir "/zoo.h") 1 nil t) (wnn7-add-dict "option/botanical_garden.dic" (concat wnn-usr-dic-dir "/botanical_garden.h") 1 nil t) (wnn7-add-dict "option/aquarium.dic" (concat wnn-usr-dic-dir "/aquarium.h") 1 nil t) (wnn7-add-dict "option/conveni.dic" (concat wnn-usr-dic-dir "/conveni.h") 1 nil t) (wnn7-add-dict "option/amusement.dic" (concat wnn-usr-dic-dir "/amusement.h") 1 nil t) (wnn7-add-dict "option/computer.dic" (concat wnn-usr-dic-dir "/computer.h") 1 nil t) (wnn7-set-param 5 10 2 45 0 80 5 1 20 0 400 -100 400 80 200 2 200) (wnn7-add-notrans-dict (concat wnn-usr-dic-dir "/katakana") 15 t) (wnn7-add-bmodify-dict (concat wnn-usr-dic-dir "/bunsetsu") 15 t) (wnn7-set-last-is-first-mode t) (wnn7-set-complex-conv-mode nil) ;; (wnn7-set-okuri-flag -1) (wnn7-set-prefix-flag 0) (wnn7-set-okuri-learn-mode t) (wnn7-set-prefix-learn-mode t) (wnn7-set-suffix-learn-mode t) (wnn7-set-common-learn-mode t) (wnn7-set-yuragi-mode nil) (wnn7-set-freq-func-mode 4) (wnn7-set-yosoku-learn t) (wnn7-set-yosoku-max-disp 10) (wnn7-set-yosoku-last-is-first t) (wnn7-set-boin-kabusoku t) (wnn7-set-shiin-choka t) (wnn7-set-n-choka t) (wnn7-set-nihongo-kosei t) ;; (wnn7-set-numeric-mode -12) ;; (wnn7-set-alphabet-mode -30) ;; (wnn7-set-symbol-mode -40) (wnn7-set-reverse t) (wnn7-set-fuzokugo "system/kougo.fzk") (wnn7-add-dict "system/kihonR.dic" "" 1 nil nil) (wnn7-add-dict "system/telR.dic" "" 1 nil nil) (wnn7-add-dict "system/zipR.dic" "" 1 nil nil) (wnn7-add-dict "system/tankanR.dic" "" 1 nil nil) (wnn7-add-dict "system/tankan2R.dic" "" 1 nil nil) (wnn7-add-dict "option/jinmeiR.dic" "" 1 nil nil) (wnn7-add-dict "option/chimeiR.dic" "" 1 nil nil) (wnn7-add-dict "option/addressR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/stationR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/kana_englishR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/enterpriseR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/airportR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/universityR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/zooR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/botanical_gardenR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/aquariumR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/conveniR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/amusementR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/computerR.dic" "" 1 nil nil) (wnn7-add-dict (concat wnn-usr-dic-dir "/ud") "" 15 t t) (wnn7-set-param 2 10 2 45 1 80 5 1 50 -20 400 -10 100 -100 200 0 200)) (wnn7-jserver-setup) ;; N nsho hindo len jiri flag jisho sbn dbn_len sbn_cnt suuji kana eisuu kigou toji_kakko fuzokogo kaikakko wnn7egg-1.02.orig/elisp/xemacs21/0040755000764400003210000000000007474174160016707 5ustar ishikawaishikawawnn7egg-1.02.orig/elisp/xemacs21/eggrc-wnn70100644000764400003210000001571007474174160020611 0ustar ishikawaishikawa;; Wnn7Egg is Egg modified for Wnn7, and the current maintainer ;; is OMRON SOFTWARE Co., Ltd. ;; ;; This file is part of Wnn7Egg. (base code is eggrc) ;; ;;; ------------------------------------------------------------------ ;;; ;;; Wnn7Egg (Wnn "なな"たまご)--- Wnn7 Emacs Client ;;; ;;; Wnn7Egg は、「たまご第3版」v3.09 をベースに 「たまご第4版」の通信、 ;;; ライブラリ部を組み込んだ、Wnn7 の為の専用クライアントです。 ;;; ;;; すべてのソースが Emacs Lisp で記述されているので、Wnn SDK/Library を必要 ;;; とせず、GNU Emacs 及び XEmacs 環境で使用することができます。使用許諾条件 ;;; は GPL です。 ;;; ;;; GNU Emacs 20.3 以降、XEmacs 21.x 以降で動作確認しています。 ;;; ;;; ;;; Wnn7Egg は Wnn7 の機能である楽々入力(入力予測)、連想変換をサポート ;;; しています。 ;;; ;;; 「たまご」と独立/共存できるように、影響する主要な関数/変数名を ;;; "wnn7..." という形に変更しています。 ;;; ;;; ------------------------------------------------------------------ ;; -*-Emacs-Lisp-*- ;; Standard Start Up File for EGG ;; Copyright (C) 1992 Free Software Foundation, Inc. ;; This file is part of Mule (MULtilingual Enhancement of GNU Emacs). ;; Mule is free software distributed in the form of patches to GNU Emacs. ;; 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 1, or (at your option) ;; any later version. ;; Mule 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, 675 Mass Ave, Cambridge, MA 02139, USA. ;;; Version 1.0 ;;; Written by Satoru.Tomura@etl.jp 1988 ;;; modified for LUNA'default ryuji@nfa.ncl.omron.junet ;;; ;;; modified for Wnn V4 - Use compatible library of Wnn v3 ;;; Copyright 1989 OMRON Tateisi Electronics, Co. ;;; 1989 7/12 by H.Kuribayashi kuri@frf.oron.junet ;;; 92.5.19 modified for Wnn V4 by T.Shingu ;;; Use non compatible library. ;;; 93.1.8 file names of frequency and private dictionary ware adjusted ;;; to Wnn version 4.1. ;;; 93.4.2 dictianary, frequency files are set up on normal/reverse ;;; environment individually. ;;; 93.6.30 specifying default user directory to make customize easily ;;; suggested by K.Sakai (defvar wnn-usr-dic-dir (concat "usr/" (user-login-name))) (defun wnn7-jserver-setup () (wnn7-set-reverse nil) (wnn7-set-fuzokugo "system/kougo.fzk") (wnn7-add-fisys-dict "system/fisd" (concat wnn-usr-dic-dir "/fisd.h") t) (wnn7-add-fiusr-dict (concat wnn-usr-dic-dir "/fiud") "" t nil) (wnn7-add-dict "system/kihon.dic" (concat wnn-usr-dic-dir "/kihon.h") 6 nil t) (wnn7-add-dict "system/symbol.dic" (concat wnn-usr-dic-dir "/symbol.h") 1 nil t) ;; (wnn7-add-dict "system/symbol_noat.dic" ;; (concat wnn-usr-dic-dir "/symbol_noat.h") 1 nil t) (wnn7-add-dict "system/tel.dic" (concat wnn-usr-dic-dir "/tel.h") 1 nil t) (wnn7-add-dict "system/zip.dic" (concat wnn-usr-dic-dir "/zip.h") 1 nil t) (wnn7-add-dict "system/tankan.dic" "" 1 nil nil) (wnn7-add-dict "system/tankan2.dic" "" 1 nil nil) (wnn7-add-dict "system/ikeiji.dic" "" 1 nil nil) (wnn7-add-dict "system/rensou.dic" "" 1 nil nil) (wnn7-add-dict (concat wnn-usr-dic-dir "/ud") "" 15 t t) (wnn7-add-dict "option/jinmei.dic" (concat wnn-usr-dic-dir "/jinmei.h") 1 nil t) (wnn7-add-dict "option/chimei.dic" (concat wnn-usr-dic-dir "/chimei.h") 1 nil t) (wnn7-add-dict "option/address.dic" (concat wnn-usr-dic-dir "/address.h") 1 nil t) (wnn7-add-dict "option/station.dic" (concat wnn-usr-dic-dir "/station.h") 1 nil t) (wnn7-add-dict "option/kana_english.dic" (concat wnn-usr-dic-dir "/kana_english.h") 1 nil t) (wnn7-add-dict "option/enterprise.dic" (concat wnn-usr-dic-dir "/enterprise.h") 1 nil t) (wnn7-add-dict "option/airport.dic" (concat wnn-usr-dic-dir "/airport.h") 1 nil t) (wnn7-add-dict "option/university.dic" (concat wnn-usr-dic-dir "/university.h") 1 nil t) (wnn7-add-dict "option/zoo.dic" (concat wnn-usr-dic-dir "/zoo.h") 1 nil t) (wnn7-add-dict "option/botanical_garden.dic" (concat wnn-usr-dic-dir "/botanical_garden.h") 1 nil t) (wnn7-add-dict "option/aquarium.dic" (concat wnn-usr-dic-dir "/aquarium.h") 1 nil t) (wnn7-add-dict "option/conveni.dic" (concat wnn-usr-dic-dir "/conveni.h") 1 nil t) (wnn7-add-dict "option/amusement.dic" (concat wnn-usr-dic-dir "/amusement.h") 1 nil t) (wnn7-add-dict "option/computer.dic" (concat wnn-usr-dic-dir "/computer.h") 1 nil t) (wnn7-set-param 5 10 2 45 0 80 5 1 20 0 400 -100 400 80 200 2 200) (wnn7-add-notrans-dict (concat wnn-usr-dic-dir "/katakana") 15 t) (wnn7-add-bmodify-dict (concat wnn-usr-dic-dir "/bunsetsu") 15 t) (wnn7-set-last-is-first-mode t) (wnn7-set-complex-conv-mode nil) ;; (wnn7-set-okuri-flag -1) (wnn7-set-prefix-flag 0) (wnn7-set-okuri-learn-mode t) (wnn7-set-prefix-learn-mode t) (wnn7-set-suffix-learn-mode t) (wnn7-set-common-learn-mode t) (wnn7-set-yuragi-mode nil) (wnn7-set-freq-func-mode 4) (wnn7-set-yosoku-learn t) (wnn7-set-yosoku-max-disp 10) (wnn7-set-yosoku-last-is-first t) (wnn7-set-boin-kabusoku t) (wnn7-set-shiin-choka t) (wnn7-set-n-choka t) (wnn7-set-nihongo-kosei t) ;; (wnn7-set-numeric-mode -12) ;; (wnn7-set-alphabet-mode -30) ;; (wnn7-set-symbol-mode -40) (wnn7-set-reverse t) (wnn7-set-fuzokugo "system/kougo.fzk") (wnn7-add-dict "system/kihonR.dic" "" 1 nil nil) (wnn7-add-dict "system/telR.dic" "" 1 nil nil) (wnn7-add-dict "system/zipR.dic" "" 1 nil nil) (wnn7-add-dict "system/tankanR.dic" "" 1 nil nil) (wnn7-add-dict "system/tankan2R.dic" "" 1 nil nil) (wnn7-add-dict "option/jinmeiR.dic" "" 1 nil nil) (wnn7-add-dict "option/chimeiR.dic" "" 1 nil nil) (wnn7-add-dict "option/addressR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/stationR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/kana_englishR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/enterpriseR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/airportR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/universityR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/zooR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/botanical_gardenR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/aquariumR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/conveniR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/amusementR.dic" "" 1 nil nil) ;;(wnn7-add-dict "option/computerR.dic" "" 1 nil nil) (wnn7-add-dict (concat wnn-usr-dic-dir "/ud") "" 15 t t) (wnn7-set-param 2 10 2 45 1 80 5 1 50 -20 400 -10 100 -100 200 0 200)) (wnn7-jserver-setup) ;; N nsho hindo len jiri flag jisho sbn dbn_len sbn_cnt suuji kana eisuu kigou toji_kakko fuzokogo kaikakko wnn7egg-1.02.orig/elisp/xemacs21/its-v309/0040755000764400003210000000000007474174160020205 5ustar ishikawaishikawawnn7egg-1.02.orig/elisp/xemacs21/its-v309/han-kata.el0100644000764400003210000002211407474174160022210 0ustar ishikawaishikawa;; Basic Roma-to-HankakuKana (jisx0201) Translation Table for Egg ;; This file is part of Egg on Mule (Japanese Environment) ;; Egg is distributed in the forms of patches to GNU ;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC ;; LICENSE which is distributed along with GNU Emacs by the ;; Free Software Foundation. ;; Egg is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. See the GNU EMACS GENERAL PUBLIC LICENSE for ;; more details. ;; You should have received a copy of the GNU EMACS GENERAL ;; PUBLIC LICENSE along with Nemacs; see the file COPYING. ;; If not, write to the Free Software Foundation, 675 Mass ;; Ave, Cambridge, MA 02139, USA. ;;; 92.9.24 created for Mule Ver.0.9.6 by K.Shibata (require 'japan-util) (its-define-mode "roma-han-kata" "(I1'(B" t) (dolist (aa '("k" "s" "t" "h" "y" "r" "w" "g" "z" "d" "b" "p" "c" "f" "j" "v")) (its-defrule (concat aa aa) "(I/(B" aa)) (its-defrule "tch" "(I/(B" "ch") (dolist (q1 '("b" "m" "p")) (its-defrule (concat "m" q1) "(I](B" q1)) (its-defrule "N" "(I](B") (defvar enable-double-n-syntax nil "*Enable \"nn\" input for \"(I](B\" ") (its-defrule-conditional "n" ((not enable-double-n-syntax) "(I](B") (t nil)) (its-defrule-conditional "nn" ( enable-double-n-syntax "(I](B") (t nil)) (its-defrule "n'" "(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 "a" "(I1(B") (its-defrule "i" "(I2(B") (its-defrule "u" "(I3(B") (its-defrule "e" "(I4(B") (its-defrule "o" "(I5(B") (its-defrule "ka" "(I6(B") (its-defrule "ki" "(I7(B") (its-defrule "ku" "(I8(B") (its-defrule "ke" "(I9(B") (its-defrule "ko" "(I:(B") (its-defrule "kya" "(I7,(B") (its-defrule "kyu" "(I7-(B") (its-defrule "kye" "(I7*(B") (its-defrule "kyo" "(I7.(B") (its-defrule "sa" "(I;(B") (its-defrule "si" "(I<(B") (its-defrule "su" "(I=(B") (its-defrule "se" "(I>(B") (its-defrule "so" "(I?(B") (its-defrule "sya" "(I<,(B") (its-defrule "syu" "(I<-(B") (its-defrule "sye" "(I<*(B") (its-defrule "syo" "(I<.(B") (its-defrule "sha" "(I<,(B") (its-defrule "shi" "(I<(B") (its-defrule "shu" "(I<-(B") (its-defrule "she" "(I<*(B") (its-defrule "sho" "(I<.(B") (its-defrule "ta" "(I@(B") (its-defrule "ti" "(IA(B") (its-defrule "tu" "(IB(B") (its-defrule "te" "(IC(B") (its-defrule "to" "(ID(B") (its-defrule "tya" "(IA,(B") (its-defrule "tyi" "(IC((B") (its-defrule "tyu" "(IA-(B") (its-defrule "tye" "(IA*(B") (its-defrule "tyo" "(IA.(B") (its-defrule "tsu" "(IB(B") (its-defrule "cha" "(IA,(B") (its-defrule "chi" "(IA(B") (its-defrule "chu" "(IA-(B") (its-defrule "che" "(IA*(B") (its-defrule "cho" "(IA.(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 "ha" "(IJ(B") (its-defrule "hi" "(IK(B") (its-defrule "hu" "(IL(B") (its-defrule "he" "(IM(B") (its-defrule "ho" "(IN(B") (its-defrule "hya" "(IK,(B") (its-defrule "hyu" "(IK-(B") (its-defrule "hye" "(IK*(B") (its-defrule "hyo" "(IK.(B") (its-defrule "fa" "(IL'(B") (its-defrule "fi" "(IL((B") (its-defrule "fu" "(IL(B") (its-defrule "fe" "(IL*(B") (its-defrule "fo" "(IL+(B") (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 "ye" "(I2*(B") (its-defrule "yo" "(IV(B") (its-defrule "ra" "(IW(B") (its-defrule "ri" "(IX(B") (its-defrule "ru" "(IY(B") (its-defrule "re" "(IZ(B") (its-defrule "ro" "(I[(B") (its-defrule "la" "(IW(B") (its-defrule "li" "(IX(B") (its-defrule "lu" "(IY(B") (its-defrule "le" "(IZ(B") (its-defrule "lo" "(I[(B") (its-defrule "rya" "(IX,(B") (its-defrule "ryu" "(IX-(B") (its-defrule "rye" "(IX*(B") (its-defrule "ryo" "(IX.(B") (its-defrule "lya" "(IX,(B") (its-defrule "lyu" "(IX-(B") (its-defrule "lye" "(IX*(B") (its-defrule "lyo" "(IX.(B") (its-defrule "wa" "(I\(B") (its-defrule "wu" "(I3(B") (its-defrule "wo" "(I&(B") (its-defrule "ga" "(I6^(B") (its-defrule "gi" "(I7^(B") (its-defrule "gu" "(I8^(B") (its-defrule "ge" "(I9^(B") (its-defrule "go" "(I:^(B") (its-defrule "gya" "(I7^,(B") (its-defrule "gyu" "(I7^-(B") (its-defrule "gye" "(I7^*(B") (its-defrule "gyo" "(I7^.(B") (its-defrule "za" "(I;^(B") (its-defrule "zi" "(I<^(B") (its-defrule "zu" "(I=^(B") (its-defrule "ze" "(I>^(B") (its-defrule "zo" "(I?^(B") (its-defrule "zya" "(I<^,(B") (its-defrule "zyu" "(I<^-(B") (its-defrule "zye" "(I<^*(B") (its-defrule "zyo" "(I<^.(B") (its-defrule "ja" "(I<^,(B") (its-defrule "ji" "(I<^(B") (its-defrule "ju" "(I<^-(B") (its-defrule "je" "(I<^*(B") (its-defrule "jo" "(I<^.(B") (its-defrule "da" "(I@^(B") (its-defrule "di" "(IA^(B") (its-defrule "du" "(IB^(B") (its-defrule "de" "(IC^(B") (its-defrule "do" "(ID^(B") (its-defrule "dya" "(IA^,(B") (its-defrule "dyi" "(IA^((B") (its-defrule "dyu" "(IA^-(B") (its-defrule "dye" "(IA^*(B") (its-defrule "dyo" "(IA^.(B") (its-defrule "ba" "(IJ^(B") (its-defrule "bi" "(IK^(B") (its-defrule "bu" "(IL^(B") (its-defrule "be" "(IM^(B") (its-defrule "bo" "(IN^(B") (its-defrule "va" "(I3^'(B") (its-defrule "vi" "(I3^((B") (its-defrule "vu" "(I3^(B") (its-defrule "ve" "(I3^*(B") (its-defrule "vo" "(I3^+(B") (its-defrule "bya" "(IK^,(B") (its-defrule "byu" "(IK^-(B") (its-defrule "bye" "(IK^*(B") (its-defrule "byo" "(IK^.(B") (its-defrule "pa" "(IJ_(B") (its-defrule "pi" "(IK_(B") (its-defrule "pu" "(IL_(B") (its-defrule "pe" "(IM_(B") (its-defrule "po" "(IN_(B") (its-defrule "pya" "(IK_,(B") (its-defrule "pyu" "(IK_-(B") (its-defrule "pye" "(IK_*(B") (its-defrule "pyo" "(IK_.(B") (its-defrule "kwi" "(I8((B") (its-defrule "kwu" "(I8(B") (its-defrule "kwe" "(I8*(B") (its-defrule "kwo" "(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 "xka" "(I6(B") (its-defrule "xke" "(I9(B") (its-defrule "xti" "(IC((B") (its-defrule "xdi" "(IA^((B") (its-defrule "xdu" "(ID^)(B") (its-defrule "xde" "(IA^*(B") (its-defrule "xdo" "(ID^+(B") (its-defrule "xwi" "(I3((B") (its-defrule "xwe" "(I3*(B") (its-defrule "xwo" "(I3+(B") (its-defrule "-" "(I0(B") (its-defrule "[" "(I"(B") (its-defrule "]" "(I#(B") (its-defrule "z/" "(I%(B") (defvar use-kuten-for-period t "*(IK_X5D^$B$r6gE@$KJQ49$9$k(B") (defvar use-touten-for-comma t "*(I:]O$B$rFIE@$KJQ49$9$k(B") (its-defrule-conditional "." (use-kuten-for-period "(I!(B") (t ".")) (its-defrule-conditional "," (use-touten-for-comma "(I$(B") (t ",")) (its-defrule (concat zenkaku-escape ",") "$B!$(B") (its-defrule (concat zenkaku-escape ".") "$B!%(B") (defun its:select-hankaku-katakana () (interactive) (its:select-mode "roma-han-kata")) (define-key mule-keymap "x" 'its:select-hankaku-katakana) (define-key fence-mode-map "\e\C-x" 'its:select-hankaku-katakana) ;;; ;;; JISX 0201 fence mode ;;; (defun fence-hankaku-katakana () (interactive) (japanese-katakana-region egg:*region-start* egg:*region-end* t)) (defun fence-katakana () (interactive) (japanese-katakana-region egg:*region-start* egg:*region-end*)) (defun fence-hiragana () (interactive) (japanese-katakana-region egg:*region-start* egg:*region-end*) (japanese-hiragana-region egg:*region-start* egg:*region-end*)) (define-key fence-mode-map "\ex" 'fence-hankaku-katakana) wnn7egg-1.02.orig/elisp/xemacs21/its-v309/hankaku.el0100644000764400003210000000477707474174160022165 0ustar ishikawaishikawa;; Basic Roma-to-Kana Translation Table for Egg ;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) ;; This file is part of Egg on Nemacs (Japanese Environment) ;; Egg is distributed in the forms of patches to GNU ;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC ;; LICENSE which is distributed along with GNU Emacs by the ;; Free Software Foundation. ;; Egg is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. See the GNU EMACS GENERAL PUBLIC LICENSE for ;; more details. ;; You should have received a copy of the GNU EMACS GENERAL ;; PUBLIC LICENSE along with Nemacs; see the file COPYING. ;; If not, write to the Free Software Foundation, 675 Mass ;; Ave, Cambridge, MA 02139, USA. ;; 92.3.16 modified for Mule Ver.0.9.1 by K.Handa ;; 92.3.23 modified for Mule Ver.0.9.1 by K.Handa ;; defrule -> its-defrule, define-its-mode -> its-define-mode (defvar digit-characters '( "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" )) (defvar symbol-characters '( " " "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" "-" "=" "`" "\\" "|" "_" "+" "~" "[" "]" "{" "}" ":" ";" "\"" "'" "<" ">" "?" "/" "," "." )) (defvar downcase-alphabets '("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")) (defvar upcase-alphabets '("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")) ;;;; ;;;; ;;;; ;; 92.3.16 by K.Handa ;;(define-its-mode "downcase" " a a" t) (its-define-mode "downcase" "aa" t) (dolist (digit digit-characters) (its-defrule digit digit)) (dolist (symbol symbol-characters) (its-defrule symbol symbol)) (dolist (downcase downcase-alphabets) (its-defrule downcase downcase)) (dolist (upcase upcase-alphabets) (its-defrule upcase upcase)) ;;;; ;;;; ;;;; (defun upcase-character (ch) (if (and (<= ?a ch) (<= ch ?z)) (+ ?A (- ch ?a)) ch)) ;; 92.3.16 by K.Handa ;;(define-its-mode "upcase" " a A" t) (its-define-mode "upcase" "aA" t);;; 93.7.21 by S.Tomura (dolist (digit digit-characters) (its-defrule digit digit)) (dolist (symbol symbol-characters) (its-defrule symbol symbol)) (dolist (downcase downcase-alphabets) (its-defrule downcase (char-to-string (upcase-character (string-to-char downcase))))) (dolist (upcase upcase-alphabets) (its-defrule upcase upcase)) wnn7egg-1.02.orig/elisp/xemacs21/its-v309/hira.el0100644000764400003210000004762207474174160021462 0ustar ishikawaishikawa;; Basic Roma-to-Kana Translation Table for Egg ;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) ;; This file is part of Egg on Nemacs (Japanese Environment) ;; Egg is distributed in the forms of patches to GNU ;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC ;; LICENSE which is distributed along with GNU Emacs by the ;; Free Software Foundation. ;; Egg is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. See the GNU EMACS GENERAL PUBLIC LICENSE for ;; more details. ;; You should have received a copy of the GNU EMACS GENERAL ;; PUBLIC LICENSE along with Nemacs; see the file COPYING. ;; If not, write to the Free Software Foundation, 675 Mass ;; Ave, Cambridge, MA 02139, USA. ;; 90.3.2 modified for Nemacs Ver.3.3.1 ;; by jiro@math.keio.ac.jp (TANAKA Jiro) ;; proposal of keybinding for JIS symbols ;; 92.3.23 modified for Mule Ver.0.9.1 by K.Handa ;; defrule -> its-defrule, define-its-mode -> its-define-mode ;; 92.7.6 modified for Mule Ver.0.9.5 by K.Handa ;; New rules added. (its-define-mode "roma-kana" "$B$"(B" t) (its-defrule-select-mode-temporally "q" "downcase") (its-defrule-select-mode-temporally "Q" "zenkaku-downcase") ;;; $B!V$C!W$NF~NO(B (dolist (aa '("k" "s" "t" "h" "y" "r" "w" "g" "z" "d" "b" "p" "c" "f" "j" "v")) (its-defrule (concat aa aa) "$B$C(B" aa)) (its-defrule "tch" "$B$C(B" "ch") ;;; $B!V$s!W$NF~NO(B (dolist (q1 '("b" "m" "p")) (its-defrule (concat "m" q1) "$B$s(B" q1)) (its-defrule "N" "$B$s(B") (its-defrule "n'" "$B$s(B") (defvar enable-double-n-syntax nil "*\"nn\"$B$r(B\"$B$s(B\"$B$KJQ49$9$k(B") (its-defrule "n" "$B$s(B") (its-defrule-conditional* "nn" "$B$s(B" nil (enable-double-n-syntax "$B$s(B") (t nil)) ;; 92.7.6 by Y.Kawabe ;;(dolist (aa '("k" "s" "t" "c" "h" "f" "m" "y" "r" "l" ;; "w" "g" "z" "j" "d" "b" "v" "p" "x")) ;; (its-defrule (concat "n" aa) "$B$s(B" aa)) ;; end of patch (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") (its-defrule "ka" "$B$+(B") (its-defrule "ki" "$B$-(B") (its-defrule "ku" "$B$/(B") (its-defrule "ke" "$B$1(B") (its-defrule "ko" "$B$3(B") (its-defrule "kya" "$B$-$c(B") (its-defrule "kyu" "$B$-$e(B") (its-defrule "kye" "$B$-$'(B") (its-defrule "kyo" "$B$-$g(B") (its-defrule "sa" "$B$5(B") (its-defrule "si" "$B$7(B") (its-defrule "su" "$B$9(B") (its-defrule "se" "$B$;(B") (its-defrule "so" "$B$=(B") (its-defrule "sya" "$B$7$c(B") (its-defrule "syu" "$B$7$e(B") (its-defrule "sye" "$B$7$'(B") (its-defrule "syo" "$B$7$g(B") (its-defrule "sha" "$B$7$c(B") (its-defrule "shi" "$B$7(B") (its-defrule "shu" "$B$7$e(B") (its-defrule "she" "$B$7$'(B") (its-defrule "sho" "$B$7$g(B") (its-defrule "ta" "$B$?(B") (its-defrule "ti" "$B$A(B") (its-defrule "tu" "$B$D(B") (its-defrule "te" "$B$F(B") (its-defrule "to" "$B$H(B") (its-defrule "tya" "$B$A$c(B") (its-defrule "tyi" "$B$F$#(B") (its-defrule "tyu" "$B$A$e(B") (its-defrule "tye" "$B$A$'(B") (its-defrule "tyo" "$B$A$g(B") (its-defrule "tsu" "$B$D(B") (its-defrule "cha" "$B$A$c(B") (its-defrule "chi" "$B$A(B") (its-defrule "chu" "$B$A$e(B") (its-defrule "che" "$B$A$'(B") (its-defrule "cho" "$B$A$g(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 "ha" "$B$O(B") (its-defrule "hi" "$B$R(B") (its-defrule "hu" "$B$U(B") (its-defrule "he" "$B$X(B") (its-defrule "ho" "$B$[(B") (its-defrule "hya" "$B$R$c(B") (its-defrule "hyu" "$B$R$e(B") (its-defrule "hye" "$B$R$'(B") (its-defrule "hyo" "$B$R$g(B") (its-defrule "fa" "$B$U$!(B") (its-defrule "fi" "$B$U$#(B") (its-defrule "fu" "$B$U(B") (its-defrule "fe" "$B$U$'(B") (its-defrule "fo" "$B$U$)(B") (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 "ye" "$B$$$'(B") (its-defrule "yo" "$B$h(B") (its-defrule "ra" "$B$i(B") (its-defrule "ri" "$B$j(B") (its-defrule "ru" "$B$k(B") (its-defrule "re" "$B$l(B") (its-defrule "ro" "$B$m(B") (its-defrule "la" "$B$i(B") (its-defrule "li" "$B$j(B") (its-defrule "lu" "$B$k(B") (its-defrule "le" "$B$l(B") (its-defrule "lo" "$B$m(B") (its-defrule "rya" "$B$j$c(B") (its-defrule "ryu" "$B$j$e(B") (its-defrule "rye" "$B$j$'(B") (its-defrule "ryo" "$B$j$g(B") (its-defrule "lya" "$B$j$c(B") (its-defrule "lyu" "$B$j$e(B") (its-defrule "lye" "$B$j$'(B") (its-defrule "lyo" "$B$j$g(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 "ga" "$B$,(B") (its-defrule "gi" "$B$.(B") (its-defrule "gu" "$B$0(B") (its-defrule "ge" "$B$2(B") (its-defrule "go" "$B$4(B") (its-defrule "gya" "$B$.$c(B") (its-defrule "gyu" "$B$.$e(B") (its-defrule "gye" "$B$.$'(B") (its-defrule "gyo" "$B$.$g(B") (its-defrule "za" "$B$6(B") (its-defrule "zi" "$B$8(B") (its-defrule "zu" "$B$:(B") (its-defrule "ze" "$B$<(B") (its-defrule "zo" "$B$>(B") (its-defrule "zya" "$B$8$c(B") (its-defrule "zyu" "$B$8$e(B") (its-defrule "zye" "$B$8$'(B") (its-defrule "zyo" "$B$8$g(B") (its-defrule "ja" "$B$8$c(B") (its-defrule "ji" "$B$8(B") (its-defrule "ju" "$B$8$e(B") (its-defrule "je" "$B$8$'(B") (its-defrule "jo" "$B$8$g(B") ;; 92.7.6 by Y.Kawabe (its-defrule "jya" "$B$8$c(B") (its-defrule "jyu" "$B$8$e(B") (its-defrule "jye" "$B$8$'(B") (its-defrule "jyo" "$B$8$g(B") ;; end of patch (its-defrule "da" "$B$@(B") (its-defrule "di" "$B$B(B") (its-defrule "du" "$B$E(B") (its-defrule "de" "$B$G(B") (its-defrule "do" "$B$I(B") (its-defrule "dya" "$B$B$c(B") (its-defrule "dyi" "$B$G$#(B") (its-defrule "dyu" "$B$B$e(B") (its-defrule "dye" "$B$B$'(B") (its-defrule "dyo" "$B$B$g(B") (its-defrule "ba" "$B$P(B") (its-defrule "bi" "$B$S(B") (its-defrule "bu" "$B$V(B") (its-defrule "be" "$B$Y(B") (its-defrule "bo" "$B$\(B") (its-defrule "va" "$B%t$!(B") (its-defrule "vi" "$B%t$#(B") (its-defrule "vu" "$B%t(B") (its-defrule "ve" "$B%t$'(B") (its-defrule "vo" "$B%t$)(B") (its-defrule "bya" "$B$S$c(B") (its-defrule "byu" "$B$S$e(B") (its-defrule "bye" "$B$S$'(B") (its-defrule "byo" "$B$S$g(B") (its-defrule "pa" "$B$Q(B") (its-defrule "pi" "$B$T(B") (its-defrule "pu" "$B$W(B") (its-defrule "pe" "$B$Z(B") (its-defrule "po" "$B$](B") (its-defrule "pya" "$B$T$c(B") (its-defrule "pyu" "$B$T$e(B") (its-defrule "pye" "$B$T$'(B") (its-defrule "pyo" "$B$T$g(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 "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 Symbols (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!*(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!<(B") ;;; JIS 213c ;;;(its-defrule "-" "$B!](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!1(B") (its-defrule "[" "$B!V(B") ;;(its-defrule "[" "$B!N(B") (its-defrule "]" "$B!W(B") ;;(its-defrule "]" "$B!O(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") (defvar use-kuten-for-period t "*$B%T%j%*%I$r6gE@$KJQ49$9$k(B") (defvar use-touten-for-comma t "*$B%3%s%^$rFIE@$KJQ49$9$k(B") (its-defrule-conditional "." (use-kuten-for-period "$B!#(B") (t "$B!%(B")) (its-defrule-conditional "," (use-touten-for-comma "$B!"(B") (t "$B!$(B")) ;;; Escape character to Zenkaku inputs (defvar zenkaku-escape "Z") ;;; Escape character to Hankaku inputs (defvar hankaku-escape "~") ;;; ;;; Zenkaku inputs ;;; (its-defrule (concat zenkaku-escape "0") "$B#0(B") (its-defrule (concat zenkaku-escape "1") "$B#1(B") (its-defrule (concat zenkaku-escape "2") "$B#2(B") (its-defrule (concat zenkaku-escape "3") "$B#3(B") (its-defrule (concat zenkaku-escape "4") "$B#4(B") (its-defrule (concat zenkaku-escape "5") "$B#5(B") (its-defrule (concat zenkaku-escape "6") "$B#6(B") (its-defrule (concat zenkaku-escape "7") "$B#7(B") (its-defrule (concat zenkaku-escape "8") "$B#8(B") (its-defrule (concat zenkaku-escape "9") "$B#9(B") (its-defrule (concat zenkaku-escape "A") "$B#A(B") (its-defrule (concat zenkaku-escape "B") "$B#B(B") (its-defrule (concat zenkaku-escape "C") "$B#C(B") (its-defrule (concat zenkaku-escape "D") "$B#D(B") (its-defrule (concat zenkaku-escape "E") "$B#E(B") (its-defrule (concat zenkaku-escape "F") "$B#F(B") (its-defrule (concat zenkaku-escape "G") "$B#G(B") (its-defrule (concat zenkaku-escape "H") "$B#H(B") (its-defrule (concat zenkaku-escape "I") "$B#I(B") (its-defrule (concat zenkaku-escape "J") "$B#J(B") (its-defrule (concat zenkaku-escape "K") "$B#K(B") (its-defrule (concat zenkaku-escape "L") "$B#L(B") (its-defrule (concat zenkaku-escape "M") "$B#M(B") (its-defrule (concat zenkaku-escape "N") "$B#N(B") (its-defrule (concat zenkaku-escape "O") "$B#O(B") (its-defrule (concat zenkaku-escape "P") "$B#P(B") (its-defrule (concat zenkaku-escape "Q") "$B#Q(B") (its-defrule (concat zenkaku-escape "R") "$B#R(B") (its-defrule (concat zenkaku-escape "S") "$B#S(B") (its-defrule (concat zenkaku-escape "T") "$B#T(B") (its-defrule (concat zenkaku-escape "U") "$B#U(B") (its-defrule (concat zenkaku-escape "V") "$B#V(B") (its-defrule (concat zenkaku-escape "W") "$B#W(B") (its-defrule (concat zenkaku-escape "X") "$B#X(B") (its-defrule (concat zenkaku-escape "Y") "$B#Y(B") (its-defrule (concat zenkaku-escape "Z") "$B#Z(B") (its-defrule (concat zenkaku-escape "a") "$B#a(B") (its-defrule (concat zenkaku-escape "b") "$B#b(B") (its-defrule (concat zenkaku-escape "c") "$B#c(B") (its-defrule (concat zenkaku-escape "d") "$B#d(B") (its-defrule (concat zenkaku-escape "e") "$B#e(B") (its-defrule (concat zenkaku-escape "f") "$B#f(B") (its-defrule (concat zenkaku-escape "g") "$B#g(B") (its-defrule (concat zenkaku-escape "h") "$B#h(B") (its-defrule (concat zenkaku-escape "i") "$B#i(B") (its-defrule (concat zenkaku-escape "j") "$B#j(B") (its-defrule (concat zenkaku-escape "k") "$B#k(B") (its-defrule (concat zenkaku-escape "l") "$B#l(B") (its-defrule (concat zenkaku-escape "m") "$B#m(B") (its-defrule (concat zenkaku-escape "n") "$B#n(B") (its-defrule (concat zenkaku-escape "o") "$B#o(B") (its-defrule (concat zenkaku-escape "p") "$B#p(B") (its-defrule (concat zenkaku-escape "q") "$B#q(B") (its-defrule (concat zenkaku-escape "r") "$B#r(B") (its-defrule (concat zenkaku-escape "s") "$B#s(B") (its-defrule (concat zenkaku-escape "t") "$B#t(B") (its-defrule (concat zenkaku-escape "u") "$B#u(B") (its-defrule (concat zenkaku-escape "v") "$B#v(B") (its-defrule (concat zenkaku-escape "w") "$B#w(B") (its-defrule (concat zenkaku-escape "x") "$B#x(B") (its-defrule (concat zenkaku-escape "y") "$B#y(B") (its-defrule (concat zenkaku-escape "z") "$B#z(B") (its-defrule (concat zenkaku-escape " ") "$B!!(B") (its-defrule (concat zenkaku-escape "!") "$B!*(B") (its-defrule (concat zenkaku-escape "@") "$B!w(B") (its-defrule (concat zenkaku-escape "#") "$B!t(B") (its-defrule (concat zenkaku-escape "$") "$B!p(B") (its-defrule (concat zenkaku-escape "%") "$B!s(B") (its-defrule (concat zenkaku-escape "^") "$B!0(B") (its-defrule (concat zenkaku-escape "&") "$B!u(B") (its-defrule (concat zenkaku-escape "*") "$B!v(B") (its-defrule (concat zenkaku-escape "(") "$B!J(B") (its-defrule (concat zenkaku-escape ")") "$B!K(B") (its-defrule (concat zenkaku-escape "-") "$B!](B") (its-defrule (concat zenkaku-escape "=") "$B!a(B") (its-defrule (concat zenkaku-escape "`") "$B!.(B") (its-defrule (concat zenkaku-escape "\\") "$B!o(B") (its-defrule (concat zenkaku-escape "|") "$B!C(B") (its-defrule (concat zenkaku-escape "_") "$B!2(B") (its-defrule (concat zenkaku-escape "+") "$B!\(B") (its-defrule (concat zenkaku-escape "~") "$B!1(B") (its-defrule (concat zenkaku-escape "[") "$B!N(B") (its-defrule (concat zenkaku-escape "]") "$B!O(B") (its-defrule (concat zenkaku-escape "{") "$B!P(B") (its-defrule (concat zenkaku-escape "}") "$B!Q(B") (its-defrule (concat zenkaku-escape ":") "$B!'(B") (its-defrule (concat zenkaku-escape ";") "$B!((B") (its-defrule (concat zenkaku-escape "\"") "$B!I(B") (its-defrule (concat zenkaku-escape "'") "$B!G(B") (its-defrule (concat zenkaku-escape "<") "$B!c(B") (its-defrule (concat zenkaku-escape ">") "$B!d(B") (its-defrule (concat zenkaku-escape "?") "$B!)(B") (its-defrule (concat zenkaku-escape "/") "$B!?(B") (its-defrule (concat zenkaku-escape ",") "$B!$(B") (its-defrule (concat zenkaku-escape ".") "$B!%(B") ;;; ;;; Hankaku inputs ;;; ;;(defvar escd '("-" "," "." "/" ";" ":" "[" "\\" "]" "^" "~")) ;;(its-defrule '("x" escd) '(escd)) (defvar digit-characters '( "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" )) (defvar symbol-characters '( " " "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" "-" "=" "`" "\\" "|" "_" "+" "~" "[" "]" "{" "}" ":" ";" "\"" "'" "<" ">" "?" "/" "," "." )) (defvar downcase-alphabets '("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")) (defvar upcase-alphabets '("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")) (dolist (digit digit-characters) (its-defrule (concat hankaku-escape digit) digit)) (dolist (symbol symbol-characters) (its-defrule (concat hankaku-escape symbol) symbol)) (dolist (downcase downcase-alphabets) (its-defrule (concat hankaku-escape downcase) downcase)) (dolist (upcase upcase-alphabets) (its-defrule (concat hankaku-escape upcase) upcase)) ;;; proposal key bindings for JIS symbols ;;; 90.3.2 by jiro@math.keio.ac.jp (TANAKA Jiro) (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") ; z- (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") ; zr (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") ; zp (its-defrule "z[" "$B!X(B") (its-defrule "z{" "$B!L(B") ; z[ (its-defrule "z]" "$B!Y(B") (its-defrule "z}" "$B!M(B") ; z] ; 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") ; zc (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") ; z. (its-defrule "z/" "$B!&(B") (its-defrule "z?" "$B!g(B") ; z/ ;;; Commented out by K.Handa. Already defined in a different way. ;(its-defrule "va" "$B%t%!(B") ;(its-defrule "vi" "$B%t%#(B") ;(its-defrule "vu" "$B%t(B") ;(its-defrule "ve" "$B%t%'(B") ;(its-defrule "vo" "$B%t%)(B") wnn7egg-1.02.orig/elisp/xemacs21/its-v309/kanainput.el0100644000764400003210000002700107474174160022516 0ustar ishikawaishikawa;; Basic translation table to input KANA with ASCII keyboard ;; Created by DEMIZU Norotishi on 1994.1.26 ;; $Id: kanainput.el,v 1.1 2001/03/03 05:20:21 fukita Exp $ ;; ;; $BG[I[>r7o$O(B GNU GENERAL PUBLIC LICENSE $B$K=>$$$^$9!#(B ;; ;; $B$3$l$O(B ASCII $BG[Ns$N%-!<%\!<%I$G$+$JF~NO$G2>L>4A;zJQ49$r$9$k$?$a$N(B ;; $BJQ49%k!<%k$r5-$7$?(B lisp $B$G$9!#;H$$J}$O3QJ8;z!"(BJIS $B5-9fF~NO$NItJ,$O(B its/hira.el $B$HF1$8$K$7$^$7$?!#(B ;; $BF~NO$N$?$a$N(B prefix $B$O0J2<$NDL$j!#(B ;; Q: $BA43QF~NO(B (Quote $B$H3P$($k(B) ; k-zenkaku-escape $B$GDj5A2DG=(B ;; A: $BH>3QF~NO(B (Ascii $B$H3P$($k(B) ; k-hankaku-escape $B$GDj5A2DG=(B ;; S: $B5-9fF~NO(B (Symbol $B$H3P$($k(B) ; k-symbols-escape $B$GDj5A2DG=(B ;; ;;$B!V$+$JF~NO;~$NG[Ns!W(B ;; $B$L!*(B $B$U!w(B $B$"$!(B $B$&$%(B $B$($'(B $B$*$)(B $B$d$c(B $B$f$e(B $B$h$g(B $B$o$r(B $B$[$m(B $B$X!\(B $B! 90.3.2) ;; $B!{!|(B $B"&"'(B $B"$"%(B $B"""#(B $B!~"!(B $B!y!z(B $B!}!r(B $B!q!_(B $B!i!Z(B $B!j![(B $B!A!h(B $B!b!^(B $B!-!/(B ;; $B!T!R(B $B!U!S(B ____ $B!9!8(B $B!:!x(B $B!o(B__ ____ ____ ____ $B")",(B $B!X!L(B $B!Y!M(B ;; ____$B!3!4(B $B!5!6(B $B!7"*(B $B!>!=(B $B"+(B__ $B"-!2(B $B",!1(B $B"*(B__ $B!+!,(B $B!F!H(B $B!@!B(B ;; ____ :-:-)$B!;!n(B $B"(!`(B $B!k"+(B $B!l"-(B $B!m".(B $B!E!e(B $B!D!f(B $B!&!g(B ;; ;;$B!VA[Dj$7$F$$$k(B ASCII $B%-!<%\!<%I$NG[Ns!W(B($BH>3Q!"A43QF~NO;~$b(B) ;; 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ `~ ;; qQ wW eE rR tT yY uU iI oO pP [{ ]} ;; aA sS dD fF gG hH jJ kK lL ;: '" \| ;; zZ xX cC vV bB nN mM ,< .> /? ;; ;; kanainput.el 1.1 -> 1.2: ;; o $B5-9fF~NO(B prefix $B$r(B "X" $B$+$i(B "S" $B$K$7$?!#(B ;; o $B0J2<$NF~NOJ}K!$r4JC1$K$9$k$?$aJQ99$7$?!#(B ;; $B!V$p!W(B "W4E" --> "WE" ;; $B!V$q!W(B "W4%" --> "W%" ;; $B!V%t!W(B "W4[" --> "W[" ;; o $B0J2<$NF~NO7k2L$rJQ99$7$?!#K\J*$N(B Quote $B$K$9$k$?$a!#(B ;; "Q\\" $B!V!o!W(B-->$B!V!@!W(B ;; "Q~" $B!V!1!W(B-->$B!V!A!W(B ;; o $B0J2<$N%k!<%k$rDI2C$7$?!#(B ;; "Sy" -->$B!V!o!W(B ;; "SJ" -->$B!V!2!W(B ;; "Sk" -->$B!V!1!W(B ;; o $B3F%k!<%k$K$D$$$F(B its-defrule $B$r=q$$$F$$$?$N$r!"(B ;; $B4JC1$N$?$aI=%Y!<%9$K$7$?!#(B ;; (its-define-mode "kanainput" "$B$+(B" t) (defvar k-zenkaku-escape "Q") ; $BA43QF~NO$N(B prefix (defvar k-hankaku-escape "A") ; $BH>3QF~NO$N(B prefix (defvar k-symbols-escape "S") ; $B5-9fF~NO$N(B prefix (defun its:make-terminal-state-kanainput (map input action state) (cond((its:standard-actionp action) (action-output action)) (t nil))) (let ((its:make-terminal-state 'its:make-terminal-state-kanainput)) ;; $B$+$JF~NOMQ(B (dolist (normal-pair '( ;; $B@62;(B ("3" "$B$"(B") ("e" "$B$$(B") ("4" "$B$&(B") ("5" "$B$((B") ("6" "$B$*(B") ("t" "$B$+(B") ("g" "$B$-(B") ("h" "$B$/(B") ("'" "$B$1(B") ("b" "$B$3(B") ("x" "$B$5(B") ("d" "$B$7(B") ("r" "$B$9(B") ("p" "$B$;(B") ("c" "$B$=(B") ("q" "$B$?(B") ("a" "$B$A(B") ("z" "$B$D(B") ("w" "$B$F(B") ("s" "$B$H(B") ("u" "$B$J(B") ("i" "$B$K(B") ("1" "$B$L(B") ("," "$B$M(B") ("k" "$B$N(B") ("f" "$B$O(B") ("v" "$B$R(B") ("2" "$B$U(B") ("=" "$B$X(B") ("-" "$B$[(B") ("j" "$B$^(B") ("n" "$B$_(B") ("\\" "$B$`(B") ("/" "$B$a(B") ("m" "$B$b(B") ("7" "$B$d(B") ("8" "$B$f(B") ("9" "$B$h(B") ("o" "$B$i(B") ("l" "$B$j(B") ("." "$B$k(B") (";" "$B$l(B") ("|" "$B$m(B") ("0" "$B$o(B") ("WE" "$B$p(B") ("W%" "$B$q(B") (")" "$B$r(B") ("y" "$B$s(B") ;; $BBy2;(B ("t[" "$B$,(B") ("g[" "$B$.(B") ("h[" "$B$0(B") ("'[" "$B$2(B") ("b[" "$B$4(B") ("x[" "$B$6(B") ("d[" "$B$8(B") ("r[" "$B$:(B") ("p[" "$B$<(B") ("c[" "$B$>(B") ("q[" "$B$@(B") ("a[" "$B$B(B") ("z[" "$B$E(B") ("w[" "$B$G(B") ("s[" "$B$I(B") ("f[" "$B$P(B") ("v[" "$B$S(B") ("2[" "$B$V(B") ("=[" "$B$Y(B") ("-[" "$B$\(B") ;; $BH>By2;(B ("f]" "$B$Q(B") ("v]" "$B$T(B") ("2]" "$B$W(B") ("=]" "$B$Z(B") ("-]" "$B$](B") ;; $B>.$5$J;z(B ("#" "$B$!(B") ("E" "$B$#(B") ("$" "$B$%(B") ("%" "$B$'(B") ("^" "$B$)(B") ("&" "$B$c(B") ("*" "$B$e(B") ("(" "$B$g(B") ("T" "$B%u(B") ("\"" "$B%v(B") ("Z" "$B$C(B") ("W0" "$B$n(B") ("W#" "$B$n(B") ;; $B$=$NB>(B ("W[" "$B%t(B") ("W" "$B$&(B") ;; $B5-9f(B ("<" "$B!"(B") (">" "$B!#(B") (":" "$B!&(B") ("?" "$B!)(B") ("{" "$B!V(B") ("}" "$B!W(B") ("[" "$B!+(B") ("]" "$B!,(B") ("`" "$B!<(B") ;; $B%7%U%H%-!<2!2<;~$N07$$(B ("G" "$B$-(B") ("H" "$B$/(B") ("B" "$B$3(B") ("X" "$B$5(B") ("D" "$B$7(B") ("R" "$B$9(B") ("P" "$B$;(B") ("C" "$B$=(B") ("U" "$B$J(B") ("I" "$B$K(B") ("K" "$B$N(B") ("F" "$B$O(B") ("V" "$B$R(B") ("J" "$B$^(B") ("N" "$B$_(B") ("M" "$B$b(B") ("O" "$B$i(B") ("L" "$B$j(B") ("Y" "$B$s(B") ("!" "$B!*(B") ("@" "$B!w(B") ("+" "$B!\(B") ("~" "$B!A(B") ("_" "$B$m(B");;; $B!V$m!W$,$"$k%-!<%\!<%IMQ(B )) (its-defrule (car normal-pair) (car (cdr normal-pair)))) ;; $BA43QF~NO(B (dolist (zenkaku-pair '( (" " "$B!!(B") ("!" "$B!*(B") ("\"" "$B!I(B") ("#" "$B!t(B") ; 20--24 ("$" "$B!p(B") ("%" "$B!s(B") ("&" "$B!u(B") ("'" "$B!G(B") ; 25--27 ("(" "$B!J(B") (")" "$B!K(B") ("*" "$B!v(B") ("+" "$B!\(B") ; 28--2b ("," "$B!$(B") ("-" "$B!](B") ("." "$B!%(B") ("/" "$B!?(B") ; 2c--2f ("0" "$B#0(B") ("1" "$B#1(B") ("2" "$B#2(B") ("3" "$B#3(B") ; 30--33 ("4" "$B#4(B") ("5" "$B#5(B") ("6" "$B#6(B") ("7" "$B#7(B") ; 34--37 ("8" "$B#8(B") ("9" "$B#9(B") (":" "$B!'(B") (";" "$B!((B") ; 38--3b ("<" "$B!c(B") ("=" "$B!a(B") (">" "$B!d(B") ("?" "$B!)(B") ; 3c--3f ("@" "$B!w(B") ("A" "$B#A(B") ("B" "$B#B(B") ("C" "$B#C(B") ; 40--43 ("D" "$B#D(B") ("E" "$B#E(B") ("F" "$B#F(B") ("G" "$B#G(B") ; 44--47 ("H" "$B#H(B") ("I" "$B#I(B") ("J" "$B#J(B") ("K" "$B#K(B") ; 48--4b ("L" "$B#L(B") ("M" "$B#M(B") ("N" "$B#N(B") ("O" "$B#O(B") ; 4c--4f ("P" "$B#P(B") ("Q" "$B#Q(B") ("R" "$B#R(B") ("S" "$B#S(B") ; 50--53 ("T" "$B#T(B") ("U" "$B#U(B") ("V" "$B#V(B") ("W" "$B#W(B") ; 54--57 ("X" "$B#X(B") ("Y" "$B#Y(B") ("Z" "$B#Z(B") ("[" "$B!N(B") ; 58--5a ("\\" "$B!@(B") ("]" "$B!O(B") ("^" "$B!0(B") ("_" "$B!2(B") ; 5b--5f ("`" "$B!.(B") ("a" "$B#a(B") ("b" "$B#b(B") ("c" "$B#c(B") ; 60--63 ("d" "$B#d(B") ("e" "$B#e(B") ("f" "$B#f(B") ("g" "$B#g(B") ; 64--67 ("h" "$B#h(B") ("i" "$B#i(B") ("j" "$B#j(B") ("k" "$B#k(B") ; 68--6b ("l" "$B#l(B") ("m" "$B#m(B") ("n" "$B#n(B") ("o" "$B#o(B") ; 6c--6f ("p" "$B#p(B") ("q" "$B#q(B") ("r" "$B#r(B") ("s" "$B#s(B") ; 70--73 ("t" "$B#t(B") ("u" "$B#u(B") ("v" "$B#v(B") ("w" "$B#w(B") ; 74--77 ("x" "$B#x(B") ("y" "$B#y(B") ("z" "$B#z(B") ("{" "$B!P(B") ; 78--7b ("|" "$B!C(B") ("}" "$B!Q(B") ("~" "$B!A(B") ; 7c--7e )) (its-defrule (concat k-zenkaku-escape (car zenkaku-pair)) (car (cdr zenkaku-pair)))) ;; $BH>3QF~NO(B (dolist (character '( "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" " " "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" "-" "=" "`" "\\" "|" "_" "+" "~" "[" "]" "{" "}" ":" ";" "\"" "'" "<" ">" "?" "/" "," "." "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" "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 k-hankaku-escape character) character)) ;;; proposal key bindings for JIS symbols ;;; 90.3.2 by jiro@math.keio.ac.jp (TANAKA Jiro) ;;; $B!V!o!W!"!V!1!W!"!V!2!W(B are added ;;; 94.2.4 by nori-d@is.aist-nara.ac.jp (DEMIZU Noritoshi) (dolist (symbols-pair '( ("1" "$B!{(B") ("2" "$B"&(B") ("3" "$B"$(B") ("4" "$B""(B") ("5" "$B!~(B") ("6" "$B!y(B") ("7" "$B!}(B") ("8" "$B!q(B") ("9" "$B!i(B") ("0" "$B!j(B") ("-" "$B!A(B") ("=" "$B!b(B") ("\\" "$B!@(B") ("`" "$B!-(B") ("!" "$B!|(B") ("@" "$B"'(B") ("#" "$B"%(B") ("$" "$B"#(B") ("%" "$B"!(B") ("^" "$B!z(B") ("&" "$B!r(B") ("*" "$B!_(B") ("(" "$B!Z(B") (")" "$B![(B") ("_" "$B!h(B") ("+" "$B!^(B") ("|" "$B!B(B") ("~" "$B!/(B") ("q" "$B!T(B") ("w" "$B!U(B") ("r" "$B!9(B") ("t" "$B!:(B") ("y" "$B!o(B") ("Q" "$B!R(B") ("W" "$B!S(B") ("R" "$B!8(B") ("T" "$B!x(B") ("p" "$B")(B") ("[" "$B!X(B") ("]" "$B!Y(B") ("P" "$B",(B") ("{" "$B!L(B") ("}" "$B!M(B") ("s" "$B!3(B") ("d" "$B!5(B") ("f" "$B!7(B") ("g" "$B!>(B") ("S" "$B!4(B") ("D" "$B!6(B") ("F" "$B"*(B") ("G" "$B!=(B") ("h" "$B"+(B") ("j" "$B"-(B") ("k" "$B",(B") ("l" "$B"*(B") ("J" "$B!2(B") ("K" "$B!1(B") (";" "$B!+(B") (":" "$B!,(B") ("\'" "$B!F(B") ("\"" "$B!H(B") ("x" ":-") ("c" "$B!;(B") ("v" "$B"((B") ("b" "$B!k(B") ("n" "$B!l(B") ("X" ":-)") ("C" "$B!n(B") ("V" "$B!`(B") ("B" "$B"+(B") ("N" "$B"-(B") ("m" "$B!m(B") ("," "$B!E(B") ("." "$B!D(B") ("/" "$B!&(B") ("M" "$B".(B") ("<" "$B!e(B") (">" "$B!f(B") ("?" "$B!g(B") )) (its-defrule (concat k-symbols-escape (car symbols-pair)) (car (cdr symbols-pair)))) ) wnn7egg-1.02.orig/elisp/xemacs21/its-v309/kata.el0100644000764400003210000004676007474174160021461 0ustar ishikawaishikawa;; Basic Roma-to-KataKana Translation Table for Egg ;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) ;; This file is part of Egg on Nemacs (Japanese Environment) ;; Egg is distributed in the forms of patches to GNU ;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC ;; LICENSE which is distributed along with GNU Emacs by the ;; Free Software Foundation. ;; Egg is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. See the GNU EMACS GENERAL PUBLIC LICENSE for ;; more details. ;; You should have received a copy of the GNU EMACS GENERAL ;; PUBLIC LICENSE along with Nemacs; see the file COPYING. ;; If not, write to the Free Software Foundation, 675 Mass ;; Ave, Cambridge, MA 02139, USA. ;; 90.3.2 modified for Nemacs Ver.3.3.1 ;; by jiro@math.keio.ac.jp (TANAKA Jiro) ;; proposal of keybinding for JIS symbols ;; 92.3.16 modified for Mule Ver.0.9.1 by K.Handa ;; 92.3.23 modified for Mule Ver.0.9.1 by K.Handa ;; defrule -> its-defrule, define-its-mode -> its-define-mode ;; 92.3.16 by K.Handa ;;(define-its-mode "roma-kata" " a$B%"(B" t) (its-define-mode "roma-kata" "$B%"(B" t) (dolist (aa '("k" "s" "t" "h" "y" "r" "w" "g" "z" "d" "b" "p" "c" "f" "j" "v")) (its-defrule (concat aa aa) "$B%C(B" aa)) (its-defrule "tch" "$B%C(B" "ch") (dolist (q1 '("b" "m" "p")) (its-defrule (concat "m" q1) "$B%s(B" q1)) (its-defrule "N" "$B%s(B") (defvar enable-double-n-syntax nil "*Enable \"nn\" input for \"$B%s(B\" ") (its-defrule-conditional "n" ((not enable-double-n-syntax) "$B%s(B") (t nil)) (its-defrule-conditional "nn" ( enable-double-n-syntax "$B%s(B") (t nil)) (its-defrule "n'" "$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") (its-defrule "ka" "$B%+(B") (its-defrule "ki" "$B%-(B") (its-defrule "ku" "$B%/(B") (its-defrule "ke" "$B%1(B") (its-defrule "ko" "$B%3(B") (its-defrule "kya" "$B%-%c(B") (its-defrule "kyu" "$B%-%e(B") (its-defrule "kye" "$B%-%'(B") (its-defrule "kyo" "$B%-%g(B") (its-defrule "sa" "$B%5(B") (its-defrule "si" "$B%7(B") (its-defrule "su" "$B%9(B") (its-defrule "se" "$B%;(B") (its-defrule "so" "$B%=(B") (its-defrule "sya" "$B%7%c(B") (its-defrule "syu" "$B%7%e(B") (its-defrule "sye" "$B%7%'(B") (its-defrule "syo" "$B%7%g(B") (its-defrule "sha" "$B%7%c(B") (its-defrule "shi" "$B%7(B") (its-defrule "shu" "$B%7%e(B") (its-defrule "she" "$B%7%'(B") (its-defrule "sho" "$B%7%g(B") (its-defrule "ta" "$B%?(B") (its-defrule "ti" "$B%A(B") (its-defrule "tu" "$B%D(B") (its-defrule "te" "$B%F(B") (its-defrule "to" "$B%H(B") (its-defrule "tya" "$B%A%c(B") (its-defrule "tyi" "$B%F%#(B") (its-defrule "tyu" "$B%A%e(B") (its-defrule "tye" "$B%A%'(B") (its-defrule "tyo" "$B%A%g(B") (its-defrule "tsu" "$B%D(B") (its-defrule "cha" "$B%A%c(B") (its-defrule "chi" "$B%A(B") (its-defrule "chu" "$B%A%e(B") (its-defrule "che" "$B%A%'(B") (its-defrule "cho" "$B%A%g(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 "ha" "$B%O(B") (its-defrule "hi" "$B%R(B") (its-defrule "hu" "$B%U(B") (its-defrule "he" "$B%X(B") (its-defrule "ho" "$B%[(B") (its-defrule "hya" "$B%R%c(B") (its-defrule "hyu" "$B%R%e(B") (its-defrule "hye" "$B%R%'(B") (its-defrule "hyo" "$B%R%g(B") (its-defrule "fa" "$B%U%!(B") (its-defrule "fi" "$B%U%#(B") (its-defrule "fu" "$B%U(B") (its-defrule "fe" "$B%U%'(B") (its-defrule "fo" "$B%U%)(B") (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 "ye" "$B%$%'(B") (its-defrule "yo" "$B%h(B") (its-defrule "ra" "$B%i(B") (its-defrule "ri" "$B%j(B") (its-defrule "ru" "$B%k(B") (its-defrule "re" "$B%l(B") (its-defrule "ro" "$B%m(B") (its-defrule "la" "$B%i(B") (its-defrule "li" "$B%j(B") (its-defrule "lu" "$B%k(B") (its-defrule "le" "$B%l(B") (its-defrule "lo" "$B%m(B") (its-defrule "rya" "$B%j%c(B") (its-defrule "ryu" "$B%j%e(B") (its-defrule "rye" "$B%j%'(B") (its-defrule "ryo" "$B%j%g(B") (its-defrule "lya" "$B%j%c(B") (its-defrule "lyu" "$B%j%e(B") (its-defrule "lye" "$B%j%'(B") (its-defrule "lyo" "$B%j%g(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 "ga" "$B%,(B") (its-defrule "gi" "$B%.(B") (its-defrule "gu" "$B%0(B") (its-defrule "ge" "$B%2(B") (its-defrule "go" "$B%4(B") (its-defrule "gya" "$B%.%c(B") (its-defrule "gyu" "$B%.%e(B") (its-defrule "gye" "$B%.%'(B") (its-defrule "gyo" "$B%.%g(B") (its-defrule "za" "$B%6(B") (its-defrule "zi" "$B%8(B") (its-defrule "zu" "$B%:(B") (its-defrule "ze" "$B%<(B") (its-defrule "zo" "$B%>(B") (its-defrule "zya" "$B%8%c(B") (its-defrule "zyu" "$B%8%e(B") (its-defrule "zye" "$B%8%'(B") (its-defrule "zyo" "$B%8%g(B") (its-defrule "ja" "$B%8%c(B") (its-defrule "ji" "$B%8(B") (its-defrule "ju" "$B%8%e(B") (its-defrule "je" "$B%8%'(B") (its-defrule "jo" "$B%8%g(B") (its-defrule "da" "$B%@(B") (its-defrule "di" "$B%B(B") (its-defrule "du" "$B%E(B") (its-defrule "de" "$B%G(B") (its-defrule "do" "$B%I(B") (its-defrule "dya" "$B%B%c(B") (its-defrule "dyi" "$B%G%#(B") (its-defrule "dyu" "$B%B%e(B") (its-defrule "dye" "$B%B%'(B") (its-defrule "dyo" "$B%B%g(B") (its-defrule "ba" "$B%P(B") (its-defrule "bi" "$B%S(B") (its-defrule "bu" "$B%V(B") (its-defrule "be" "$B%Y(B") (its-defrule "bo" "$B%\(B") (its-defrule "va" "$B%t%!(B") (its-defrule "vi" "$B%t%#(B") (its-defrule "vu" "$B%t(B") (its-defrule "ve" "$B%t%'(B") (its-defrule "vo" "$B%t%)(B") (its-defrule "bya" "$B%S%c(B") (its-defrule "byu" "$B%S%e(B") (its-defrule "bye" "$B%S%'(B") (its-defrule "byo" "$B%S%g(B") (its-defrule "pa" "$B%Q(B") (its-defrule "pi" "$B%T(B") (its-defrule "pu" "$B%W(B") (its-defrule "pe" "$B%Z(B") (its-defrule "po" "$B%](B") (its-defrule "pya" "$B%T%c(B") (its-defrule "pyu" "$B%T%e(B") (its-defrule "pye" "$B%T%'(B") (its-defrule "pyo" "$B%T%g(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 "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 "xwa" "$B%n(B") (its-defrule "xwi" "$B%&%#(B") (its-defrule "xwe" "$B%&%'(B") (its-defrule "xwo" "$B%&%)(B") ;;; Zenkaku Symbols (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!*(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!<(B") ;;; JIS 213c ;;;(its-defrule "-" "$B!](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!1(B") (its-defrule "[" "$B!V(B") ;;(its-defrule "[" "$B!N(B") (its-defrule "]" "$B!W(B") ;;(its-defrule "]" "$B!O(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") (defvar use-kuten-for-period t "*$B%T%j%*%I$r6gE@$KJQ49$9$k(B") (defvar use-touten-for-comma t "*$B%3%s%^$rFIE@$KJQ49$9$k(B") (its-defrule-conditional "." (use-kuten-for-period "$B!#(B") (t "$B!%(B")) (its-defrule-conditional "," (use-touten-for-comma "$B!"(B") (t "$B!$(B")) ;;; Escape character to Zenkaku inputs (defvar zenkaku-escape "Z") ;;; Escape character to Hankaku inputs (defvar hankaku-escape "~") ;;; ;;; Zenkaku inputs ;;; (its-defrule (concat zenkaku-escape "0") "$B#0(B") (its-defrule (concat zenkaku-escape "1") "$B#1(B") (its-defrule (concat zenkaku-escape "2") "$B#2(B") (its-defrule (concat zenkaku-escape "3") "$B#3(B") (its-defrule (concat zenkaku-escape "4") "$B#4(B") (its-defrule (concat zenkaku-escape "5") "$B#5(B") (its-defrule (concat zenkaku-escape "6") "$B#6(B") (its-defrule (concat zenkaku-escape "7") "$B#7(B") (its-defrule (concat zenkaku-escape "8") "$B#8(B") (its-defrule (concat zenkaku-escape "9") "$B#9(B") (its-defrule (concat zenkaku-escape "A") "$B#A(B") (its-defrule (concat zenkaku-escape "B") "$B#B(B") (its-defrule (concat zenkaku-escape "C") "$B#C(B") (its-defrule (concat zenkaku-escape "D") "$B#D(B") (its-defrule (concat zenkaku-escape "E") "$B#E(B") (its-defrule (concat zenkaku-escape "F") "$B#F(B") (its-defrule (concat zenkaku-escape "G") "$B#G(B") (its-defrule (concat zenkaku-escape "H") "$B#H(B") (its-defrule (concat zenkaku-escape "I") "$B#I(B") (its-defrule (concat zenkaku-escape "J") "$B#J(B") (its-defrule (concat zenkaku-escape "K") "$B#K(B") (its-defrule (concat zenkaku-escape "L") "$B#L(B") (its-defrule (concat zenkaku-escape "M") "$B#M(B") (its-defrule (concat zenkaku-escape "N") "$B#N(B") (its-defrule (concat zenkaku-escape "O") "$B#O(B") (its-defrule (concat zenkaku-escape "P") "$B#P(B") (its-defrule (concat zenkaku-escape "Q") "$B#Q(B") (its-defrule (concat zenkaku-escape "R") "$B#R(B") (its-defrule (concat zenkaku-escape "S") "$B#S(B") (its-defrule (concat zenkaku-escape "T") "$B#T(B") (its-defrule (concat zenkaku-escape "U") "$B#U(B") (its-defrule (concat zenkaku-escape "V") "$B#V(B") (its-defrule (concat zenkaku-escape "W") "$B#W(B") (its-defrule (concat zenkaku-escape "X") "$B#X(B") (its-defrule (concat zenkaku-escape "Y") "$B#Y(B") (its-defrule (concat zenkaku-escape "Z") "$B#Z(B") (its-defrule (concat zenkaku-escape "a") "$B#a(B") (its-defrule (concat zenkaku-escape "b") "$B#b(B") (its-defrule (concat zenkaku-escape "c") "$B#c(B") (its-defrule (concat zenkaku-escape "d") "$B#d(B") (its-defrule (concat zenkaku-escape "e") "$B#e(B") (its-defrule (concat zenkaku-escape "f") "$B#f(B") (its-defrule (concat zenkaku-escape "g") "$B#g(B") (its-defrule (concat zenkaku-escape "h") "$B#h(B") (its-defrule (concat zenkaku-escape "i") "$B#i(B") (its-defrule (concat zenkaku-escape "j") "$B#j(B") (its-defrule (concat zenkaku-escape "k") "$B#k(B") (its-defrule (concat zenkaku-escape "l") "$B#l(B") (its-defrule (concat zenkaku-escape "m") "$B#m(B") (its-defrule (concat zenkaku-escape "n") "$B#n(B") (its-defrule (concat zenkaku-escape "o") "$B#o(B") (its-defrule (concat zenkaku-escape "p") "$B#p(B") (its-defrule (concat zenkaku-escape "q") "$B#q(B") (its-defrule (concat zenkaku-escape "r") "$B#r(B") (its-defrule (concat zenkaku-escape "s") "$B#s(B") (its-defrule (concat zenkaku-escape "t") "$B#t(B") (its-defrule (concat zenkaku-escape "u") "$B#u(B") (its-defrule (concat zenkaku-escape "v") "$B#v(B") (its-defrule (concat zenkaku-escape "w") "$B#w(B") (its-defrule (concat zenkaku-escape "x") "$B#x(B") (its-defrule (concat zenkaku-escape "y") "$B#y(B") (its-defrule (concat zenkaku-escape "z") "$B#z(B") (its-defrule (concat zenkaku-escape " ") "$B!!(B") (its-defrule (concat zenkaku-escape "!") "$B!*(B") (its-defrule (concat zenkaku-escape "@") "$B!w(B") (its-defrule (concat zenkaku-escape "#") "$B!t(B") (its-defrule (concat zenkaku-escape "$") "$B!p(B") (its-defrule (concat zenkaku-escape "%") "$B!s(B") (its-defrule (concat zenkaku-escape "^") "$B!0(B") (its-defrule (concat zenkaku-escape "&") "$B!u(B") (its-defrule (concat zenkaku-escape "*") "$B!v(B") (its-defrule (concat zenkaku-escape "(") "$B!J(B") (its-defrule (concat zenkaku-escape ")") "$B!K(B") (its-defrule (concat zenkaku-escape "-") "$B!](B") (its-defrule (concat zenkaku-escape "=") "$B!a(B") (its-defrule (concat zenkaku-escape "`") "$B!.(B") (its-defrule (concat zenkaku-escape "\\") "$B!o(B") (its-defrule (concat zenkaku-escape "|") "$B!C(B") (its-defrule (concat zenkaku-escape "_") "$B!2(B") (its-defrule (concat zenkaku-escape "+") "$B!\(B") (its-defrule (concat zenkaku-escape "~") "$B!1(B") (its-defrule (concat zenkaku-escape "[") "$B!N(B") (its-defrule (concat zenkaku-escape "]") "$B!O(B") (its-defrule (concat zenkaku-escape "{") "$B!P(B") (its-defrule (concat zenkaku-escape "}") "$B!Q(B") (its-defrule (concat zenkaku-escape ":") "$B!'(B") (its-defrule (concat zenkaku-escape ";") "$B!((B") (its-defrule (concat zenkaku-escape "\"") "$B!I(B") (its-defrule (concat zenkaku-escape "'") "$B!G(B") (its-defrule (concat zenkaku-escape "<") "$B!c(B") (its-defrule (concat zenkaku-escape ">") "$B!d(B") (its-defrule (concat zenkaku-escape "?") "$B!)(B") (its-defrule (concat zenkaku-escape "/") "$B!?(B") (its-defrule (concat zenkaku-escape ",") "$B!$(B") (its-defrule (concat zenkaku-escape ".") "$B!%(B") ;;; ;;; Hankaku inputs ;;; ;;(defvar escd '("-" "," "." "/" ";" ":" "[" "\\" "]" "^" "~")) ;;(its-defrule '("x" escd) '(escd)) (defvar digit-characters '( "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" )) (defvar symbol-characters '( " " "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" "-" "=" "`" "\\" "|" "_" "+" "~" "[" "]" "{" "}" ":" ";" "\"" "'" "<" ">" "?" "/" "," "." )) (defvar downcase-alphabets '("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")) (defvar upcase-alphabets '("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")) (dolist (digit digit-characters) (its-defrule (concat hankaku-escape digit) digit)) (dolist (symbol symbol-characters) (its-defrule (concat hankaku-escape symbol) symbol)) (dolist (downcase downcase-alphabets) (its-defrule (concat hankaku-escape downcase) downcase)) (dolist (upcase upcase-alphabets) (its-defrule (concat hankaku-escape upcase) upcase)) ;;; proposal key bindings for JIS symbols ;;; 90.3.2 by jiro@math.keio.ac.jp (TANAKA Jiro) (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") ; z- (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") ; zr (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") ; zp (its-defrule "z[" "$B!X(B") (its-defrule "z{" "$B!L(B") ; z[ (its-defrule "z]" "$B!Y(B") (its-defrule "z}" "$B!M(B") ; z] ; 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") ; zc (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") ; z. (its-defrule "z/" "$B!&(B") (its-defrule "z?" "$B!g(B") ; z/ ;;; Commented out by K.Handa. Already defined in a different way. ;(its-defrule "va" "$B%t%!(B") ;(its-defrule "vi" "$B%t%#(B") ;(its-defrule "vu" "$B%t(B") ;(its-defrule "ve" "$B%t%'(B") ;(its-defrule "vo" "$B%t%)(B") wnn7egg-1.02.orig/elisp/xemacs21/its-v309/zenkaku.el0100644000764400003210000001547007474174160022203 0ustar ishikawaishikawa;; Basic Roma-to-Kana Translation Table for Egg ;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) ;; This file is part of Egg on Nemacs (Japanese Environment) ;; Egg is distributed in the forms of patches to GNU ;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC ;; LICENSE which is distributed along with GNU Emacs by the ;; Free Software Foundation. ;; Egg is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. See the GNU EMACS GENERAL PUBLIC LICENSE for ;; more details. ;; You should have received a copy of the GNU EMACS GENERAL ;; PUBLIC LICENSE along with Nemacs; see the file COPYING. ;; If not, write to the Free Software Foundation, 675 Mass ;; Ave, Cambridge, MA 02139, USA. ;; 92.3.16 modified for Mule Ver.0.9.1 by K.Handa ;; 92.3.23 modified for Mule Ver.0.9.1 by K.Handa ;; defrule -> its-defrule, define-its-mode -> its-define-mode ;;; 92.12.31 modified for Mule Ver.0.9.7.1 ;;; by A.Tanaka ;;; Mode indicator of "zenkaku-upcase" fixed. ;; 92.3.16 by K.Handa ;;(define-its-mode "zenkaku-downcase" " a$B#a(B" t) (its-define-mode "zenkaku-downcase" "$B#a(B" t) (its-defrule "0" "$B#0(B") (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 "A" "$B#A(B") (its-defrule "B" "$B#B(B") (its-defrule "C" "$B#C(B") (its-defrule "D" "$B#D(B") (its-defrule "E" "$B#E(B") (its-defrule "F" "$B#F(B") (its-defrule "G" "$B#G(B") (its-defrule "H" "$B#H(B") (its-defrule "I" "$B#I(B") (its-defrule "J" "$B#J(B") (its-defrule "K" "$B#K(B") (its-defrule "L" "$B#L(B") (its-defrule "M" "$B#M(B") (its-defrule "N" "$B#N(B") (its-defrule "O" "$B#O(B") (its-defrule "P" "$B#P(B") (its-defrule "Q" "$B#Q(B") (its-defrule "R" "$B#R(B") (its-defrule "S" "$B#S(B") (its-defrule "T" "$B#T(B") (its-defrule "U" "$B#U(B") (its-defrule "V" "$B#V(B") (its-defrule "W" "$B#W(B") (its-defrule "X" "$B#X(B") (its-defrule "Y" "$B#Y(B") (its-defrule "Z" "$B#Z(B") (its-defrule "a" "$B#a(B") (its-defrule "b" "$B#b(B") (its-defrule "c" "$B#c(B") (its-defrule "d" "$B#d(B") (its-defrule "e" "$B#e(B") (its-defrule "f" "$B#f(B") (its-defrule "g" "$B#g(B") (its-defrule "h" "$B#h(B") (its-defrule "i" "$B#i(B") (its-defrule "j" "$B#j(B") (its-defrule "k" "$B#k(B") (its-defrule "l" "$B#l(B") (its-defrule "m" "$B#m(B") (its-defrule "n" "$B#n(B") (its-defrule "o" "$B#o(B") (its-defrule "p" "$B#p(B") (its-defrule "q" "$B#q(B") (its-defrule "r" "$B#r(B") (its-defrule "s" "$B#s(B") (its-defrule "t" "$B#t(B") (its-defrule "u" "$B#u(B") (its-defrule "v" "$B#v(B") (its-defrule "w" "$B#w(B") (its-defrule "x" "$B#x(B") (its-defrule "y" "$B#y(B") (its-defrule "z" "$B#z(B") (its-defrule " " "$B!!(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!](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!1(B") (its-defrule "[" "$B!N(B") (its-defrule "]" "$B!O(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") (its-defrule "," "$B!$(B") (its-defrule "." "$B!%(B") ;;; ;;; ;;; (its-define-mode "zenkaku-upcase" "$B#A(B" t) ;92.12.31 by A.Tanaka (its-defrule "0" "$B#0(B") (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 "A" "$B#A(B") (its-defrule "B" "$B#B(B") (its-defrule "C" "$B#C(B") (its-defrule "D" "$B#D(B") (its-defrule "E" "$B#E(B") (its-defrule "F" "$B#F(B") (its-defrule "G" "$B#G(B") (its-defrule "H" "$B#H(B") (its-defrule "I" "$B#I(B") (its-defrule "J" "$B#J(B") (its-defrule "K" "$B#K(B") (its-defrule "L" "$B#L(B") (its-defrule "M" "$B#M(B") (its-defrule "N" "$B#N(B") (its-defrule "O" "$B#O(B") (its-defrule "P" "$B#P(B") (its-defrule "Q" "$B#Q(B") (its-defrule "R" "$B#R(B") (its-defrule "S" "$B#S(B") (its-defrule "T" "$B#T(B") (its-defrule "U" "$B#U(B") (its-defrule "V" "$B#V(B") (its-defrule "W" "$B#W(B") (its-defrule "X" "$B#X(B") (its-defrule "Y" "$B#Y(B") (its-defrule "Z" "$B#Z(B") (its-defrule "a" "$B#A(B") (its-defrule "b" "$B#B(B") (its-defrule "c" "$B#C(B") (its-defrule "d" "$B#D(B") (its-defrule "e" "$B#E(B") (its-defrule "f" "$B#F(B") (its-defrule "g" "$B#G(B") (its-defrule "h" "$B#H(B") (its-defrule "i" "$B#I(B") (its-defrule "j" "$B#J(B") (its-defrule "k" "$B#K(B") (its-defrule "l" "$B#L(B") (its-defrule "m" "$B#M(B") (its-defrule "n" "$B#N(B") (its-defrule "o" "$B#O(B") (its-defrule "p" "$B#P(B") (its-defrule "q" "$B#Q(B") (its-defrule "r" "$B#R(B") (its-defrule "s" "$B#S(B") (its-defrule "t" "$B#T(B") (its-defrule "u" "$B#U(B") (its-defrule "v" "$B#V(B") (its-defrule "w" "$B#W(B") (its-defrule "x" "$B#X(B") (its-defrule "y" "$B#Y(B") (its-defrule "z" "$B#Z(B") (its-defrule " " "$B!!(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!](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!1(B") (its-defrule "[" "$B!N(B") (its-defrule "]" "$B!O(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") (its-defrule "," "$B!$(B") (its-defrule "." "$B!%(B") wnn7egg-1.02.orig/elisp/xemacs21/wnn7egg-cnv.el0100644000764400003210000023000307474174160021364 0ustar ishikawaishikawa;; Wnn7Egg is Egg modified for Wnn7, and the current maintainer ;; is OMRON SOFTWARE Co., Ltd. ;; ;; This file is part of Wnn7Egg. (base code is wnn-egg.el (eggV3.09)) ;; ;;; ------------------------------------------------------------------ ;;; ;;; Wnn7Egg $B!J(BWnn "$B$J$J(B"$B$?$^$4!K(B--- Wnn7 Emacs Client ;;; ;;; Wnn7Egg $B$O!"!V$?$^$4Bh#3HG!W(Bv3.09 $B$r%Y!<%9$K(B $B!V$?$^$4Bh#4HG!W$NDL?.!"(B ;;; $B%i%$%V%i%jIt$rAH$_9~$s$@!"(BWnn7 $B$N0Y$N@lMQ%/%i%$%"%s%H$G$9!#(B ;;; ;;; $B$9$Y$F$N%=!<%9$,(B Emacs Lisp $B$G5-=R$5$l$F$$$k$N$G!"(BWnn SDK/Library $B$rI,MW(B ;;; $B$H$;$:!"(BGNU Emacs $B5Z$S(B XEmacs $B4D6-$G;HMQ$9$k$3$H$,$G$-$^$9!#;HMQ5vBz>r7o(B ;;; $B$O(B GPL $B$G$9!#(B ;;; ;;; GNU Emacs 20.3 $B0J9_!"(BXEmacs 21.x $B0J9_$GF0:n3NG'$7$F$$$^$9!#(B ;;; ;;; ;;; Wnn7Egg $B$O(B Wnn7 $B$N5!G=$G$"$k3Z!9F~NO!JF~NOM=B,!K!"O"A[JQ49$r%5%]!<%H(B ;;; $B$7$F$$$^$9!#(B ;;; ;;; $B!V$?$^$4!W$HFHN)!?6&B8$G$-$k$h$&$K!"1F6A$9$k$r(B ;;; "wnn7..." $B$H$$$&7A$KJQ99$7$F$$$^$9!#(B ;;; ;;; ------------------------------------------------------------------ ;;; wnn-egg.el --- a inputting method communicating with [jck]server ;; Author: Satoru Tomura (tomura@etl.go.jp), and ;; Toshiaki Shingu (shingu@cpr.canon.co.jp) ;; Keywords: inputting method ;; This file is part of Egg on Mule (Multilingual Environment) ;; Egg is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; Egg is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the Free ;; Software Foundation Inc., 59 Temple Place - Suite 330, Boston, ;; MA 02111-1307, USA. ;;; Commentary: ;;; Modified for Wnn V4 and Wnn6 by Satoru Tomura(tomura@etl.go.jp) ;;; Modified for Wnn6 by OMRON ;;; Written by Toshiaki Shingu (shingu@cpr.canon.co.jp) ;;; Modified for Wnn V4 library on wnn4v3-egg.el ;;; $B$?$^$4!V$?$+$J!W%P!<%8%g%s(B ;;; $B!V$?$+$J!W$H$ODR$1J*$N$?$+$J$G$O$"$j$^$;$s!#(B ;;; $B!V$?$^$4$h!?$+$7$3$/!?$J!$7$^$7$?!#(B ;;; Wnn V4 $B$N(B jl $B%i%$%V%i%j$r;H$$$^$9!#(B ;;; $B%i%$%V%i%j$H$N%$%s%?!<%U%'!<%9$O(B wnnfns.c $B$GDj5A$5$l$F$$$^$9!#(B ;;; $B=$@5%a%b(B ;;; 02/5/16 $B>.J8;z$R$i$,$J!J$!$#$%!K$NJQ498e$N(B M-k, M-h $BF0:n$N=$@5(B ;;; 02/5/16 skip-wnn-setenv-if-env-exist $B$r(B t $B$KJQ99(B ;;; 01/9/30 bug fix by OMRON SOFTWARE Co.,Ltd. ;;; 94/2/3 kWnn support by H.Kuribayashi ;;; 93/11/24 henkan-select-kouho: bug fixed ;;; 93/7/22 hinsi-from-menu updated ;;; 93/5/12 remove-regexp-in-string ;;; fixed by Shuji NARAZAKI ;;; 93/4/22 set-wnn-host-name, set-cwnn-host-name ;;; 93/4/5 EGG:open-wnn, close-wnn modified by tsuiki. ;;; 93/4/2 wnn-param-set ;;; 93/4/2 modified along with wnn4fns.c ;;; 93/3/3 edit-dict-item: bug fixed ;;; 93/1/8 henkan-help-command modified. ;;; 92/12/1 buffer local 'wnn-server-type' and 'cwnn-zhuyin' ;;; so as to support individual its mode with multiple buffers. ;;; 92/11/26 set-cserver-host-name fixed. ;;; 92/11/26 its:{previous,next}-mode by ;;; 92/11/25 set-wnn-host-name was changed to set-{j,c}server-host-name. ;;; 92/11/25 redefined its:select-mode and its:select-mode-from-menu ;;; defined in egg.el to run hook with its mode selection. ;;; 92/11/20 bug fixed related to henkan mode attribute. ;;; 92/11/12 get-wnn-host-name and set-wnn-host-name were changed. ;;; 92/11/10 (set-dict-comment) bug fixed ;;; 92/10/27 (henkan-region-internal) display message if error occurs. ;;; 92/9/28 completely modified for chinese trandlation. ;;; 92/9/28 diced-{use,hindo-set} bug fixed ;;; 92/9/22 touroku-henkan-mode by ;;; 92/9/18 rewrite wnn-dict-add to support password files. ;;; 92/9/8 henkan-region-internal was modified. ;;; 92/9/8 henkan-mode-map " " 'henkan-next-kouho-dai -> 'henkan-next-kouho ;;; 92/9/7 henkan-mode-map "\C-h" 'help-command -> 'henkan-help-command (Shuji Narazaki) ;;; 92/9/3 wnn-server-get-msg without wnn-error-code. ;;; 92/9/3 get-wnn-lang-name was modified. ;;; 92/8/19 get-wnn-lang-name $B$NJQ99(B (by T.Matsuzawa) ;;; 92/8/5 Bug in henkan-kakutei-first-char fixed. (by Y.Kasai) ;;; 92/7/17 set-egg-henkan-format $B$NJQ99(B ;;; 92/7/17 egg:error $B$N0z?t$r(B format &rest args $B$KJQ99(B ;;; 92/7/17 henkan/gyaku-henkan-word $B$N=$@5(B ;;; 92/7/17 henkan/gyaku-henkan-paragraph/sentence/word $B$G!"(B ;;; $BI=<($,Mp$l$k$N$r=$@5!J(Bsave-excursion $B$r$O$:$9!K(B ;;; 92.7.14 Unnecessary '*' in comments of variables deleted. (by T.Ito) ;;; 92/7/10 henkan-kakutei-first-char $B$rDI2C!"(BC-@ $B$K3d$jEv$F!#(B(by K.Handa) ;;; 92/7/8 overwrite-mode $B$N%5%]!<%H(B(by K. Handa) ;;; 92/6/30 startup file $B<~$j$NJQ99(B ;;; 92/6/30 $BJQ49%b!<%I$N%"%H%j%S%e!<%H$K(B bold $B$rDI2C(B ;;; (by ITO Toshiyuki ) ;;; 92/6/22 $B6uJ8;zNs$rJQ49$9$k$HMn$A$k%P%0$r=$@5(B ;;; 92/5/20 set-egg-henkan-mode-format $B$N(B bug fix ;;; 92/5/20 egg:set-bunsetu-attribute $B$,BgJ8@a$G@5$7$/F0$/$h$&$KJQ99(B ;;; 92/5/19 version 0 ;;; ---------------------------------------------------------------- ;;; Code: ;;; Last modified date: 2002/5/16 ;;; wnn7egg-cnv.el version 1.02 (require 'wnn7egg-lib) (defvar egg:*sho-bunsetu-face* nil "*$B>.J8@aI=<($KMQ$$$k(B face $B$^$?$O(B nil") (defvar egg:*sho-bunsetu-kugiri* "-" "*$B>.J8@a$N6h@Z$j$r<($9J8;zNs(B") (defvar egg:*dai-bunsetu-face* nil "*$BBgJ8@aI=<($KMQ$$$k(B face $B$^$?$O(B nil") (defvar egg:*dai-bunsetu-kugiri* " " "*$BBgJ8@a$N6h@Z$j$r<($9J8;zNs(B") (defvar egg:*henkan-face* nil "*$BJQ49NN0h$rI=<($9$k(B face $B$^$?$O(B nil") (if (featurep 'xemacs) (progn (make-variable-buffer-local (defvar egg:*sho-bunsetu-extent* nil "$B>.J8@a$NI=<($K;H$&(B extent")) (make-variable-buffer-local (defvar egg:*dai-bunsetu-extent* nil "$BBgJ8@a$NI=<($K;H$&(B extent")) (make-variable-buffer-local (defvar egg:*henkan-extent* nil "$BJQ49NN0h$NI=<($K;H$&(B extent"))) (make-variable-buffer-local (defvar egg:*sho-bunsetu-overlay* nil "$B>.J8@a$NI=<($K;H$&(B overlay")) (make-variable-buffer-local (defvar egg:*dai-bunsetu-overlay* nil "$BBgJ8@a$NI=<($K;H$&(B overlay")) (make-variable-buffer-local (defvar egg:*henkan-overlay* nil "$BJQ49NN0h$NI=<($K;H$&(B overlay"))) (defvar egg:*henkan-open* "|" "*$BJQ49$N;OE@$r<($9J8;zNs(B") (defvar egg:*henkan-close* "|" "*$BJQ49$N=*E@$r<($9J8;zNs(B") (make-variable-buffer-local (defvar wnn7-henkan-mode-in-use nil "buffer $B$,JQ49Cf$N;~(B t")) ;;; ---------------------------------------------------------------- ;;; $B0J2<$N(B its mode $B4X78$N4X?t$O!"(Begg.el $B$GDj5A$5$l$F$$$k$,!"(B ;;; $B$?$+$J$G$O(B its mode $B$N@ZBX$($KF14|$7$F!"(Bjserver/cserver, ;;; pinyin/zhuyin $B$N@ZBX$($b9T$J$$$?$$$N$G!":FDj5A$7$F$$$k!#(B ;;; $B=>$C$F!"(Begg.el, wnn-egg.el $B$N=g$K%m!<%I$7$J$1$l$P$J$i$J$$!#(B (defun its:select-mode (name) (interactive (list (completing-read "ITS mode: " its:*mode-alist*))) (if (its:get-mode-map name) (progn (setq its:*current-map* (its:get-mode-map name)) (egg:mode-line-display) (run-hooks 'its:select-mode-hook)) (beep))) (defun its:select-mode-from-menu () (interactive) (setcar (nthcdr 2 its:*select-mode-menu*) its:*mode-alist*) (setq its:*current-map* (menu:select-from-menu its:*select-mode-menu*)) (egg:mode-line-display) (run-hooks 'its:select-mode-hook)) (defvar its:select-mode-hook nil) (defun its:next-mode () (interactive) (let ((pos (its:find its:*current-map* its:*standard-modes*))) (setq its:*current-map* (nth (% (1+ pos) (length its:*standard-modes*)) its:*standard-modes*)) (egg:mode-line-display) (run-hooks 'its:select-mode-hook))) (defun its:previous-mode () (interactive) (let ((pos (its:find its:*current-map* its:*standard-modes*))) (setq its:*current-map* (nth (1- (if (= pos 0) (length its:*standard-modes*) pos)) its:*standard-modes*)) (egg:mode-line-display) (run-hooks 'its:select-mode-hook))) (defun read-current-its-string (prompt &optional initial-input henkan) (let ((egg:fence-buffer (window-buffer (minibuffer-window))) (old-its-map its:*current-map*)) (save-excursion (set-buffer egg:fence-buffer) (setq egg:*input-mode* t egg:*mode-on* t its:*current-map* old-its-map) (mode-line-egg-mode-update (nth 1 (its:get-mode-indicator its:*current-map*))) (read-from-minibuffer prompt initial-input (if henkan nil egg:*minibuffer-local-hiragana-map*))))) ;;;---------------------------------------------------------------------- ;;; ;;; Kana Kanji Henkan ;;; ;;;---------------------------------------------------------------------- (defvar wnn7-server-list nil "Wnn7 jserver host list") (defvar wnn7-server-name nil "Wnn7 jserver host name") (defvar egg:*sai-henkan-start* nil) (defvar egg:*sai-henkan-end* nil) (defvar egg:*old-bunsetu-suu* nil) (add-hook 'kill-emacs-hook 'close-wnn7) ;;; ;;; Entry functions for egg-startup-file ;;; (defvar skip-wnn-setenv-if-env-exist t "skip wnn environment setting when the same name environment exists") (defmacro push-end (val loc) (list 'push-end-internal val (list 'quote loc))) (defun push-end-internal (val loc) (set loc (if (eval loc) (nconc (eval loc) (cons val nil)) (cons val nil)))) ;; ;; for parameter operation ;; (defun wnn7-set-reverse (arg) (wnn7-server-set-rev arg)) (defun wnn7-set-param (&rest param) "based upon set-wnn-param" (interactive) (let ((current-param (append (wnn7-server-get-param) nil)) (new-param) (message (wnn7-msg-get 'param))) (while current-param (setq new-param (cons (if (or (null param) (null (car param))) (string-to-int (read-from-minibuffer (concat (car message) ": ") (int-to-string (car current-param)))) (car param)) new-param)) (setq current-param (cdr current-param) message (cdr message) param (if param (cdr param) nil))) (wnn7-server-set-param (vconcat (nreverse new-param))))) (defun wnn7-add-dict (dfile hfile priority dmode hmode &optional dpaswd hpaswd) "based upon add-wnn-dict" (wnn7-server-dict-add (substitute-in-file-name dfile) (substitute-in-file-name hfile) priority dmode hmode dpaswd hpaswd)) (defun wnn7-set-fuzokugo (ffile) "based upon set-wnn-fuzokugo" (wnn7-server-fuzokugo-set (substitute-in-file-name ffile))) (defun wnn7-add-fisys-dict (dfile hfile hmode &optional hpaswd) "based upon add-wnn-fisys-dict" (wnn7-server-fisys-dict-add (substitute-in-file-name dfile) (substitute-in-file-name hfile) hmode hpaswd)) (defun wnn7-add-fiusr-dict (dfile hfile dmode hmode &optional dpaswd hpaswd) "based upon add-wnn-fiusr-dict" (wnn7-server-fiusr-dict-add (substitute-in-file-name dfile) (substitute-in-file-name hfile) dmode hmode dpaswd hpaswd)) (defun wnn7-add-notrans-dict (dfile priority dmode &optional dpaswd) "based upon add-wnn-notrans-dict" (wnn7-server-notrans-dict-add (substitute-in-file-name dfile) priority dmode dpaswd)) (defun wnn7-add-bmodify-dict (dfile priority dmode &optional dpaswd) "based upon add-wnn7-bmodify-dict" (wnn7-server-bmodify-dict-add (substitute-in-file-name dfile) priority dmode dpaswd)) (defun wnn7-set-last-is-first-mode (mode) "based upon set-last-is-first-mode" (let ((result (wnn7-server-set-last-is-first mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-complex-conv-mode (mode) "based upon set-complex-conv-mode" (let ((result (wnn7-server-set-complex-conv-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-okuri-learn-mode (mode) "based upon set-okuri-learn-mode" (let ((result (wnn7-server-set-okuri-learn-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-okuri-flag (mode) "based upon set-okuri-flag" (let ((result (wnn7-server-set-okuri-flag mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-prefix-learn-mode (mode) "based upon set-prefix-learn-mode" (let ((result (wnn7-server-set-prefix-learn-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-prefix-flag (mode) "based upon set-prefix-flag" (let ((result (wnn7-server-set-prefix-flag mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-suffix-learn-mode (mode) "based upon set-suffix-learn-mode" (let ((result (wnn7-server-set-suffix-learn-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-common-learn-mode (mode) "based upon set-common-learn-mode" (let ((result (wnn7-server-set-common-learn-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-freq-func-mode (mode) "based upon set-freq-func-mode" (let ((result (wnn7-server-set-freq-func-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-numeric-mode (mode) "based upon set-numeric-mode" (let ((result (wnn7-server-set-numeric-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-alphabet-mode (mode) "based upon set-alphabet-mode" (let ((result (wnn7-server-set-alphabet-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-symbol-mode (mode) "based upon set-symbol-mode" (let ((result (wnn7-server-set-symbol-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-yuragi-mode (mode) "based upon set-yuragi-mode" (let ((result (wnn7-server-set-yuragi-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-rendaku-mode (mode) "based upon set-rendaku-mode" (let ((result (wnn7-server-set-rendaku-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-yosoku-learn (mode) (let ((result (wnn7-server-set-yosoku-learn-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-yosoku-max-disp (max) (let ((result (wnn7-server-set-yosoku-max-disp max))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-yosoku-last-is-first (mode) (let ((result (wnn7-server-set-yosoku-last-is-first-mode mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-boin-kabusoku (mode) (let ((result (wnn7-server-set-boin-kabusoku mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-shiin-choka (mode) (let ((result (wnn7-server-set-shiin-choka mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-n-choka (mode) (let ((result (wnn7-server-set-n-choka mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) (defun wnn7-set-nihongo-kosei (mode) (let ((result (wnn7-server-set-nihongo-kosei mode))) (if (< result 0) (egg:error (wnn7rpc-get-error-message (- result)))))) ;;; ;;; WNN interface ;;; (defmacro make-host-list (name list) `(cons ,name (delete ,name ,list))) (defun set-wnn7-host-name (name) (interactive "sHost name: ") (close-wnn7) (setq wnn7-server-list (make-host-list name (or wnn7-server-list (list (or wnn7-server-name (getenv "JSERVER"))))))) (fset 'set-jserver-host-name (symbol-function 'set-wnn7-host-name)) (defvar wnn7egg-default-startup-file "eggrc-wnn7" "*Wnn7Egg startup file name (system default)") (defvar wnn7egg-startup-file ".eggrc-wnn7" "*Wnn7Egg startup file name.") ;;; 92/6/30, by K.Handa (defvar egg-startup-file-search-path '("~" ".") "*List of directories to search for egg-startup-file whose name defaults to .eggrc.") (defun egg:search-file (filename searchpath) (if (file-name-directory filename) (let ((file (substitute-in-file-name (expand-file-name filename)))) (if (file-exists-p file) file nil)) (catch 'answer (while searchpath (let ((path (car searchpath))) (if (stringp path) (let ((file (substitute-in-file-name (expand-file-name filename path)))) (if (file-exists-p file) (throw 'answer file))))) (setq searchpath (cdr searchpath))) nil))) ;;; ;;; Entry functions for wnn7egg-startup-file ;;; (defun open-wnn7 () (if (null (wnn7-server-isconnect)); as wnn-search-environment (eggV4) (let ((hostlist (or wnn7-server-list (list (or wnn7-server-name (getenv "JSERVER") "localhost")))) (loginname (user-login-name)) result) (catch 'success (while hostlist (let ((hostname (car hostlist)) poffset pabs) (setq wnn7-active-server-port wnn7-server-default-port) (if (or (setq poffset (string-match ":" hostname)) (setq pabs (string-match "/" hostname))) (if poffset (progn (setq wnn7-active-server-port (+ wnn7-active-server-port (string-to-number (substring hostname (match-end 0))))) (setq hostname (substring hostname 0 (match-beginning 0)))) (setq wnn7-active-server-port (string-to-number (substring hostname (1+ pabs) nil))) (setq hostname (substring hostname 0 pabs)))) (if (or (not hostname) (equal hostname "")) (setq hostname "localhost")) (if (setq wnn7-process (wnn7-server-start hostname)) (progn (and (= 0 (setq result (wnn7-server-open wnn7-process hostname loginname))) (<= 0 (setq result (wnn7-server-connect wnn7-process loginname))) (setq loginname (concat loginname "R")) (<= 0 (setq result (wnn7-server-connect wnn7-process loginname t))) (setq wnn7-active-server-name hostname) (throw 'success hostname)) (setq hostlist (cdr hostlist))) (setq hostlist (cdr hostlist)))))) (cond ((and result (<= 0 result)) ;; connected (notify (wnn7-msg-get 'open-wnn) wnn7-active-server-name) ;; parameter set (wnn7-param-set) ;; re-init input-predict, when jserver restarted. (if (and (wnn7-p) egg-yosoku-mode) (egg-use-input-predict))) ((and result (> 0 result)) ;; server error (egg:error (wnn7rpc-get-error-message (- result)))) ((not result) ;; cannot connect (egg:error (wnn7-msg-get 'cannot-connect))) )))) (defun wnn7-param-set () (let* ((path (append egg-startup-file-search-path load-path)) (eggrc (or (egg:search-file wnn7egg-startup-file path) (egg:search-file wnn7egg-default-startup-file load-path)))) (if (or (null skip-wnn-setenv-if-env-exist) (null (wnn7-server-dict-list))) (if eggrc (load-file eggrc) (wnn7-server-close) (egg:error (wnn7-msg-get 'no-rcfile) path))) (run-hooks 'egg:open-wnn-hook))) (defun disconnect-wnn7 () (interactive) (if (wnn7-server-isconnect) (wnn7-server-close))) (defun close-wnn7 () (interactive) (if (wnn7-server-isconnect) (progn (wnn7-server-set-rev nil) (wnn7-server-dict-save) (message (wnn7-msg-get 'file-saved)) (sit-for 0) (when egg-predict-status (wnn7-server-predict-save-data) (wnn7-server-predict-free)) (wnn7-server-set-rev t) (wnn7-server-dict-save) (message (wnn7-msg-get 'file-saved)) (sit-for 0) (wnn7-server-close) (run-hooks 'egg:close-wnn7-hook)))) ;;; ;;; Kanji henkan ;;; (defvar wnn7-rensou-touroku nil) (defvar egg:*kanji-kanabuff* nil) (defvar egg:*dai* t) (defvar *bunsetu-number* nil) (defvar *zenkouho-suu* nil) (defvar *zenkouho-offset* nil) (defun wnn7-bunsetu-length-sho (number) (length (wnn7-server-bunsetu-yomi number))) (defun wnn7-bunsetu-length (number) (let ((max (wnn7-server-dai-end number)) (i (1+ number)) (l (wnn7-bunsetu-length-sho number))) (while (< i max) (setq l (+ l (wnn7-bunsetu-length-sho i))) (setq i (1+ i))) l)) (defun wnn7-bunsetu-position (number) (let ((pos egg:*region-start*) (i 0)) (while (< i number) (setq pos (+ pos (length (wnn7-server-bunsetu-kanji i)) (if (wnn7-server-dai-top (1+ i)) (length egg:*dai-bunsetu-kugiri*) (length egg:*sho-bunsetu-kugiri*)))) (setq i (1+ i))) pos)) (defun wnn7-bunsetu-kouho-suu (bunsetu-number init) (let ((cand)) (when (or init (null (wnn7-server-zenkouho-bun-p bunsetu-number))) (setq cand (wnn7-server-zenkouho bunsetu-number egg:*dai*))) (setq cand (wnn7-server-get-zenkouho bunsetu-number) *zenkouho-suu* (length cand)))) (defun wnn7-bunsetu-kouho-list (bunsetu-number init) (let ((cand)) (when (or init (null (wnn7-server-zenkouho-bun-p bunsetu-number))) (setq cand (wnn7-server-zenkouho bunsetu-number egg:*dai*)) (setq *zenkouho-offset* (car cand))) (setq cand (wnn7-server-get-zenkouho bunsetu-number) *zenkouho-suu* (length cand)) cand)) (defun wnn7-bunsetu-kouho-number (bunsetu-number init) (let ((cand)) (when (or init (null (wnn7-server-zenkouho-bun-p bunsetu-number))) (setq cand (wnn7-server-zenkouho bunsetu-number egg:*dai*)) (setq *zenkouho-offset* (car cand))) *zenkouho-offset*)) ;;;; ;;;; User entry : henkan-region, henkan-paragraph, henkan-sentence ;;;; (defun egg:henkan-face-on () ;; Make an overlay if henkan overlay does not exist. ;; Move henkan overlay to henkan region. (if egg:*henkan-face* (if (featurep 'xemacs) (progn (if (extentp egg:*henkan-extent*) (set-extent-endpoints egg:*henkan-extent* egg:*region-start* egg:*region-end*) (setq egg:*henkan-extent* (make-extent egg:*region-start* egg:*region-end*)) (set-extent-property egg:*henkan-extent* 'start-open nil) (set-extent-property egg:*henkan-extent* 'end-open nil) (set-extent-property egg:*henkan-extent* 'detachable nil)) (set-extent-face egg:*henkan-extent* egg:*henkan-face*)) (progn (if (overlayp egg:*henkan-overlay*) nil (setq egg:*henkan-overlay* (make-overlay 1 1 nil nil t)) (overlay-put egg:*henkan-overlay* 'face egg:*henkan-face*)) (move-overlay egg:*henkan-overlay* egg:*region-start* egg:*region-end*))))) (defun egg:henkan-face-off () ;; detach henkan overlay from the current buffer. (if (featurep 'xemacs) (and egg:*henkan-face* (extentp egg:*henkan-extent*) (detach-extent egg:*henkan-extent*)) (and egg:*henkan-face* (overlayp egg:*henkan-overlay*) (delete-overlay egg:*henkan-overlay*)))) (defun wnn7-henkan-region (start end) "Convert a text in the region between START and END from kana to kanji." (interactive "r") (if (interactive-p) (set-mark (point))) ;;; to be fixed (wnn7-henkan-region-internal start end)) (defun wnn7-gyaku-henkan-region (start end) "Convert a text in the region between START and END from kanji to kana." (interactive "r") (if (interactive-p) (set-mark (point))) ;;; to be fixed (wnn7-henkan-region-internal start end t)) (defun wnn7-henkan-region-internal (start end &optional rev) ;; region $B$r$+$J4A;zJQ49$9$k(B (if wnn7-henkan-mode-in-use nil (let ((finished nil)) (unwind-protect (progn (setq wnn7-henkan-mode-in-use t) (if (null (wnn7-server-isconnect)) (open-wnn7)) (setq egg:*kanji-kanabuff* (buffer-substring start end)) (setq *bunsetu-number* 0) (setq egg:*dai* t) ; 92.9.8 by T.shingu (wnn7-server-set-rev rev) (let ((result (wnn7-server-henkan-begin egg:*kanji-kanabuff*))) (if (and result (> (car result) 0)) (progn (mode-line-egg-mode-update (wnn7-msg-get 'henkan-mode-indicator)) (goto-char start) (or (markerp egg:*region-start*) (setq egg:*region-start* (make-marker))) (or (markerp egg:*region-end*) (progn (setq egg:*region-end* (make-marker)) (set-marker-insertion-type egg:*region-end* t))) (if (null (marker-position egg:*region-start*)) (progn (delete-region start end) (suspend-undo) (goto-char start) (insert egg:*henkan-open*) (set-marker egg:*region-start* (point)) (insert egg:*henkan-close*) (set-marker egg:*region-end* egg:*region-start*) (goto-char egg:*region-start*) ) (progn (egg:fence-face-off) (delete-region (- egg:*region-start* (length egg:*fence-open*)) egg:*region-start*) (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*fence-close*))) (goto-char egg:*region-start*) (insert egg:*henkan-open*) (set-marker egg:*region-start* (point)) (goto-char egg:*region-end*) (let ((point (point))) (insert egg:*henkan-close*) (set-marker egg:*region-end* point)) (goto-char start) (delete-region start end) )) (wnn7-henkan-insert-kouho 0 (car result)) (egg:henkan-face-on) (wnn7-bunsetu-face-on) (wnn7-henkan-goto-bunsetu 0) (run-hooks 'egg:henkan-start-hook)))) (setq finished t)) (or finished (setq wnn7-henkan-mode-in-use nil) (resume-undo-list))))) ) (defun wnn7-henkan-paragraph () "Convert the current paragraph from kana to kanji." (interactive) (forward-paragraph) (let ((end (point))) (backward-paragraph) (wnn7-henkan-region-internal (point) end))) (defun wnn7-gyaku-henkan-paragraph () "Convert the current paragraph from kanji to kana." (interactive) (forward-paragraph) (let ((end (point))) (backward-paragraph) (wnn7-henkan-region-internal (point) end t))) (defun wnn7-henkan-sentence () "Convert the current sentence from kana to kanji." (interactive) (forward-sentence) (let ((end (point))) (backward-sentence) (wnn7-henkan-region-internal (point) end))) (defun wnn7-gyaku-henkan-sentence () "Convert the current sentence from kanji to kana." (interactive) (forward-sentence) (let ((end (point))) (backward-sentence) (wnn7-henkan-region-internal (point) end t))) (defun wnn7-henkan-word () "Convert the current word from kana to kanji." (interactive) (re-search-backward "\\<" nil t) (let ((start (point))) (re-search-forward "\\>" nil t) (wnn7-henkan-region-internal start (point)))) (defun wnn7-gyaku-henkan-word () "Convert the current word from kanji to kana." (interactive) (re-search-backward "\\<" nil t) (let ((start (point))) (re-search-forward "\\>" nil t) (wnn7-henkan-region-internal start (point) t))) ;;; ;;; Kana Kanji Henkan Henshuu mode ;;; (defun set-egg-henkan-mode-format (open close kugiri-dai kugiri-sho &optional henkan-face dai-bunsetu-face sho-bunsetu-face) "$BJQ49(B mode $B$NI=<(J}K!$r@_Dj$9$k!#(BOPEN $B$OJQ49$N;OE@$r<($9J8;zNs$^$?$O(B nil$B!#(B CLOSE$B$OJQ49$N=*E@$r<($9J8;zNs$^$?$O(B nil$B!#(B KUGIRI-DAI$B$OBgJ8@a$N6h@Z$j$rI=<($9$kJ8;zNs$^$?$O(B nil$B!#(B KUGIRI-SHO$B$O>.J8@a$N6h@Z$j$rI=<($9$kJ8;zNs$^$?$O(B nil$B!#(B optional HENKAN-FACE $B$OJQ496h4V$rI=<($9$k(B face $B$^$?$O(B nil optional DAI-BUNSETU-FACE $B$OBgJ8@a6h4V$rI=<($9$k(B face $B$^$?$O(B nil optional SHO-BUNSETU-FACE $B$O>.J8@a6h4V$rI=<($9$k(B face $B$^$?$O(B nil" (interactive (list (read-string (wnn7-msg-get 'begin-henkan)) (read-string (wnn7-msg-get 'end-henkan)) (read-string (wnn7-msg-get 'kugiri-dai)) (read-string (wnn7-msg-get 'kugiri-sho)) (cdr (assoc (completing-read (wnn7-msg-get 'face-henkan) egg:*face-alist*) egg:*face-alist*)) (cdr (assoc (completing-read (wnn7-msg-get 'face-dai) egg:*face-alist*) egg:*face-alist*)) (cdr (assoc (completing-read (wnn7-msg-get 'face-sho) egg:*face-alist*) egg:*face-alist*)) )) (if (or (stringp open) (null open)) (setq egg:*henkan-open* (or open "")) (egg:error "Wrong type of arguments(open): %s" open)) (if (or (stringp close) (null close)) (setq egg:*henkan-close* (or close "")) (egg:error "Wrong type of arguments(close): %s" close)) (if (or (stringp kugiri-dai) (null kugiri-dai)) (setq egg:*dai-bunsetu-kugiri* (or kugiri-dai "")) (egg:error "Wrong type of arguments(kugiri-dai): %s" kugiri-dai)) (if (or (stringp kugiri-sho) (null kugiri-sho)) (setq egg:*sho-bunsetu-kugiri* (or kugiri-sho "")) (egg:error "Wrong type of arguments(kugiri-sho): %s" kugiri-sho)) (if (or (null henkan-face) (memq henkan-face (face-list))) (progn (setq egg:*henkan-face* henkan-face) (if (featurep 'xemacs) (if (extentp egg:*henkan-extent*) (set-extent-property egg:*henkan-extent* 'face egg:*henkan-face*)) (if (overlayp egg:*henkan-overlay*) (overlay-put egg:*henkan-overlay* 'face egg:*henkan-face*)))) (egg:error "Wrong type of arguments(henkan-face): %s" henkan-face)) (if (or (null dai-bunsetu-face) (memq dai-bunsetu-face (face-list))) (progn (setq egg:*dai-bunsetu-face* dai-bunsetu-face) (if (featurep 'xemacs) (if (extentp egg:*dai-bunsetu-extent*) (set-extent-property egg:*dai-bunsetu-extent* 'face egg:*dai-bunsetu-face*)) (if (overlayp egg:*dai-bunsetu-overlay*) (overlay-put egg:*dai-bunsetu-overlay* 'face egg:*dai-bunsetu-face*)))) (egg:error "Wrong type of arguments(dai-bunsetu-face): %s" dai-bunsetu-face)) (if (or (null sho-bunsetu-face) (memq sho-bunsetu-face (face-list))) (progn (setq egg:*sho-bunsetu-face* sho-bunsetu-face) (if (featurep 'xemacs) (if (extentp egg:*sho-bunsetu-extent*) (set-extent-property egg:*sho-bunsetu-extent* 'face egg:*sho-bunsetu-face*)) (if (overlayp egg:*sho-bunsetu-overlay*) (overlay-put egg:*sho-bunsetu-overlay* 'face egg:*sho-bunsetu-face*)))) (egg:error "Wrong type of arguments(sho-bunsetu-face): %s" sho-bunsetu-face)) ) (defun wnn7-henkan-insert-kouho (startno number) (let ((i startno)) (while (< i number) (insert (wnn7-server-bunsetu-kanji i) ;; $B$3$3$OBgJ8@a!)(B (if (= (1+ i) number) "" (if (wnn7-server-dai-top (1+ i)) ;;; (if (wnn7-server-dai-top i) egg:*dai-bunsetu-kugiri* egg:*sho-bunsetu-kugiri*))) (setq i (1+ i))))) (defun wnn7-henkan-kakutei () (interactive) (egg:bunsetu-face-off) (egg:henkan-face-off) (setq wnn7-henkan-mode-in-use nil) (setq egg:*in-fence-mode* nil) (delete-region (- egg:*region-start* (length egg:*henkan-open*)) egg:*region-start*) (delete-region egg:*region-start* egg:*region-end*) (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*henkan-close*))) (goto-char egg:*region-start*) (setq egg:*sai-henkan-start* (point)) (when egg-predict-status (egg-predict-clear)) (resume-undo-list) (let ((i 0) (max (wnn7-server-bunsetu-suu))) (setq egg:*old-bunsetu-suu* max) (while (< i max) (insert (wnn7-server-bunsetu-kanji i)) (if (not overwrite-mode) (undo-boundary)) (setq i (1+ i)) )) (setq egg:*sai-henkan-end* (point)) (wnn7-server-hindo-update) (when egg-predict-status (egg-predict-inc-kakutei-length) (if (not wnn7-rensou-touroku) (egg-predict-toroku))) (setq wnn7-rensou-touroku nil) (egg:quit-egg-mode) (run-hooks 'egg:henkan-end-hook) ) ;; 92.7.10 by K.Handa (defun wnn7-henkan-kakutei-first-char () "$B3NDjJ8;zNs$N:G=i$N0lJ8;z$@$1A^F~$9$k!#(B" (interactive) (egg:bunsetu-face-off) (egg:henkan-face-off) (setq wnn7-henkan-mode-in-use nil) (setq egg:*in-fence-mode* nil) (delete-region (- egg:*region-start* (length egg:*henkan-open*)) egg:*region-start*) (delete-region egg:*region-start* egg:*region-end*) (delete-region egg:*region-end* (+ egg:*region-end* ;; 92.8.5 by Y.Kasai (length egg:*henkan-close*))) (goto-char egg:*region-start*) (resume-undo-list) (insert (wnn7-server-bunsetu-kanji 0)) (if (not overwrite-mode) (undo-boundary)) (goto-char egg:*region-start*) (forward-char 1) (delete-region (point) egg:*region-end*) (wnn7-server-hindo-update) (egg:quit-egg-mode) ) ;; end of patch (defun wnn7-henkan-kakutei-before-point () (interactive) (egg:bunsetu-face-off) (egg:henkan-face-off) (delete-region egg:*region-start* egg:*region-end*) (goto-char egg:*region-start*) (let ((i 0) (max *bunsetu-number*)) (while (< i max) (insert (wnn7-server-bunsetu-kanji i )) (if (not overwrite-mode) (undo-boundary)) (setq i (1+ i)) )) (wnn7-server-hindo-update) (delete-region (- egg:*region-start* (length egg:*henkan-open*)) egg:*region-start*) (insert egg:*fence-open*) (set-marker egg:*region-start* (point)) (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*henkan-close*))) (goto-char egg:*region-end*) (let ((point (point))) (insert egg:*fence-close*) (set-marker egg:*region-end* point)) (goto-char egg:*region-start*) (egg:fence-face-on) (let ((point (point)) (i *bunsetu-number*) (max (wnn7-server-bunsetu-suu))) (while (< i max) (insert (wnn7-server-bunsetu-yomi i)) (setq i (1+ i))) ;;;(insert "|") ;;;(insert egg:*fence-close*) ;;;(set-marker egg:*region-end* (point)) (goto-char point)) (setq egg:*mode-on* t) (setq wnn7-henkan-mode-in-use nil) (egg:mode-line-display)) (defun wnn7-sai-henkan () (interactive) (if wnn7-henkan-mode-in-use nil (let ((finished nil)) (unwind-protect (progn (setq wnn7-henkan-mode-in-use t) (mode-line-egg-mode-update (wnn7-msg-get 'henkan-mode-indicator)) (goto-char egg:*sai-henkan-start*) (delete-region egg:*sai-henkan-start* egg:*sai-henkan-end*) (suspend-undo) (goto-char egg:*sai-henkan-start*) (insert egg:*henkan-open*) (set-marker egg:*region-start* (point)) (insert egg:*henkan-close*) (set-marker egg:*region-end* egg:*region-start*) (goto-char egg:*region-start*) (wnn7-henkan-insert-kouho 0 egg:*old-bunsetu-suu*) (egg:henkan-face-on) (wnn7-bunsetu-face-on) (wnn7-henkan-goto-bunsetu 0) (setq finished t)) (or finished (setq wnn7-henkan-mode-in-use nil) (resume-undo-list))))) ) (defun wnn7-bunsetu-face-on () ;; make dai-bunsetu overlay and sho-bunsetu overlay if they do not exist. ;; put thier faces to overlays and move them to each bunsetu. (let* ((bunsetu-begin *bunsetu-number*) (bunsetu-end)) ; (bunsetu-suu (wnn7-server-bunsetu-suu))) ; dai bunsetu (if egg:*dai-bunsetu-face* (if (featurep 'xemacs) (progn (if (extentp egg:*dai-bunsetu-extent*) nil (setq egg:*dai-bunsetu-extent* (make-extent 1 1)) (set-extent-property egg:*dai-bunsetu-extent* 'face egg:*dai-bunsetu-face*)) (setq bunsetu-end (wnn7-server-dai-end *bunsetu-number*)) (while (not (wnn7-server-dai-top bunsetu-begin)) (setq bunsetu-begin (1- bunsetu-begin))) (set-extent-endpoints egg:*dai-bunsetu-extent* (wnn7-bunsetu-position bunsetu-begin) (+ (wnn7-bunsetu-position (1- bunsetu-end)) (length (wnn7-server-bunsetu-kanji (if (>= 0 bunsetu-end) 0 (1- bunsetu-end))))))) (progn (if (overlayp egg:*dai-bunsetu-overlay*) nil (setq egg:*dai-bunsetu-overlay* (make-overlay 1 1)) (overlay-put egg:*dai-bunsetu-overlay* 'face egg:*dai-bunsetu-face*)) (setq bunsetu-end (wnn7-server-dai-end *bunsetu-number*)) (while (not (wnn7-server-dai-top bunsetu-begin)) (setq bunsetu-begin (1- bunsetu-begin))) (move-overlay egg:*dai-bunsetu-overlay* (wnn7-bunsetu-position bunsetu-begin) (+ (wnn7-bunsetu-position (1- bunsetu-end)) (length (wnn7-server-bunsetu-kanji (if (>= 0 bunsetu-end) 0 (1- bunsetu-end))))))))) ; sho bunsetu (if egg:*sho-bunsetu-face* (if (featurep 'xemacs) (progn (if (extentp egg:*sho-bunsetu-extent*) nil (setq egg:*sho-bunsetu-extent* (make-extent 1 1)) (set-extent-property egg:*sho-bunsetu-extent* 'face egg:*sho-bunsetu-face*)) (setq bunsetu-end (1+ *bunsetu-number*)) (set-extent-endpoints egg:*sho-bunsetu-extent* (let ((point (wnn7-bunsetu-position *bunsetu-number*))) (if (eq egg:*sho-bunsetu-face* 'modeline) (+ point 1) point)) (+ (wnn7-bunsetu-position (1- bunsetu-end)) (length (wnn7-server-bunsetu-kanji (1- bunsetu-end)))))) (progn (if (overlayp egg:*sho-bunsetu-overlay*) nil (setq egg:*sho-bunsetu-overlay* (make-overlay 1 1)) (overlay-put egg:*sho-bunsetu-overlay* 'face egg:*sho-bunsetu-face*)) (setq bunsetu-end (1+ *bunsetu-number*)) (move-overlay egg:*sho-bunsetu-overlay* (let ((point (wnn7-bunsetu-position *bunsetu-number*))) (if (eq egg:*sho-bunsetu-face* 'modeline) (1+ point) point)) (+ (wnn7-bunsetu-position (1- bunsetu-end)) (length (wnn7-server-bunsetu-kanji (1- bunsetu-end)))))))))) (defun egg:bunsetu-face-off () (if (featurep 'xemacs) (progn (and egg:*dai-bunsetu-face* (extentp egg:*dai-bunsetu-extent*) (detach-extent egg:*dai-bunsetu-extent*)) (and egg:*sho-bunsetu-face* (extentp egg:*sho-bunsetu-extent*) (detach-extent egg:*sho-bunsetu-extent*))) (and egg:*dai-bunsetu-face* (overlayp egg:*dai-bunsetu-overlay*) (delete-overlay egg:*dai-bunsetu-overlay*)) (and egg:*sho-bunsetu-face* (overlayp egg:*sho-bunsetu-overlay*) (delete-overlay egg:*sho-bunsetu-overlay*)))) (defun wnn7-henkan-goto-bunsetu (number) (setq *bunsetu-number* (check-number-range number 0 (1- (wnn7-server-bunsetu-suu)))) (goto-char (wnn7-bunsetu-position *bunsetu-number*)) ; (egg:move-bunsetu-overlay) (wnn7-bunsetu-face-on)) (defun wnn7-henkan-forward-bunsetu () (interactive) (wnn7-henkan-goto-bunsetu (1+ *bunsetu-number*))) (defun wnn7-henkan-backward-bunsetu () (interactive) (wnn7-henkan-goto-bunsetu (1- *bunsetu-number*))) (defun wnn7-henkan-first-bunsetu () (interactive) (wnn7-henkan-goto-bunsetu 0)) (defun wnn7-henkan-last-bunsetu () (interactive) (wnn7-henkan-goto-bunsetu (1- (wnn7-server-bunsetu-suu)))) (defun check-number-range (i min max) (cond((< i min) max) ((< max i) min) (t i))) (defun wnn7-henkan-hiragana () (interactive) (if (= 2 (wnn7-bunsetu-kouho-suu *bunsetu-number* nil)) (wnn7-henkan-goto-kouho (- (wnn7-bunsetu-kouho-suu *bunsetu-number* nil) 2)) (wnn7-henkan-goto-kouho (- (wnn7-bunsetu-kouho-suu *bunsetu-number* nil) 1)))) (defun wnn7-henkan-katakana () (interactive) (if (= 2 (wnn7-bunsetu-kouho-suu *bunsetu-number* nil)) (wnn7-henkan-goto-kouho (- (wnn7-bunsetu-kouho-suu *bunsetu-number* nil) 1)) (wnn7-henkan-goto-kouho (- (wnn7-bunsetu-kouho-suu *bunsetu-number* nil) 2)))) (defun wnn7-henkan-next-kouho () (interactive) (wnn7-henkan-goto-kouho (1+ (wnn7-bunsetu-kouho-number *bunsetu-number* nil)))) (defun wnn7-henkan-next-kouho-dai () (interactive) (let ((init (not egg:*dai*))) (setq egg:*dai* t) (wnn7-henkan-goto-kouho (1+ (wnn7-bunsetu-kouho-number *bunsetu-number* init))))) (defun wnn7-henkan-next-kouho-sho () (interactive) (let ((init egg:*dai*)) (setq egg:*dai* nil) (wnn7-henkan-goto-kouho (1+ (wnn7-bunsetu-kouho-number *bunsetu-number* init))))) (defun wnn7-henkan-previous-kouho () (interactive) (wnn7-henkan-goto-kouho (1- (wnn7-bunsetu-kouho-number *bunsetu-number* nil)))) (defun wnn7-henkan-previous-kouho-dai () (interactive) (let ((init (not egg:*dai*))) (setq egg:*dai* t) (wnn7-henkan-goto-kouho (1- (wnn7-bunsetu-kouho-number *bunsetu-number* init))))) (defun wnn7-henkan-previous-kouho-sho () (interactive) (let ((init (setq egg:*dai* nil))) ;;(setq egg:*dai* nil) (wnn7-henkan-goto-kouho (1- (wnn7-bunsetu-kouho-number *bunsetu-number* init))))) (defun wnn7-henkan-goto-kouho (kouho-number) ; (egg:bunsetu-face-off) (let ((point (point)) ; (yomi (wnn7-server-bunsetu-yomi *bunsetu-number*)) (max) (min)) (setq kouho-number (check-number-range kouho-number 0 (1- (length (wnn7-bunsetu-kouho-list *bunsetu-number* nil))))) (setq *zenkouho-offset* kouho-number) ;; (wnn-server-henkan-kakutei kouho-number egg:*dai*) (if egg:*dai* (wnn7-server-henkan-kakutei *bunsetu-number* kouho-number) (wnn7-server-henkan-kakutei-sho *bunsetu-number* kouho-number)) (setq max (wnn7-server-bunsetu-suu)) (setq min (max 0 (1- *bunsetu-number*))) (delete-region (wnn7-bunsetu-position min) egg:*region-end*) (goto-char (wnn7-bunsetu-position min)) (wnn7-henkan-insert-kouho min max) (goto-char point)) ; (egg:move-bunsetu-overlay) (wnn7-bunsetu-face-on) (egg:henkan-face-on) ) (defun wnn7-henkan-bunsetu-chijime-dai () (interactive) (setq egg:*dai* t) (or (= (wnn7-bunsetu-length *bunsetu-number*) 1) (wnn7-bunsetu-length-henko (1- (wnn7-bunsetu-length *bunsetu-number*))))) (defun wnn7-henkan-bunsetu-chijime-sho () (interactive) (setq egg:*dai* nil) (or (= (wnn7-bunsetu-length-sho *bunsetu-number*) 1) (wnn7-bunsetu-length-henko (1- (wnn7-bunsetu-length-sho *bunsetu-number*))))) (defun wnn7-henkan-bunsetu-nobasi-dai () (interactive) (setq egg:*dai* t) (let ((i *bunsetu-number*) (max (wnn7-server-bunsetu-suu)) (len (wnn7-bunsetu-length *bunsetu-number*)) (maxlen 0)) (while (< i max) (setq maxlen (+ maxlen (length (wnn7-server-bunsetu-yomi i)))) (setq i (1+ i))) (if (not (= len maxlen)) (wnn7-bunsetu-length-henko (1+ len))))) (defun wnn7-henkan-bunsetu-nobasi-sho () (interactive) (setq egg:*dai* nil) (let ((i *bunsetu-number*) (max (wnn7-server-bunsetu-suu)) (len (wnn7-bunsetu-length-sho *bunsetu-number*)) (maxlen 0)) (while (< i max) (setq maxlen (+ maxlen (length (wnn7-server-bunsetu-yomi i)))) (setq i (1+ i))) (if (not (= len maxlen)) (wnn7-bunsetu-length-henko (1+ len))))) (defun wnn7-henkan-saishou-bunsetu () (interactive) (wnn7-bunsetu-length-henko 1)) (defun henkan-saichou-bunsetu () (interactive) (let ((max (wnn7-server-bunsetu-suu)) (i *bunsetu-number*) (l 0)) (while (< i max) (setq l (+ l (wnn7-bunsetu-length-sho i))) (setq i (1+ i))) (wnn7-bunsetu-length-henko l))) (defun wnn7-bunsetu-length-henko (length) (let (r (start (max 0 (1- *bunsetu-number*)))) (setq r (wnn7-server-bunsetu-henkou *bunsetu-number* length egg:*dai*)) (cond((> (car r) 0) (setq wnn7-bun-list (cdr r)) ; (egg:henkan-face-off) ; (egg:bunsetu-face-off) (delete-region (wnn7-bunsetu-position start) egg:*region-end*) (goto-char (wnn7-bunsetu-position start)) (wnn7-henkan-insert-kouho start (car r)) (wnn7-henkan-goto-bunsetu *bunsetu-number*))))) (defun wnn7-henkan-quit () (interactive) (egg:bunsetu-face-off) (egg:henkan-face-off) (delete-region (- egg:*region-start* (length egg:*henkan-open*)) egg:*region-start*) (delete-region egg:*region-start* egg:*region-end*) (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*henkan-close*))) (goto-char egg:*region-start*) (insert egg:*fence-open*) (set-marker egg:*region-start* (point)) (insert egg:*kanji-kanabuff*) (let ((point (point))) (insert egg:*fence-close*) (set-marker egg:*region-end* point)) (goto-char egg:*region-end*) (egg:fence-face-on) (setq egg:*mode-on* t) (setq wnn7-henkan-mode-in-use nil) (setq egg:*in-fence-mode* t) (egg:mode-line-display)) (defun wnn7-henkan-select-kouho (init) (if (not (eq (selected-window) (minibuffer-window))) (let ((kouho-list (wnn7-bunsetu-kouho-list *bunsetu-number* init)) menu) (setq menu (list 'menu (wnn7-msg-get 'jikouho) (let ((l kouho-list) (r nil) (i 0)) (while l (setq r (cons (cons (car l) i) r)) (setq i (1+ i)) (setq l (cdr l))) (reverse r)))) (wnn7-henkan-goto-kouho (menu:select-from-menu menu (wnn7-bunsetu-kouho-number *bunsetu-number* nil)))) (beep))) (defun wnn7-henkan-select-kouho-dai () (interactive) (let ((init (not egg:*dai*))) (setq egg:*dai* t) (wnn7-henkan-select-kouho init))) (defun wnn7-henkan-select-kouho-sho () (interactive) (let ((init egg:*dai*)) (setq egg:*dai* nil) (wnn7-henkan-select-kouho init))) ;; $BJ]N1(B ;;(defun henkan-word-off () ;; (interactive) ;; (let ((info (wnn7-server-inspect *bunsetu-number*))) ;; (if (null info) ;; (notify (wnn-server-get-msg)) ;; (progn ;; (let* ((kanji (nth 0 info)) ;; (yomi (nth 1 info)) ;; (serial (nth 3 info)) ;; (jisho-no (nth 2 info)) ;; (jisho-name (nth 10 info))) ;; (if (wnn-server-word-use jisho-no serial) ;; (notify (wnn7-msg-get 'off-msg) ;; kanji yomi jisho-name serial) ;; (egg:error (wnn-server-get-msg))))))))))) (defun wnn7-henkan-kakutei-and-self-insert () (interactive) (setq unread-command-events (list last-command-event)) (wnn7-henkan-kakutei)) (if (featurep 'xemacs) (progn (defvar wnn7-henkan-mode-map (make-sparse-keymap)) (set-keymap-default-binding wnn7-henkan-mode-map 'undefined)) (defvar wnn7-henkan-mode-map (append '(keymap (t . undefined) (?\C-x keymap (t . undefined))) function-key-map)) (define-prefix-command 'wnn7-henkan-mode-esc-map) (define-key wnn7-henkan-mode-map "\e" wnn7-henkan-mode-esc-map) (define-key wnn7-henkan-mode-map [escape] wnn7-henkan-mode-esc-map) (define-key wnn7-henkan-mode-esc-map [t] 'undefined)) (substitute-key-definition 'egg-self-insert-command 'wnn7-henkan-kakutei-and-self-insert wnn7-henkan-mode-map global-map) (define-key wnn7-henkan-mode-map "\ei" 'wnn7-henkan-bunsetu-chijime-sho) (define-key wnn7-henkan-mode-map "\eo" 'wnn7-henkan-bunsetu-nobasi-sho) (define-key wnn7-henkan-mode-map "\es" 'wnn7-henkan-select-kouho-dai) (define-key wnn7-henkan-mode-map "\eh" 'wnn7-henkan-hiragana) (define-key wnn7-henkan-mode-map "\ek" 'wnn7-henkan-katakana) (define-key wnn7-henkan-mode-map "\er" 'wnn7-henkan-synonym) (define-key wnn7-henkan-mode-map "\ez" 'wnn7-henkan-select-kouho-sho) (define-key wnn7-henkan-mode-map "\e<" 'wnn7-henkan-saishou-bunsetu) (define-key wnn7-henkan-mode-map "\e>" 'wnn7-henkan-saichou-bunsetu) (define-key wnn7-henkan-mode-map " " 'wnn7-henkan-next-kouho) ; 92.7.10 by K.Handa (define-key wnn7-henkan-mode-map "\C-@" 'wnn7-henkan-kakutei-first-char) (define-key wnn7-henkan-mode-map [?\C-\ ] 'wnn7-henkan-kakutei-first-char) (define-key wnn7-henkan-mode-map "\C-a" 'wnn7-henkan-first-bunsetu) (define-key wnn7-henkan-mode-map "\C-b" 'wnn7-henkan-backward-bunsetu) (define-key wnn7-henkan-mode-map "\C-c" 'wnn7-henkan-quit) (define-key wnn7-henkan-mode-map "\C-e" 'wnn7-henkan-last-bunsetu) (define-key wnn7-henkan-mode-map "\C-f" 'wnn7-henkan-forward-bunsetu) (define-key wnn7-henkan-mode-map "\C-g" 'wnn7-henkan-quit) (define-key wnn7-henkan-mode-map "\C-h" 'wnn7-henkan-help-command) (define-key wnn7-henkan-mode-map "\C-i" 'wnn7-henkan-bunsetu-chijime-dai) (define-key wnn7-henkan-mode-map "\C-k" 'wnn7-henkan-kakutei-before-point) (define-key wnn7-henkan-mode-map "\C-l" 'wnn7-henkan-kakutei) (define-key wnn7-henkan-mode-map "\C-m" 'wnn7-henkan-kakutei) (define-key wnn7-henkan-mode-map "\C-n" 'wnn7-henkan-next-kouho) (define-key wnn7-henkan-mode-map "\C-o" 'wnn7-henkan-bunsetu-nobasi-dai) (define-key wnn7-henkan-mode-map "\C-p" 'wnn7-henkan-previous-kouho) (define-key wnn7-henkan-mode-map "\C-t" 'wnn7-toroku-henkan-mode) (define-key wnn7-henkan-mode-map "\C-v" 'wnn7-henkan-inspect-bunsetu) (define-key wnn7-henkan-mode-map "\C-w" 'wnn7-henkan-next-kouho-dai) (define-key wnn7-henkan-mode-map "\C-z" 'wnn7-henkan-next-kouho-sho) (define-key wnn7-henkan-mode-map "\177" 'wnn7-henkan-quit) (define-key wnn7-henkan-mode-map [backspace] 'wnn7-henkan-quit) (define-key wnn7-henkan-mode-map [clear] 'wnn7-henkan-quit) (define-key wnn7-henkan-mode-map [delete] 'wnn7-henkan-quit) (define-key wnn7-henkan-mode-map [down] 'wnn7-henkan-next-kouho) (define-key wnn7-henkan-mode-map [help] 'wnn7-henkan-help-command) (define-key wnn7-henkan-mode-map [kp-enter] 'wnn7-henkan-kakutei) (define-key wnn7-henkan-mode-map [kp-down] 'wnn7-henkan-next-kouho) (define-key wnn7-henkan-mode-map [kp-left] 'wnn7-henkan-backward-bunsetu) (define-key wnn7-henkan-mode-map [kp-right] 'wnn7-henkan-forward-bunsetu) (define-key wnn7-henkan-mode-map [kp-up] 'wnn7-henkan-previous-kouho) (define-key wnn7-henkan-mode-map [left] 'wnn7-henkan-backward-bunsetu) (define-key wnn7-henkan-mode-map [next] 'wnn7-henkan-next-kouho) (define-key wnn7-henkan-mode-map [prior] 'wnn7-henkan-previous-kouho) (define-key wnn7-henkan-mode-map [return] 'wnn7-henkan-kakutei) (define-key wnn7-henkan-mode-map [right] 'wnn7-henkan-forward-bunsetu) (define-key wnn7-henkan-mode-map [up] 'wnn7-henkan-previous-kouho) (unless (assq 'wnn7-henkan-mode-in-use minor-mode-map-alist) (setq minor-mode-map-alist (cons (cons 'wnn7-henkan-mode-in-use wnn7-henkan-mode-map) minor-mode-map-alist))) (defun wnn7-henkan-help-command () "Display documentation for henkan-mode." (interactive) (let ((buf "*Help*")) (if (eq (get-buffer buf) (current-buffer)) (wnn7-henkan-quit) (with-output-to-temp-buffer buf ;;(princ (substitute-command-keys henkan-mode-document-string)) (princ (substitute-command-keys (wnn7-msg-get 'henkan-help))) (print-help-return-message))))) ;;;---------------------------------------------------------------------- ;;; ;;; Dictionary management Facility ;;; ;;;---------------------------------------------------------------------- ;;; ;;; $B<-=qEPO?(B ;;; ;;;; ;;;; User entry: toroku-region ;;;; (defun remove-regexp-in-string (regexp string) (cond((not(string-match regexp string)) string) (t(let ((str nil) (ostart 0) (oend (match-beginning 0)) (nstart (match-end 0))) (setq str (concat str (substring string ostart oend))) (while (string-match regexp string nstart) (setq ostart nstart) (setq oend (match-beginning 0)) (setq nstart (match-end 0)) (setq str (concat str (substring string ostart oend)))) (concat str (substring string nstart)))))) (defun wnn-hinshi-select (env dic-id) (menu:select-from-menu (wnn-make-hinshi-menu env dic-id "/" (wnn7-msg-get 'hinsimei)))) (defun wnn-make-hinshi-menu (env dic-id hinshi prompt) (let ((hinshi-list (wnn7rpc-get-hinshi-list env dic-id hinshi))) (if (numberp hinshi-list) (egg:error "%s" (wnn7rpc-get-error-message (- hinshi-list))) (list 'menu (format (if (equal hinshi "/") "%s:" "%s[%s]:") prompt (substring hinshi 0 (1- (length hinshi)))) (mapcar (lambda (h) (if (= (aref h (1- (length h))) ?/) (cons h (wnn-make-hinshi-menu env dic-id h prompt)) h)) hinshi-list))))) (defun wnn-find-dictionary-by-id (id dic-list) (catch 'return (while dic-list (let ((dic (car dic-list))) (if (= (wnndic-get-id dic) id) (throw 'return dic) (setq dic-list (cdr dic-list))))))) (defun wnn-dict-name (dic-info) (let ((comment (wnndic-get-comment dic-info)) (name (wnndic-get-dictname dic-info))) (cond ((null (string= comment "")) comment) ((wnn7-client-file-p name) name) (t (file-name-nondirectory name))))) (defun wnn-list-writable-dictionaries-byname (env) (let ((dic-list (wnn7-get-dictionary-list-with-environment env)) (w-id-list (wnn7rpc-get-writable-dictionary-id-list env))) (cond ((numberp w-id-list) (egg:error "%s" (wnn7rpc-get-error-message (- w-id-list)))) ((null w-id-list) (egg:error 'wnn-no-writable-d)) (t (delq nil (mapcar (lambda (id) (let ((dic (wnn-find-dictionary-by-id id dic-list))) (and dic (cons (wnn-dict-name dic) dic)))) w-id-list)))))) (defun wnn-dictionary-select (env) (menu:select-from-menu (list 'menu (wnn7-msg-get 'touroku-jishomei) (wnn-list-writable-dictionaries-byname env)))) (defun wnn7-toroku-word (yomi kanji interactive) (let* ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (dic (wnn-dictionary-select env)) (dic-id (wnndic-get-id dic)) (hinshi (wnn-hinshi-select env dic-id)) (result (wnn7rpc-hinshi-number (wnn7env-get-proc env) hinshi))) (if (or (not interactive) (notify-yes-or-no-p (wnn7-msg-get 'register-notify) kanji yomi hinshi (wnn-dict-name dic))) (progn (or (< result 0) (setq result (wnn7rpc-add-word env dic-id yomi kanji "" result 0))) (if (>= result 0) (notify (wnn7-msg-get 'registerd) kanji yomi hinshi (wnn-dict-name dic)) ;;; (list hinshi (wnn-dict-name dic)) (egg:error (wnn7rpc-get-error-message (- result)))))))) (defun wnn7-toroku-region (start end) (interactive "r") (if (null (wnn7-server-isconnect)) (open-wnn7)) (wnn7-server-set-rev nil) (let*((kanji (remove-regexp-in-string "[\0-\37]" (buffer-substring start end))) (yomi (read-current-its-string (format (wnn7-msg-get 'jishotouroku-yomi) kanji)))) (wnn7-toroku-word yomi kanji nil))) (defun delete-space (string) (let ((len (length string))) (if (eq len 0) "" (if (or (char-equal (aref string 0) ? ) (char-equal (aref string 0) ?-)) (delete-space (substring string 1)) (concat (substring string 0 1) (delete-space (substring string 1))))))) (defun wnn7-toroku-henkan-mode () (interactive) (let*((kanji (read-current-its-string (wnn7-msg-get 'kanji) (delete-space (buffer-substring (point) egg:*region-end* )))) (yomi (read-current-its-string (format (wnn7-msg-get 'jishotouroku-yomi) kanji) (let ((str "") (i *bunsetu-number*) (max (wnn7-server-bunsetu-suu))) (while (< i max) (setq str (concat str (wnn7-server-bunsetu-yomi i))) (setq i (1+ i))) str)))) (wnn7-toroku-word yomi kanji nil))) ;;; ;;; $B<-=qJT=87O(B DicEd ;;; ;;; Sorry, not ported yet. Please, use wnndictutil. ;;; ;;; Pure inspect facility ;;; (defun wnn7-henkan-inspect-bunsetu () (interactive) (notify (wnn7-server-inspect *bunsetu-number*))) ;;; ;;; ;;; input predict command ;;; ;;; (defvar yosoku-select nil "$B8uJdA*Br$5$l$F$$$k$+(B") (defvar through-yosoku nil "$B8uJd$r0l;~A*Br$7$?$+(B") (defvar yosoku-input 0 "$BF~NOM=B,%-!(B") (defconst egg-yosoku-window-size 5 "$BM=B,8uJdI=<(%&%#%s%I%&$NBg$-$5(B") (defvar egg-win-previous-config nil "$BM=B,8uJdI=<($N(B window configuration") (defvar egg-win-previous-point nil "$BM=B,8uJdI=<($N(B current buffer point") ;; for inline-predict (defvar egg-predict-original-position nil "$B%U%'%s%9Fb$N$NLa$j0LCV(B") (defvar egg-predict-start-position nil "$B8uJdI=<(3+;O$N%^!<%+!<(B") (defvar egg-predict-end-position nil "$B8uJdI=<(=*N;$N%^!<%+!<(B") (defvar egg-predict-inline-pos 0 "$B%$%s%i%$%sI=<(8uJdA*Br0LCV(B") (defun egg-predict-realtime-p () (and (wnn7-server-isconnect) egg-predict-realtime egg-yosoku-mode)) (defun egg-predict-inline-p () (string= egg-predict-mode 'inline)) (defun egg-use-input-predict () (interactive) (if (not (wnn7-p)) (error (wnn7-msg-get 'no-wnn7egg)) (setq egg-yosoku-mode t) (if (null (wnn7-server-isconnect)) (open-wnn7)) (when (wnn7-server-isconnect) (wnn7-server-set-rev nil) (wnn7-server-predict-init) (egg:mode-line-display) (if (not (egg-predict-inline-p)) (egg-predict-open-window))))) (defun egg-unuse-input-predict () (interactive) (if (not (wnn7-p)) (error (wnn7-msg-get 'no-wnn7egg)) (setq egg-yosoku-mode nil) (egg:mode-line-display) (if (not (egg-predict-inline-p)) (egg-predict-close-window)) (when egg-predict-status (wnn7-server-predict-save-data) (wnn7-server-predict-free)))) (defun egg-predict-toggle-realtime-mode () (interactive) (if egg-predict-realtime (setq egg-predict-realtime nil) (setq egg-predict-realtime t)) (eval egg-predict-realtime)) (defun egg-predict-toggle-candidate-mode () (interactive) (if (string= egg-predict-mode 'inline) (setq egg-predict-mode 'window) (setq egg-predict-mode 'inline)) (if (egg-predict-inline-p) (egg-predict-close-window))) (defun egg-predict-start-realtime () (interactive) (when (and egg-yosoku-mode (wnn7-server-isconnect) (not (window-minibuffer-p (selected-window)))) (if (string= egg-predict-mode 'inline) (egg-predict-start-internal-inline egg:*region-start* egg:*region-end*) (setq egg-win-previous-point (point)) (egg-predict-open-window) (egg-predict-start-internal-window egg:*region-start* egg:*region-end*)))) (defun egg-predict-start-parttime () (interactive) (when (and (wnn7-p) egg-yosoku-mode (wnn7-server-isconnect) (not (window-minibuffer-p (selected-window)))) (if (string= egg-predict-mode 'inline) (progn (if (egg-predict-start-internal-inline egg:*region-start* egg:*region-end*) (egg-predict-mode-in-inline))) (setq egg-win-previous-point (point)) (egg-predict-open-window) (if (egg-predict-start-internal-window egg:*region-start* egg:*region-end*) (egg-predict-mode-in-window))))) (defun egg-predict-check-reset-connective () (when (and egg-yosoku-mode egg-predict-status (wnn7-server-isconnect)) (if (and (not (eq last-command 'fence-exit-mode)) (not (eq last-command 'egg-predict-select)) (not (eq last-command 'wnn7-henkan-kakutei))) (wnn7-server-predict-reset-connective)))) (defun egg-delete-backward-char (arg &optional killp) (interactive "*p\nP") (when (and (wnn7-p) (wnn7-server-isconnect) egg-yosoku-mode egg-predict-status) (if (or (eq last-command 'fence-exit-mode) (eq last-command 'wnn7-henkan-kakutei) (eq last-command 'egg-predict-select)) (wnn7-server-predict-cancel-toroku))) (delete-backward-char arg killp)) (defun egg-predict-toroku (&optional kakutei-str) (when (and (wnn7-server-isconnect) egg-yosoku-mode) (wnn7-server-set-rev nil) (if (null egg-predict-status) (wnn7-server-predict-init)) ;;; (egg-predict-inc-kakutei-length) ;; move to wnn7-henkan-kakutei (wnn7-server-predict-toroku kakutei-str))) (defun egg-backward-delete-char-untabify (arg &optional killp) (interactive "*p\nP") (when (and (wnn7-p) (wnn7-server-isconnect) egg-yosoku-mode egg-predict-status) (if (or (eq last-command 'fence-exit-mode) (eq last-command 'wnn7-henkan-kakutei) (eq last-command 'egg-predict-select)) (wnn7-server-predict-cancel-toroku))) (backward-delete-char-untabify arg killp)) (defun egg-predict-select () (interactive) (if (egg-predict-inline-p) (egg-predict-select-inline) (egg-predict-select-window))) (defun egg-predict-next-candidate () (interactive) (if (egg-predict-inline-p) (egg-predict-next-candidate-inline) (when (equal (buffer-name) egg-yosoku-buffer-name) (egg-predict-inc-input-length) ; key input count (forward-line 1) (beginning-of-line) (if (eobp) (goto-char (point-min)))))) (defun egg-predict-prev-candidate () (interactive) (if (egg-predict-inline-p) (egg-predict-prev-candidate-inline) (when (equal (buffer-name) egg-yosoku-buffer-name) (egg-predict-inc-input-length) ; key input count (forward-line -1) (beginning-of-line)))) (defun egg-predict-delete () (interactive) (if (egg-predict-inline-p) (when (numberp egg-predict-inline-pos) (wnn7-server-predict-delete-cand egg-predict-inline-pos) (egg-predict-cancel) (egg-predict-start-parttime)) (when (equal (buffer-name) egg-yosoku-buffer-name) (let (pos) (save-excursion (setq pos (count-lines 1 (point)))) (wnn7-server-predict-delete-cand pos) (egg-predict-cancel) (egg-predict-start-parttime))))) (defun egg-predict-clear () (if (egg-predict-inline-p) (egg-predict-clear-inline) (when (get-buffer egg-yosoku-buffer-name) (with-current-buffer (get-buffer egg-yosoku-buffer-name) (progn (setq buffer-read-only nil) (erase-buffer) (setq buffer-read-only t)))))) (defun egg-predict-cancel () (interactive) (if (egg-predict-inline-p) (progn (egg-predict-inc-input-length) ; key input count (egg-predict-mode-out-inline) (egg-predict-clear-inline)) (if (equal (buffer-name) egg-yosoku-buffer-name) (progn (egg-predict-inc-input-length) ; key input count (setq buffer-read-only nil) (erase-buffer) (setq buffer-read-only t))) (egg-predict-mode-out-window) (goto-char egg-win-previous-point))) (defun egg-predict-save-data () (interactive) (when egg-predict-status (wnn7-server-predict-save-data))) (if (featurep 'xemacs) (progn (defvar egg-predict-mode-map (make-sparse-keymap)) (set-keymap-default-binding egg-predict-mode-map 'undefined)) (defvar egg-predict-mode-map (append '(keymap (t . undefined) (?\C-x keymap (t . undefined))) function-key-map)) (defvar egg-predict-mode-esc-map nil) (define-prefix-command 'egg-predict-mode-esc-map) (define-key egg-predict-mode-map "\C-x" egg-predict-mode-esc-map) (define-key egg-predict-mode-esc-map [t] 'undefined)) (define-key egg-predict-mode-map " " 'egg-predict-next-candidate) (define-key egg-predict-mode-map [tab] 'egg-predict-next-candidate) (define-key egg-predict-mode-map "\C-i" 'egg-predict-next-candidate) (define-key egg-predict-mode-map "n" 'egg-predict-next-candidate) (define-key egg-predict-mode-map "\C-n" 'egg-predict-next-candidate) (define-key egg-predict-mode-map "f" 'egg-predict-next-candidate) (define-key egg-predict-mode-map "\C-f" 'egg-predict-next-candidate) (define-key egg-predict-mode-map "b" 'egg-predict-prev-candidate) (define-key egg-predict-mode-map "\C-b" 'egg-predict-prev-candidate) (define-key egg-predict-mode-map "p" 'egg-predict-prev-candidate) (define-key egg-predict-mode-map "\C-p" 'egg-predict-prev-candidate) (define-key egg-predict-mode-map [return] 'egg-predict-select) (define-key egg-predict-mode-map "\C-m" 'egg-predict-select) (define-key egg-predict-mode-map "q" 'egg-predict-cancel) (define-key egg-predict-mode-map "\C-g" 'egg-predict-cancel) (define-key egg-predict-mode-map "\C-xo" 'egg-predict-other-window) (define-key egg-predict-mode-map "\C-d" 'egg-predict-delete) (make-variable-buffer-local (defvar egg-predict-candidate-inline nil)) (unless (assq 'egg-predict-candidate-inline minor-mode-map-alist) (setq minor-mode-map-alist (cons (cons 'egg-predict-candidate-inline egg-predict-mode-map) minor-mode-map-alist))) (defun egg-predict-other-window () (interactive) (if (equal (buffer-size) 0) (other-window 1) (beep))) (defun egg-predict-candidate-mode () (use-local-map egg-predict-mode-map) (setq mode-name "egg-predict") (setq major-mode 'egg-predict-candidate-mode) (buffer-disable-undo egg-yosoku-buffer-name)) ;;; window mode (defun egg-predict-open-window () (get-buffer-create egg-yosoku-buffer-name) (if (get-buffer-window egg-yosoku-buffer-name) (display-buffer egg-yosoku-buffer-name) (let ((parent-win (selected-window))) (split-window-vertically (- egg-yosoku-window-size)) (set-window-buffer (other-window 1) egg-yosoku-buffer-name) (select-window parent-win)))) (defun egg-predict-close-window () (delete-windows-on egg-yosoku-buffer-name)) (defun egg-predict-mode-in-window () (interactive) (egg-predict-open-window) (if (not egg-win-previous-config) (setq egg-win-previous-config (current-window-configuration))) (select-window (get-buffer-window egg-yosoku-buffer-name)) (setq through-yosoku t) (or (eq major-mode 'egg-predict-candidate-mode) (egg-predict-candidate-mode))) (defun egg-predict-mode-out-window () (interactive) (when (window-configuration-p egg-win-previous-config) (set-window-configuration egg-win-previous-config) (setq egg-win-previous-config nil))) (defun egg-predict-start-internal-window (start end) (let (predict-string result) (wnn7-server-set-rev nil) (if (null egg-predict-status) (wnn7-server-predict-init)) (setq predict-string (buffer-substring start end)) (setq result (wnn7-server-predict-start predict-string)) (cond ((null result) (let ((cur-buf (current-buffer))) (set-buffer egg-yosoku-buffer-name) (setq buffer-read-only nil) (erase-buffer) (setq buffer-read-only t) (set-buffer cur-buf) nil)) ((eq result -3011) (if (not egg-predict-realtime) (egg:error "%s" (wnn7rpc-get-error-message (- result))))) (t (let ((cur-buf (current-buffer)) (count 0)) (set-buffer egg-yosoku-buffer-name) (setq buffer-read-only nil) (erase-buffer) (while result (insert (format "%d: %s\n" count (car result))) (setq count (1+ count) result (cdr result))) (setq buffer-read-only t) (goto-char (point-min)) (set-buffer cur-buf) t))))) (defun egg-predict-select-window () (when (equal (buffer-name) egg-yosoku-buffer-name) (let ((cur-point (point)) start end kakutei-string pos result) (save-excursion (goto-char (point-min)) (beginning-of-line) (setq start (point)) (goto-char cur-point) (beginning-of-line) (setq pos (count-lines 1 (point))) (setq start (point)) (end-of-line) (setq end (point)) (setq kakutei-string (buffer-substring (+ start 3) end))) (setq result (wnn7-server-predict-selected-cand pos)) (when result (setq yosoku-kouho-len (+ yosoku-kouho-len result)) (setq yosoku-select t) (egg-predict-inc-kakutei-length) ;;; (egg-predict-cancel) (egg:fence-face-off) (setq egg:*in-fence-mode* nil) (delete-region (- egg:*region-start* (length egg:*fence-open*)) egg:*region-start*) (delete-region egg:*region-start* egg:*region-end*) (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*fence-close*))) (goto-char egg:*region-start*) (resume-undo-list) (insert kakutei-string))) (if its:*previous-map* (setq its:*current-map* its:*previous-map* its:*previous-map* nil)) (egg:quit-egg-mode))) ;;; inline version (defvar egg-ud-face nil "underline face") (if (not egg-ud-face) (progn (setq egg-ud-face (make-face 'egg-ud-face)) (set-face-underline-p egg-ud-face t))) (defun egg-predict-mode-in-inline () (interactive) (setq through-yosoku t) (setq egg-predict-inline-pos 0) (setq egg-predict-original-position (point)) (goto-char (next-overlay-change (marker-position egg-predict-start-position))) (setq egg-predict-candidate-inline t)) (defun egg-predict-mode-out-inline () (interactive) (setq egg-predict-candidate-inline nil) (goto-char egg-predict-original-position)) (defun egg-predict-next-candidate-inline () (interactive) (let (pos overlay-list) (setq pos (next-overlay-change (point))) (setq overlay-list (overlays-at (point))) (egg-predict-inc-input-length) ; key input count (while overlay-list (if (and (string= (overlay-get (car overlay-list) 'face) 'egg-ud-face) (= pos (overlay-end (car overlay-list)))) (setq pos (next-overlay-change pos))) (setq overlay-list (cdr overlay-list))) (if (or (not pos) (not (marker-position egg-predict-end-position)) (<= (marker-position egg-predict-end-position) pos)) ;; goto top (progn (goto-char (next-overlay-change (marker-position egg-predict-start-position))) (setq egg-predict-inline-pos 0)) (goto-char pos) (setq egg-predict-inline-pos (1+ egg-predict-inline-pos))))) (defun egg-predict-prev-candidate-inline () (interactive) (let (pos overlay-list) (setq pos (previous-overlay-change (point))) (setq overlay-list (overlays-at (1- pos))) (egg-predict-inc-input-length) ; key input count (while overlay-list (if (and (string= (overlay-get (car overlay-list) 'face) 'egg-ud-face) (= pos (overlay-end (car overlay-list)))) (setq pos (previous-overlay-change pos))) (setq overlay-list (cdr overlay-list))) (if (and pos (marker-position egg-predict-start-position) (>= (marker-position egg-predict-start-position) pos)) ;; goto top (progn (goto-char (next-overlay-change (marker-position egg-predict-start-position))) (setq egg-predict-inline-pos 0)) (goto-char pos) (setq egg-predict-inline-pos (1- egg-predict-inline-pos))))) (defun egg-predict-select-inline () (interactive) (let (start end kakutei-string result) (save-excursion (setq start (point)) (setq end (next-overlay-change (point))) (setq kakutei-string (buffer-substring start end))) (setq result (wnn7-server-predict-selected-cand egg-predict-inline-pos)) (when result (setq yosoku-kouho-len (+ yosoku-kouho-len result)) (setq yosoku-select t) (egg-predict-inc-kakutei-length) ;;; (egg-predict-clear-inline) (goto-char egg-predict-original-position) (setq egg-predict-candidate-inline nil) (egg:fence-face-off) (setq egg:*in-fence-mode* nil) (delete-region (- egg:*region-start* (length egg:*fence-open*)) egg:*region-start*) (delete-region egg:*region-start* egg:*region-end*) (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*fence-close*))) (goto-char egg:*region-start*) (resume-undo-list) (insert kakutei-string))) (if its:*previous-map* (setq its:*current-map* its:*previous-map* its:*previous-map* nil)) (egg:quit-egg-mode)) (defun egg-predict-start-internal-inline (start end) (let (predict-string result st recenter-pos) (wnn7-server-set-rev nil) (if (null egg-predict-status) (wnn7-server-predict-init)) (setq predict-string (buffer-substring start end)) (setq result (wnn7-server-predict-start predict-string)) (cond ((null result) (egg-predict-clear-inline) nil) ((eq result -3011) (if (not egg-predict-realtime) (egg:error "%s" (wnn7rpc-get-error-message (- result))))) (t (egg-predict-clear-inline) (save-excursion (end-of-line) (setq egg-predict-start-position (point-marker)) (set-marker-insertion-type egg-predict-start-position nil) (insert "\n------------------------------------------------------------\n") (while result (setq st (point)) (insert (format "[%s]" (car result))) (overlay-put (make-overlay (1+ st) (1- (point))) 'face egg-ud-face) (setq result (cdr result))) (insert "\n------------------------------------------------------------\n") (setq recenter-pos (point)) (setq egg-predict-end-position (point-marker))) (if (not (pos-visible-in-window-p recenter-pos)) (recenter)) t)))) (defun egg-predict-clear-inline () (if (or egg-predict-start-position egg-predict-end-position) (let ((pos (marker-position egg-predict-start-position)) overlay-list overlay) (while pos (setq overlay-list (overlays-at pos)) (while overlay-list (setq overlay (overlay-get (car overlay-list) 'face)) (setq pos (overlay-end (car overlay-list))) (if (string= overlay 'egg-ud-face) (delete-overlay (car overlay-list))) (setq overlay-list (cdr overlay-list))) (if (= pos (next-overlay-change pos)) (setq pos nil) (setq pos (next-overlay-change pos))) (if (or (not pos) (not (marker-position egg-predict-end-position)) (<= (marker-position egg-predict-end-position) pos)) (setq pos nil))) (save-excursion (delete-region (marker-position egg-predict-start-position) (marker-position egg-predict-end-position)) (setq egg-predict-start-position nil egg-predict-end-position nil))))) ;;; ;;; input efficiency ;;; ;;; (defun egg-predict-check-end () (when (and egg-yosoku-mode egg-predict-status) (egg-predict-check-end-input) (egg-predict-check-end-time))) (defun egg-predict-check-start-time () (let ((time (decode-time (current-time)))) (setq yosoku-sec-start (+ (nth 0 time) (* 60 (nth 1 time)))) (setq yosoku-select nil through-yosoku nil count-start t))) (defun egg-predict-check-end-time () (let ((time (decode-time (current-time))) endtime timediff) (setq endtime (+ (nth 0 time) (* 60 (nth 1 time)))) (when count-start (if (< endtime yosoku-sec-start) (setq endtime (+ endtime 3600))) (setq timediff (- endtime yosoku-sec-start)) (if (> yosoku-kakutei 0) (wnn7-server-predict-set-timeinfo (if yosoku-select 1 0) (if through-yosoku 1 0) timediff yosoku-kakutei)) (setq count-start nil)))) (defun egg-predict-check-start-input () (setq yosoku-input 0 yosoku-kakutei 0 yosoku-kouho-len 0)) (defun egg-predict-check-end-input () (when count-start (wnn7-server-predict-set-user-inputinfo yosoku-kakutei yosoku-input yosoku-select))) (defun egg-predict-inc-input-length () (setq yosoku-input (1+ yosoku-input))) (defun egg-predict-inc-kakutei-length () (if yosoku-select (setq yosoku-kakutei (+ yosoku-kakutei yosoku-kouho-len)) (setq yosoku-kakutei yosoku-input))) (defvar predict-average-mode-map nil "") (if predict-average-mode-map () (setq predict-average-mode-map (make-keymap)) (suppress-keymap predict-average-mode-map t) (if (featurep 'xemacs) (define-key predict-average-mode-map "q" 'Buffer-menu-quit) (define-key predict-average-mode-map "q" 'quit-window))) (defun predict-average-mode () (kill-all-local-variables) (use-local-map predict-average-mode-map) (setq major-mode 'predict-average-mode) (setq mode-name "Input Efficiency") (setq buffer-read-only t)) (defun egg-show-predict-average () (interactive) (let ((standard-output standard-output) status) (if (or (not (wnn7-p)) (not egg-yosoku-mode)) (error (wnn7-msg-get 'no-predict)) (save-excursion (set-buffer (get-buffer-create "*input efficiency*")) (setq buffer-read-only nil) (erase-buffer) (setq standard-output (current-buffer)) (wnn7-server-set-rev nil) (if (null egg-predict-status) (wnn7-server-predict-init)) (setq status (wnn7-server-predict-status)) (when (vectorp status) (princ (format "$B:o8:$5$l$?F~NO%-!O$N%-!O$N?dDjF~NO;~4V(B %d $BIC!K(B\n" (aref status 4))) (princ (format " $B!J$"$J$?$,F~NO$7$?;~4V(B %d $BIC!K(B\n" (aref status 5))) (princ (format "$BM=B,F~NO$r;H$C$?3d9g(B %d $B!s(B\n" (aref status 12))) (princ (format " $B!JM=B,F~NO$GF~NO$7$?J8$N%-!A0$N3NDj$7$?J8$N%-!>\n" (aref status 20)))) (predict-average-mode) (display-buffer (current-buffer)))))) ;; ;; associate translation ;; (defun wnn7-henkan-synonym () (interactive) (let (kouho-number) (setq wnn7-rensou-touroku t) (setq kouho-number (wnn7-bunsetu-kouho-number *bunsetu-number* nil)) (setq *zenkouho-offset* kouho-number) (if (wnn7-server-synonym *bunsetu-number* kouho-number egg:*dai*) (wnn7-henkan-select-kouho-dai) (notify (wnn7-msg-get 'no-rensou))))) (provide 'wnn7egg-cnv) ;;; wnn7egg-cnv.el ends here wnn7egg-1.02.orig/elisp/xemacs21/wnn7egg-comx21.el0100644000764400003210000003045707474174160021722 0ustar ishikawaishikawa;; Wnn7Egg is Egg modified for Wnn7, and the current maintainer ;; is OMRON SOFTWARE Co., Ltd. ;; ;; This file is part of Wnn7Egg. (base code is egg-com.el (eggV4)) ;; ;;; ------------------------------------------------------------------ ;;; ;;; Wnn7Egg (Wnn "なな"たまご)--- Wnn7 Emacs Client ;;; ;;; Wnn7Egg は、「たまご第3版」v3.09 をベースに 「たまご第4版」の通信、 ;;; ライブラリ部を組み込んだ、Wnn7 の為の専用クライアントです。 ;;; ;;; すべてのソースが Emacs Lisp で記述されているので、Wnn SDK/Library を必要 ;;; とせず、GNU Emacs 及び XEmacs 環境で使用することができます。使用許諾条件 ;;; は GPL です。 ;;; ;;; GNU Emacs 20.3 以降、XEmacs 21.x 以降で動作確認しています。 ;;; ;;; ;;; Wnn7Egg は Wnn7 の機能である楽々入力(入力予測)、連想変換をサポート ;;; しています。 ;;; ;;; 「たまご」と独立/共存できるように、影響する主要な関数/変数名を ;;; "wnn7..." という形に変更しています。 ;;; ;;; ------------------------------------------------------------------ ;;; egg-com.el --- Communication Routines in Egg Input Method Architecture ;; Copyright (C) 1999, 2000 Free Software Foundation, Inc ;; Author: Hisashi Miyashita ;; NIIBE Yutaka ;; KATAYAMA Yoshio ; Korean, Chinese support. ;; Maintainer: TOMURA Satoru ;; Keywords: mule, multilingual, input method ;; This file is part of EGG. ;; EGG is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; EGG is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;;; 2002/5/16 XEmacsにおいてユーザ辞書のクライアント転送ができない問題の対応 ;;; Code: (require 'wnn7egg-edep) ;;(require 'wnn7egg-cnv) (defvar egg-fixed-euc '(fixed-euc-jp)) (make-variable-buffer-local 'egg-fixed-euc) (put 'egg-fixed-euc 'permanent-local t) (defvar egg-mb-euc 'euc-japan) (make-variable-buffer-local 'egg-mb-euc) (put 'egg-mb-euc 'permanent-local t) ;; Japanese (eval-and-compile (define-ccl-program ccl-decode-fixed-euc-jp `(2 ((r2 = ,(charset-id 'japanese-jisx0208)) (r3 = ,(charset-id 'japanese-jisx0212)) (r4 = ,(charset-id 'katakana-jisx0201)) (read r0) (loop (read r1) (if (r0 < #x80) ((r0 = r1) (if (r1 < #x80) (write-read-repeat r0)) (write r4) (write-read-repeat r0)) ((if (r1 > #x80) ((write r2 r0) (r0 = r1) (write-read-repeat r0)) ((write r3 r0) (r0 = (r1 | #x80)) (write-read-repeat r0))))))))) (define-ccl-program ccl-encode-fixed-euc-jp `(2 ((read r0) (loop (if (r0 == ,(charset-id 'latin-jisx0201)) ; Unify ((read r0) (r0 &= #x7f))) (if (r0 < #x80) ;G0 ((write 0) (write-read-repeat r0))) (r6 = (r0 == ,(charset-id 'japanese-jisx0208))) (r6 |= (r0 == ,(charset-id 'japanese-jisx0208-1978))) (if r6 ;G1 ((read r0) (write r0) (read r0) (write-read-repeat r0))) (if (r0 == ,(charset-id 'katakana-jisx0201)) ;G2 ((read r0) (write 0) (write-read-repeat r0))) (if (r0 == ,(charset-id 'japanese-jisx0212)) ;G3 ((read r0) (write r0) (read r0) (r0 &= #x7f) (write-read-repeat r0))) (read r0) (repeat))))) ) (if (not (coding-system-p 'fixed-euc-jp)) (make-coding-system 'fixed-euc-jp 'ccl "Coding System for fixed EUC Japanese" `(decode ,ccl-decode-fixed-euc-jp encode ,ccl-encode-fixed-euc-jp mnemonic "WNN"))) (defun comm-format-u32c (uint32c) (insert-char (logand (lsh (car uint32c) -8) 255) 1) (insert-char (logand (car uint32c) 255) 1) (insert-char (logand (lsh (nth 1 uint32c) -8) 255) 1) (insert-char (logand (nth 1 uint32c) 255) 1)) (defun comm-format-u32 (uint32) (insert-char (logand (lsh uint32 -24) 255) 1) (insert-char (logand (lsh uint32 -16) 255) 1) (insert-char (logand (lsh uint32 -8) 255) 1) (insert-char (logand uint32 255) 1)) (defun comm-format-i32 (int32) (insert-char (logand (ash int32 -24) 255) 1) (insert-char (logand (ash int32 -16) 255) 1) (insert-char (logand (ash int32 -8) 255) 1) (insert-char (logand int32 255) 1)) (defun comm-format-u16 (uint16) (insert-char (logand (lsh uint16 -8) 255) 1) (insert-char (logand uint16 255) 1)) (defun comm-format-u8 (uint8) (insert-char (logand uint8 255) 1)) (defun comm-format-truncate-after-null (s) (if (string-match "\0" s) (substring s 0 (match-beginning 0)) s)) (defun comm-format-u16-string (s) (insert (encode-coding-string (comm-format-truncate-after-null s) egg-fixed-euc)) (insert-char 0 2)) (defun comm-format-mb-string (s) (insert (encode-coding-string (comm-format-truncate-after-null s) egg-mb-euc)) (insert-char 0 1)) (defun comm-format-u8-string (s) (insert (comm-format-truncate-after-null s)) (insert-char 0 1)) (defun comm-format-binary-data (s) (insert (encode-coding-string s 'binary)) (save-excursion (goto-char (point-min)) (wnn-perform-replace "\377" "\377\0")) (insert-char ?\377 2)) (defun comm-format-fixlen-string (s len) (setq s (comm-format-truncate-after-null s)) (insert (if (< (length s) len) s (substring s 0 (1- len)))) (insert-char 0 (max (- len (length s)) 1))) (defun comm-format-vector (s len) (setq s (concat s)) (insert (if (<= (length s) len) s (substring s 0 len))) (insert-char 0 (- len (length s)))) (defmacro comm-format (format &rest args) "Format a string out of a control-list and arguments into the buffer. The formated datas are network byte oder (i.e. big endian).. U: 32-bit integer. The argument is 2 element 16-bit unsigned integer list. u: 32-bit integer. The argument is treat as unsigned integer. (Note: Elisp's integer may be less than 32 bits) i: 32-bit integer. w: 16-bit integer. b: 8-bit integer. S: 16-bit wide-character EUC string (0x0000 terminated). E: Multibyte EUC string (0x00 terminated). s: 8-bit string (0x00 terminated). B: Binary data (0xff terminated). v: 8-bit vector (no terminator). This takes 2 args (data length). V: Fixed length string (0x00 terminated). This takes 2 args (data length)." (let ((p args) (form format) (result (list 'progn)) f arg) (while (and form p) (setq f (car form) arg (car p)) (nconc result (list (cond ((eq f 'U) (list 'comm-format-u32c arg)) ((eq f 'u) (list 'comm-format-u32 arg)) ((eq f 'i) (list 'comm-format-i32 arg)) ((eq f 'w) (list 'comm-format-u16 arg)) ((eq f 'b) (list 'comm-format-u8 arg)) ((eq f 'S) (list 'comm-format-u16-string arg)) ((eq f 'E) (list 'comm-format-mb-string arg)) ((eq f 's) (list 'comm-format-u8-string arg)) ((eq f 'B) (list 'comm-format-binary-data arg)) ((eq f 'V) (setq p (cdr p)) (list 'comm-format-fixlen-string arg (car p))) ((eq f 'v) (setq p (cdr p)) (list 'comm-format-vector arg (car p)))))) (setq form (cdr form) p (cdr p))) (if (or form p) (error "comm-format %s: arguments mismatch" format)) result)) (defvar comm-accept-timeout nil) ;; Assume PROC is bound to the process of current buffer ;; Do not move the point, leave it where it was. (defmacro comm-accept-process-output () `(let ((p (point))) (if (null (accept-process-output proc comm-accept-timeout)) (error "backend timeout")) (goto-char p))) (defmacro comm-require-process-output (n) `(if (< (point-max) (+ (point) ,n)) (comm-wait-for-space proc ,n))) (defun comm-wait-for-space (proc n) (let ((p (point)) (r (+ (point) n))) (while (< (point-max) r) (if (null (accept-process-output proc comm-accept-timeout)) (error "backend timeout")) (goto-char p)))) (defmacro comm-following+forward-char () `(prog1 (following-char) (forward-char 1))) (defun comm-unpack-u32c () (progn (comm-require-process-output 4) (list (+ (lsh (comm-following+forward-char) 8) (comm-following+forward-char)) (+ (lsh (comm-following+forward-char) 8) (comm-following+forward-char))))) (defun comm-unpack-u32 () (progn (comm-require-process-output 4) (+ (lsh (comm-following+forward-char) 24) (lsh (comm-following+forward-char) 16) (lsh (comm-following+forward-char) 8) (comm-following+forward-char)))) (defun comm-unpack-u16 () (progn (comm-require-process-output 2) (+ (lsh (comm-following+forward-char) 8) (comm-following+forward-char)))) (defun comm-unpack-u8 () (progn (comm-require-process-output 1) (comm-following+forward-char))) (defun comm-unpack-u16-string () (let ((start (point))) (while (not (search-forward "\0\0" nil t)) (comm-accept-process-output)) (decode-coding-string (buffer-substring start (- (point) 2)) egg-fixed-euc))) (defun comm-unpack-mb-string () (let ((start (point))) (while (not (search-forward "\0" nil t)) (comm-accept-process-output)) (decode-coding-string (buffer-substring start (1- (point))) egg-mb-euc))) (defun comm-unpack-u8-string () (let ((start (point))) (while (not (search-forward "\0" nil 1)) (comm-accept-process-output)) (buffer-substring start (1- (point))))) (defun comm-unpack-binary-data () (let ((start (point))) (while (not (search-forward "\377\377" nil 1)) (comm-accept-process-output)) (string-as-unibyte (decode-coding-string (buffer-substring start (- (point) 2)) 'binary)))) (defun comm-unpack-fixlen-string (len) (let (s) (comm-require-process-output len) (goto-char (+ (point) len)) (setq s (buffer-substring (- (point) len) (point))) (if (string-match "\0" s) (setq s (substring s 0 (match-beginning 0)))) s)) (defun comm-unpack-vector (len) (progn (comm-require-process-output len) (goto-char (+ (point) len)) (buffer-substring (- (point) len) (point)))) (defmacro comm-unpack (format &rest args) "Unpack a string out of a control-string and set arguments. See `comm-format' for FORMAT." (let ((p args) (form format) (result (list 'progn)) arg f) (while (and form p) (setq f (car form) arg (car p)) (nconc result (list (cond ((eq f 'U) `(setq ,arg (comm-unpack-u32c))) ((eq f 'u) `(setq ,arg (comm-unpack-u32))) ((eq f 'i) `(setq ,arg (comm-unpack-u32))) ((eq f 'w) `(setq ,arg (comm-unpack-u16))) ((eq f 'b) `(setq ,arg (comm-unpack-u8))) ((eq f 'S) `(setq ,arg (comm-unpack-u16-string))) ((eq f 'E) `(setq ,arg (comm-unpack-mb-string))) ((eq f 's) `(setq ,arg (comm-unpack-u8-string))) ((eq f 'B) `(setq ,arg (comm-unpack-binary-data))) ((eq f 'V) (setq p (cdr p)) `(setq ,arg (comm-unpack-fixlen-string ,(car p)))) ((eq f 'v) (setq p (cdr p)) `(setq ,arg (comm-unpack-vector ,(car p))))))) (setq form (cdr form) p (cdr p))) (if (or form p) (error "comm-unpack %s: arguments mismatch" format)) result)) (defmacro comm-call-with-proc (proc vlist send-expr &rest receive-exprs) (let ((euc-select (and (eq (car-safe (car vlist)) 'zhuyin) '((egg-fixed-euc (nth (if zhuyin 1 0) egg-fixed-euc)))))) `(let* ((proc ,proc) (buffer (process-buffer proc)) ,@vlist) (if (and (eq (process-status proc) 'open) (buffer-live-p buffer)) (save-excursion (set-buffer buffer) (let ,euc-select (erase-buffer) ,send-expr (goto-char (point-max)) (process-send-region proc (point-min) (point-max)) ,@receive-exprs)) (error "process %s was killed" proc))))) (defmacro comm-call-with-proc-1 (proc vlist send-expr &rest receive-exprs) `(let ,vlist (erase-buffer) ,send-expr (goto-char (point-max)) (process-send-region proc (point-min) (point-max)) ,@receive-exprs)) (provide 'wnn7egg-comx21) ;;; wnn7egg-comx21.el ends here. wnn7egg-1.02.orig/elisp/xemacs21/wnn7egg-edep.el0100644000764400003210000000554207474174160021523 0ustar ishikawaishikawa;; Wnn7Egg is Egg modified for Wnn7, and the current maintainer ;; is OMRON SOFTWARE Co., Ltd. ;; ;; This file is part of Wnn7Egg. (base code is egg-edep.el (eggV4)) ;; ;;; ------------------------------------------------------------------ ;;; ;;; Wnn7Egg (Wnn "なな"たまご)--- Wnn7 Emacs Client ;;; ;;; Wnn7Egg は、「たまご第3版」v3.09 をベースに 「たまご第4版」の通信、 ;;; ライブラリ部を組み込んだ、Wnn7 の為の専用クライアントです。 ;;; ;;; すべてのソースが Emacs Lisp で記述されているので、Wnn SDK/Library を必要 ;;; とせず、GNU Emacs 及び XEmacs 環境で使用することができます。使用許諾条件 ;;; は GPL です。 ;;; ;;; GNU Emacs 20.3 以降、XEmacs 21.x 以降で動作確認しています。 ;;; ;;; ;;; Wnn7Egg は Wnn7 の機能である楽々入力(入力予測)、連想変換をサポート ;;; しています。 ;;; ;;; 「たまご」と独立/共存できるように、影響する主要な関数/変数名を ;;; "wnn7..." という形に変更しています。 ;;; ;;; ------------------------------------------------------------------ ;; egg-edep.el --- This file serves Emacs version dependent definitions ;; Copyright (C) 1999,2000 PFU LIMITED ;; Author: NIIBE Yutaka ;; KATAYAMA Yoshio ;; Maintainer: TOMURA Satoru ;; Keywords: mule, multilingual, input method ;; This file is part of EGG. ;; EGG is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; EGG is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;;; Code: (if (featurep 'xemacs) (progn (defun set-buffer-multibyte (flag) (setq enable-multibyte-characters flag)) (defun egg-chars-in-period (str pos len) len) (defalias 'string-as-unibyte 'identity) (defalias 'string-as-multibyte 'identity);; (defalias 'coding-system-put 'put));; (if (fboundp 'set-buffer-multibyte) (if (subrp (symbol-function 'set-buffer-multibyte)) ;; Emacs 20.3 (progn (defun egg-chars-in-period (str pos len) len)) ;; Emacs 20.2 (defun set-buffer-multibyte (flag) (setq enable-multibyte-characters flag)) (defalias 'string-as-unibyte 'identity) (defalias 'string-as-multibyte 'identity) (defalias 'coding-system-put 'put) (defun egg-chars-in-period (str pos len) (chars-in-string (substring str pos (+ pos len))))))) (provide 'wnn7egg-edep) ;;; wnn7egg-edep.el ends here wnn7egg-1.02.orig/elisp/xemacs21/wnn7egg-jsymbol.el0100644000764400003210000006426007474174160022267 0ustar ishikawaishikawa;; Japanese Character Input Package for Egg ;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) ;; This file is part of Egg on Mule (Multilingal Environment) ;; Egg is distributed in the forms of patches to GNU ;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC ;; LICENSE which is distributed along with GNU Emacs by the ;; Free Software Foundation. ;; Egg is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. See the GNU EMACS GENERAL PUBLIC LICENSE for ;; more details. ;; You should have received a copy of the GNU EMACS GENERAL ;; PUBLIC LICENSE along with Nemacs; see the file COPYING. ;; If not, write to the Free Software Foundation, 675 Mass ;; Ave, Cambridge, MA 02139, USA. ;;; 92.10.18 modified for Mule Ver.0.9.6 by K.Handa ;;; Moved from egg.el ;;; 92.12.26 modified for Mule Ver.0.9.7 by T.Shingu ;;; JIS Hojo Kanji support. (provide 'wnn7egg-jsymbol) (defvar *ku1-alist* '( ( "$B!!(B" . "$B!!(B") ( "$B!"(B" . "$B!"(B") ( "$B!#(B" . "$B!#(B") ( "$B!$(B" . "$B!$(B") ( "$B!%(B" . "$B!%(B") ( "$B!&(B" . "$B!&(B") ( "$B!'(B" . "$B!'(B") ( "$B!((B" . "$B!((B") ( "$B!)(B" . "$B!)(B") ( "$B!*(B" . "$B!*(B") ( "$B!+(B" . "$B!+(B") ( "$B!,(B" . "$B!,(B") ( "$B!-(B" . "$B!-(B") ( "$B!.(B" . "$B!.(B") ( "$B!/(B" . "$B!/(B") ( "$B!0(B" . "$B!0(B") ( "$B!1(B" . "$B!1(B") ( "$B!2(B" . "$B!2(B") ( "$B!3(B" . "$B!3(B") ( "$B!4(B" . "$B!4(B") ( "$B!5(B" . "$B!5(B") ( "$B!6(B" . "$B!6(B") ( "$B!7(B" . "$B!7(B") ( "$B!8(B" . "$B!8(B") ( "$B!9(B" . "$B!9(B") ( "$B!:(B" . "$B!:(B") ( "$B!;(B" . "$B!;(B") ( "$B!<(B" . "$B!<(B") ( "$B!=(B" . "$B!=(B") ( "$B!>(B" . "$B!>(B") ( "$B!?(B" . "$B!?(B") ( "$B!@(B" . "$B!@(B") ( "$B!A(B" . "$B!A(B") ( "$B!B(B" . "$B!B(B") ( "$B!C(B" . "$B!C(B") ( "$B!D(B" . "$B!D(B") ( "$B!E(B" . "$B!E(B") ( "$B!F(B" . "$B!F(B") ( "$B!G(B" . "$B!G(B") ( "$B!H(B" . "$B!H(B") ( "$B!I(B" . "$B!I(B") ( "$B!J(B" . "$B!J(B") ( "$B!K(B" . "$B!K(B") ( "$B!L(B" . "$B!L(B") ( "$B!M(B" . "$B!M(B") ( "$B!N(B" . "$B!N(B") ( "$B!O(B" . "$B!O(B") ( "$B!P(B" . "$B!P(B") ( "$B!Q(B" . "$B!Q(B") ( "$B!R(B" . "$B!R(B") ( "$B!S(B" . "$B!S(B") ( "$B!T(B" . "$B!T(B") ( "$B!U(B" . "$B!U(B") ( "$B!V(B" . "$B!V(B") ( "$B!W(B" . "$B!W(B") ( "$B!X(B" . "$B!X(B") ( "$B!Y(B" . "$B!Y(B") ( "$B!Z(B" . "$B!Z(B") ( "$B![(B" . "$B![(B") ( "$B!\(B" . "$B!\(B") ( "$B!](B" . "$B!](B") ( "$B!^(B" . "$B!^(B") ( "$B!_(B" . "$B!_(B") ( "$B!`(B" . "$B!`(B") ( "$B!a(B" . "$B!a(B") ( "$B!b(B" . "$B!b(B") ( "$B!c(B" . "$B!c(B") ( "$B!d(B" . "$B!d(B") ( "$B!e(B" . "$B!e(B") ( "$B!f(B" . "$B!f(B") ( "$B!g(B" . "$B!g(B") ( "$B!h(B" . "$B!h(B") ( "$B!i(B" . "$B!i(B") ( "$B!j(B" . "$B!j(B") ( "$B!k(B" . "$B!k(B") ( "$B!l(B" . "$B!l(B") ( "$B!m(B" . "$B!m(B") ( "$B!n(B" . "$B!n(B") ( "$B!o(B" . "$B!o(B") ( "$B!p(B" . "$B!p(B") ( "$B!q(B" . "$B!q(B") ( "$B!r(B" . "$B!r(B") ( "$B!s(B" . "$B!s(B") ( "$B!t(B" . "$B!t(B") ( "$B!u(B" . "$B!u(B") ( "$B!v(B" . "$B!v(B") ( "$B!w(B" . "$B!w(B") ( "$B!x(B" . "$B!x(B") ( "$B!y(B" . "$B!y(B") ( "$B!z(B" . "$B!z(B") ( "$B!{(B" . "$B!{(B") ( "$B!|(B" . "$B!|(B") ( "$B!}(B" . "$B!}(B") ( "$B!~(B" . "$B!~(B") )) (defvar *ku2-alist* '( ( "$B"!(B" . "$B"!(B") ( "$B""(B" . "$B""(B") ( "$B"#(B" . "$B"#(B") ( "$B"$(B" . "$B"$(B") ( "$B"%(B" . "$B"%(B") ( "$B"&(B" . "$B"&(B") ( "$B"'(B" . "$B"'(B") ( "$B"((B" . "$B"((B") ( "$B")(B" . "$B")(B") ( "$B"*(B" . "$B"*(B") ( "$B"+(B" . "$B"+(B") ( "$B",(B" . "$B",(B") ( "$B"-(B" . "$B"-(B") ( "$B".(B" . "$B".(B") ; ( "$B"/(B" . "$B"/(B") ; ( "$B"0(B" . "$B"0(B") ; ( "$B"1(B" . "$B"1(B") ; ( "$B"2(B" . "$B"2(B") ; ( "$B"3(B" . "$B"3(B") ; ( "$B"4(B" . "$B"4(B") ; ( "$B"5(B" . "$B"5(B") ; ( "$B"6(B" . "$B"6(B") ; ( "$B"7(B" . "$B"7(B") ; ( "$B"8(B" . "$B"8(B") ; ( "$B"9(B" . "$B"9(B") ( "$B":(B" . "$B":(B") ( "$B";(B" . "$B";(B") ( "$B"<(B" . "$B"<(B") ( "$B"=(B" . "$B"=(B") ( "$B">(B" . "$B">(B") ( "$B"?(B" . "$B"?(B") ( "$B"@(B" . "$B"@(B") ( "$B"A(B" . "$B"A(B") ; ( "$B"B(B" . "$B"B(B") ; ( "$B"C(B" . "$B"C(B") ; ( "$B"D(B" . "$B"D(B") ; ( "$B"E(B" . "$B"E(B") ; ( "$B"F(B" . "$B"F(B") ; ( "$B"G(B" . "$B"G(B") ; ( "$B"H(B" . "$B"H(B") ; ( "$B"I(B" . "$B"I(B") ( "$B"J(B" . "$B"J(B") ( "$B"K(B" . "$B"K(B") ( "$B"L(B" . "$B"L(B") ( "$B"M(B" . "$B"M(B") ( "$B"N(B" . "$B"N(B") ( "$B"O(B" . "$B"O(B") ( "$B"P(B" . "$B"P(B") ; ( "$B"Q(B" . "$B"Q(B") ; ( "$B"R(B" . "$B"R(B") ; ( "$B"S(B" . "$B"S(B") ; ( "$B"T(B" . "$B"T(B") ; ( "$B"U(B" . "$B"U(B") ; ( "$B"V(B" . "$B"V(B") ; ( "$B"W(B" . "$B"W(B") ; ( "$B"X(B" . "$B"X(B") ; ( "$B"Y(B" . "$B"Y(B") ; ( "$B"Z(B" . "$B"Z(B") ; ( "$B"[(B" . "$B"[(B") ( "$B"\(B" . "$B"\(B") ( "$B"](B" . "$B"](B") ( "$B"^(B" . "$B"^(B") ( "$B"_(B" . "$B"_(B") ( "$B"`(B" . "$B"`(B") ( "$B"a(B" . "$B"a(B") ( "$B"b(B" . "$B"b(B") ( "$B"c(B" . "$B"c(B") ( "$B"d(B" . "$B"d(B") ( "$B"e(B" . "$B"e(B") ( "$B"f(B" . "$B"f(B") ( "$B"g(B" . "$B"g(B") ( "$B"h(B" . "$B"h(B") ( "$B"i(B" . "$B"i(B") ( "$B"j(B" . "$B"j(B") ; ( "$B"k(B" . "$B"k(B") ; ( "$B"l(B" . "$B"l(B") ; ( "$B"m(B" . "$B"m(B") ; ( "$B"n(B" . "$B"n(B") ; ( "$B"o(B" . "$B"o(B") ; ( "$B"p(B" . "$B"p(B") ; ( "$B"q(B" . "$B"q(B") ( "$B"r(B" . "$B"r(B") ( "$B"s(B" . "$B"s(B") ( "$B"t(B" . "$B"t(B") ( "$B"u(B" . "$B"u(B") ( "$B"v(B" . "$B"v(B") ( "$B"w(B" . "$B"w(B") ( "$B"x(B" . "$B"x(B") ( "$B"y(B" . "$B"y(B") ; ( "$B"z(B" . "$B"z(B") ; ( "$B"{(B" . "$B"{(B") ; ( "$B"|(B" . "$B"|(B") ; ( "$B"}(B" . "$B"}(B") ( "$B"~(B" . "$B"~(B") )) (defvar egg:*symbol-alist* (append *ku1-alist* *ku2-alist*)) (defvar *ku3-alist* '( ;I ( "$B#!(B" . "$B#!(B") ;II ( "$B#"(B" . "$B#"(B") ;III ( "$B##(B" . "$B##(B") ;IV ( "$B#$(B" . "$B#$(B") ;V ( "$B#%(B" . "$B#%(B") ;VI ( "$B#&(B" . "$B#&(B") ;VII ( "$B#'(B" . "$B#'(B") ;VIII ( "$B#((B" . "$B#((B") ;IX ( "$B#)(B" . "$B#)(B") ;X ( "$B#*(B" . "$B#*(B") ;XI ( "$B#+(B" . "$B#+(B") ;XII ( "$B#,(B" . "$B#,(B") ;XIII ( "$B#-(B" . "$B#-(B") ;XIV ( "$B#.(B" . "$B#.(B") ;XV ( "$B#/(B" . "$B#/(B") ( "$B#0(B" . "$B#0(B") ( "$B#1(B" . "$B#1(B") ( "$B#2(B" . "$B#2(B") ( "$B#3(B" . "$B#3(B") ( "$B#4(B" . "$B#4(B") ( "$B#5(B" . "$B#5(B") ( "$B#6(B" . "$B#6(B") ( "$B#7(B" . "$B#7(B") ( "$B#8(B" . "$B#8(B") ( "$B#9(B" . "$B#9(B") ;1/2 ( "$B#:(B" . "$B#:(B") ;1/3 ( "$B#;(B" . "$B#;(B") ;1/4 ( "$B#<(B" . "$B#<(B") ;2/3 ( "$B#=(B" . "$B#=(B") ;3/4 ( "$B#>(B" . "$B#>(B") ; ( "$B#?(B" . "$B#?(B") ; ( "$B#@(B" . "$B#@(B") ( "$B#A(B" . "$B#A(B") ( "$B#B(B" . "$B#B(B") ( "$B#C(B" . "$B#C(B") ( "$B#D(B" . "$B#D(B") ( "$B#E(B" . "$B#E(B") ( "$B#F(B" . "$B#F(B") ( "$B#G(B" . "$B#G(B") ( "$B#H(B" . "$B#H(B") ( "$B#I(B" . "$B#I(B") ( "$B#J(B" . "$B#J(B") ( "$B#K(B" . "$B#K(B") ( "$B#L(B" . "$B#L(B") ( "$B#M(B" . "$B#M(B") ( "$B#N(B" . "$B#N(B") ( "$B#O(B" . "$B#O(B") ( "$B#P(B" . "$B#P(B") ( "$B#Q(B" . "$B#Q(B") ( "$B#R(B" . "$B#R(B") ( "$B#S(B" . "$B#S(B") ( "$B#T(B" . "$B#T(B") ( "$B#U(B" . "$B#U(B") ( "$B#V(B" . "$B#V(B") ( "$B#W(B" . "$B#W(B") ( "$B#X(B" . "$B#X(B") ( "$B#Y(B" . "$B#Y(B") ( "$B#Z(B" . "$B#Z(B") ; ( "$B#[(B" . "$B#[(B") ; ( "$B#\(B" . "$B#\(B") ; ( "$B#](B" . "$B#](B") ; ( "$B#^(B" . "$B#^(B") ; ( "$B#_(B" . "$B#_(B") ; ( "$B#`(B" . "$B#`(B") ( "$B#a(B" . "$B#a(B") ( "$B#b(B" . "$B#b(B") ( "$B#c(B" . "$B#c(B") ( "$B#d(B" . "$B#d(B") ( "$B#e(B" . "$B#e(B") ( "$B#f(B" . "$B#f(B") ( "$B#g(B" . "$B#g(B") ( "$B#h(B" . "$B#h(B") ( "$B#i(B" . "$B#i(B") ( "$B#j(B" . "$B#j(B") ( "$B#k(B" . "$B#k(B") ( "$B#l(B" . "$B#l(B") ( "$B#m(B" . "$B#m(B") ( "$B#n(B" . "$B#n(B") ( "$B#o(B" . "$B#o(B") ( "$B#p(B" . "$B#p(B") ( "$B#q(B" . "$B#q(B") ( "$B#r(B" . "$B#r(B") ( "$B#s(B" . "$B#s(B") ( "$B#t(B" . "$B#t(B") ( "$B#u(B" . "$B#u(B") ( "$B#v(B" . "$B#v(B") ( "$B#w(B" . "$B#w(B") ( "$B#x(B" . "$B#x(B") ( "$B#y(B" . "$B#y(B") ( "$B#z(B" . "$B#z(B") ; ( "$B#{(B" . "$B#{(B") ; ( "$B#|(B" . "$B#|(B") ; ( "$B#}(B" . "$B#}(B") ; ( "$B#~(B" . "$B#~(B") )) (defvar egg:*alphanumeric-alist* *ku3-alist*) (defvar *ku4-alist* '( ( "$B$!(B" . "$B$!(B") ( "$B$"(B" . "$B$"(B") ( "$B$#(B" . "$B$#(B") ( "$B$$(B" . "$B$$(B") ( "$B$%(B" . "$B$%(B") ( "$B$&(B" . "$B$&(B") ( "$B$'(B" . "$B$'(B") ( "$B$((B" . "$B$((B") ( "$B$)(B" . "$B$)(B") ( "$B$*(B" . "$B$*(B") ( "$B$+(B" . "$B$+(B") ( "$B$,(B" . "$B$,(B") ( "$B$-(B" . "$B$-(B") ( "$B$.(B" . "$B$.(B") ( "$B$/(B" . "$B$/(B") ( "$B$0(B" . "$B$0(B") ( "$B$1(B" . "$B$1(B") ( "$B$2(B" . "$B$2(B") ( "$B$3(B" . "$B$3(B") ( "$B$4(B" . "$B$4(B") ( "$B$5(B" . "$B$5(B") ( "$B$6(B" . "$B$6(B") ( "$B$7(B" . "$B$7(B") ( "$B$8(B" . "$B$8(B") ( "$B$9(B" . "$B$9(B") ( "$B$:(B" . "$B$:(B") ( "$B$;(B" . "$B$;(B") ( "$B$<(B" . "$B$<(B") ( "$B$=(B" . "$B$=(B") ( "$B$>(B" . "$B$>(B") ( "$B$?(B" . "$B$?(B") ( "$B$@(B" . "$B$@(B") ( "$B$A(B" . "$B$A(B") ( "$B$B(B" . "$B$B(B") ( "$B$C(B" . "$B$C(B") ( "$B$D(B" . "$B$D(B") ( "$B$E(B" . "$B$E(B") ( "$B$F(B" . "$B$F(B") ( "$B$G(B" . "$B$G(B") ( "$B$H(B" . "$B$H(B") ( "$B$I(B" . "$B$I(B") ( "$B$J(B" . "$B$J(B") ( "$B$K(B" . "$B$K(B") ( "$B$L(B" . "$B$L(B") ( "$B$M(B" . "$B$M(B") ( "$B$N(B" . "$B$N(B") ( "$B$O(B" . "$B$O(B") ( "$B$P(B" . "$B$P(B") ( "$B$Q(B" . "$B$Q(B") ( "$B$R(B" . "$B$R(B") ( "$B$S(B" . "$B$S(B") ( "$B$T(B" . "$B$T(B") ( "$B$U(B" . "$B$U(B") ( "$B$V(B" . "$B$V(B") ( "$B$W(B" . "$B$W(B") ( "$B$X(B" . "$B$X(B") ( "$B$Y(B" . "$B$Y(B") ( "$B$Z(B" . "$B$Z(B") ( "$B$[(B" . "$B$[(B") ( "$B$\(B" . "$B$\(B") ( "$B$](B" . "$B$](B") ( "$B$^(B" . "$B$^(B") ( "$B$_(B" . "$B$_(B") ( "$B$`(B" . "$B$`(B") ( "$B$a(B" . "$B$a(B") ( "$B$b(B" . "$B$b(B") ( "$B$c(B" . "$B$c(B") ( "$B$d(B" . "$B$d(B") ( "$B$e(B" . "$B$e(B") ( "$B$f(B" . "$B$f(B") ( "$B$g(B" . "$B$g(B") ( "$B$h(B" . "$B$h(B") ( "$B$i(B" . "$B$i(B") ( "$B$j(B" . "$B$j(B") ( "$B$k(B" . "$B$k(B") ( "$B$l(B" . "$B$l(B") ( "$B$m(B" . "$B$m(B") ( "$B$n(B" . "$B$n(B") ( "$B$o(B" . "$B$o(B") ( "$B$p(B" . "$B$p(B") ( "$B$q(B" . "$B$q(B") ( "$B$r(B" . "$B$r(B") ( "$B$s(B" . "$B$s(B") ; ( "$B$t(B" . "$B$t(B") ; ( "$B$u(B" . "$B$u(B") ; ( "$B$v(B" . "$B$v(B") ; ( "$B$w(B" . "$B$w(B") ; ( "$B$x(B" . "$B$x(B") ; ( "$B$y(B" . "$B$y(B") ; ( "$B$z(B" . "$B$z(B") ; ( "$B${(B" . "$B${(B") ; ( "$B$|(B" . "$B$|(B") ; ( "$B$}(B" . "$B$}(B") ; ( "$B$~(B" . "$B$~(B") )) (defvar egg:*hiragana-alist* *ku4-alist*) (defvar *ku5-alist* '( ( "$B%!(B" . "$B%!(B") ( "$B%"(B" . "$B%"(B") ( "$B%#(B" . "$B%#(B") ( "$B%$(B" . "$B%$(B") ( "$B%%(B" . "$B%%(B") ( "$B%&(B" . "$B%&(B") ( "$B%'(B" . "$B%'(B") ( "$B%((B" . "$B%((B") ( "$B%)(B" . "$B%)(B") ( "$B%*(B" . "$B%*(B") ( "$B%+(B" . "$B%+(B") ( "$B%,(B" . "$B%,(B") ( "$B%-(B" . "$B%-(B") ( "$B%.(B" . "$B%.(B") ( "$B%/(B" . "$B%/(B") ( "$B%0(B" . "$B%0(B") ( "$B%1(B" . "$B%1(B") ( "$B%2(B" . "$B%2(B") ( "$B%3(B" . "$B%3(B") ( "$B%4(B" . "$B%4(B") ( "$B%5(B" . "$B%5(B") ( "$B%6(B" . "$B%6(B") ( "$B%7(B" . "$B%7(B") ( "$B%8(B" . "$B%8(B") ( "$B%9(B" . "$B%9(B") ( "$B%:(B" . "$B%:(B") ( "$B%;(B" . "$B%;(B") ( "$B%<(B" . "$B%<(B") ( "$B%=(B" . "$B%=(B") ( "$B%>(B" . "$B%>(B") ( "$B%?(B" . "$B%?(B") ( "$B%@(B" . "$B%@(B") ( "$B%A(B" . "$B%A(B") ( "$B%B(B" . "$B%B(B") ( "$B%C(B" . "$B%C(B") ( "$B%D(B" . "$B%D(B") ( "$B%E(B" . "$B%E(B") ( "$B%F(B" . "$B%F(B") ( "$B%G(B" . "$B%G(B") ( "$B%H(B" . "$B%H(B") ( "$B%I(B" . "$B%I(B") ( "$B%J(B" . "$B%J(B") ( "$B%K(B" . "$B%K(B") ( "$B%L(B" . "$B%L(B") ( "$B%M(B" . "$B%M(B") ( "$B%N(B" . "$B%N(B") ( "$B%O(B" . "$B%O(B") ( "$B%P(B" . "$B%P(B") ( "$B%Q(B" . "$B%Q(B") ( "$B%R(B" . "$B%R(B") ( "$B%S(B" . "$B%S(B") ( "$B%T(B" . "$B%T(B") ( "$B%U(B" . "$B%U(B") ( "$B%V(B" . "$B%V(B") ( "$B%W(B" . "$B%W(B") ( "$B%X(B" . "$B%X(B") ( "$B%Y(B" . "$B%Y(B") ( "$B%Z(B" . "$B%Z(B") ( "$B%[(B" . "$B%[(B") ( "$B%\(B" . "$B%\(B") ( "$B%](B" . "$B%](B") ( "$B%^(B" . "$B%^(B") ( "$B%_(B" . "$B%_(B") ( "$B%`(B" . "$B%`(B") ( "$B%a(B" . "$B%a(B") ( "$B%b(B" . "$B%b(B") ( "$B%c(B" . "$B%c(B") ( "$B%d(B" . "$B%d(B") ( "$B%e(B" . "$B%e(B") ( "$B%f(B" . "$B%f(B") ( "$B%g(B" . "$B%g(B") ( "$B%h(B" . "$B%h(B") ( "$B%i(B" . "$B%i(B") ( "$B%j(B" . "$B%j(B") ( "$B%k(B" . "$B%k(B") ( "$B%l(B" . "$B%l(B") ( "$B%m(B" . "$B%m(B") ( "$B%n(B" . "$B%n(B") ( "$B%o(B" . "$B%o(B") ( "$B%p(B" . "$B%p(B") ( "$B%q(B" . "$B%q(B") ( "$B%r(B" . "$B%r(B") ( "$B%s(B" . "$B%s(B") ( "$B%t(B" . "$B%t(B") ( "$B%u(B" . "$B%u(B") ( "$B%v(B" . "$B%v(B") ; ( "$B%w(B" . "$B%w(B") ; ( "$B%x(B" . "$B%x(B") ; ( "$B%y(B" . "$B%y(B") ; ( "$B%z(B" . "$B%z(B") ; ( "$B%{(B" . "$B%{(B") ; ( "$B%|(B" . "$B%|(B") ; ( "$B%}(B" . "$B%}(B") ; ( "$B%~(B" . "$B%~(B") )) (defvar egg:*katakana-alist* *ku5-alist*) (defvar *ku6-alist* '( ( "$B&!(B" . "$B&!(B") ( "$B&"(B" . "$B&"(B") ( "$B&#(B" . "$B&#(B") ( "$B&$(B" . "$B&$(B") ( "$B&%(B" . "$B&%(B") ( "$B&&(B" . "$B&&(B") ( "$B&'(B" . "$B&'(B") ( "$B&((B" . "$B&((B") ( "$B&)(B" . "$B&)(B") ( "$B&*(B" . "$B&*(B") ( "$B&+(B" . "$B&+(B") ( "$B&,(B" . "$B&,(B") ( "$B&-(B" . "$B&-(B") ( "$B&.(B" . "$B&.(B") ( "$B&/(B" . "$B&/(B") ( "$B&0(B" . "$B&0(B") ( "$B&1(B" . "$B&1(B") ( "$B&2(B" . "$B&2(B") ( "$B&3(B" . "$B&3(B") ( "$B&4(B" . "$B&4(B") ( "$B&5(B" . "$B&5(B") ( "$B&6(B" . "$B&6(B") ( "$B&7(B" . "$B&7(B") ( "$B&8(B" . "$B&8(B") ; ( "$B&9(B" . "$B&9(B") ; ( "$B&:(B" . "$B&:(B") ; ( "$B&;(B" . "$B&;(B") ; ( "$B&<(B" . "$B&<(B") ; ( "$B&=(B" . "$B&=(B") ; ( "$B&>(B" . "$B&>(B") ; ( "$B&?(B" . "$B&?(B") ; ( "$B&@(B" . "$B&@(B") ( "$B&A(B" . "$B&A(B") ( "$B&B(B" . "$B&B(B") ( "$B&C(B" . "$B&C(B") ( "$B&D(B" . "$B&D(B") ( "$B&E(B" . "$B&E(B") ( "$B&F(B" . "$B&F(B") ( "$B&G(B" . "$B&G(B") ( "$B&H(B" . "$B&H(B") ( "$B&I(B" . "$B&I(B") ( "$B&J(B" . "$B&J(B") ( "$B&K(B" . "$B&K(B") ( "$B&L(B" . "$B&L(B") ( "$B&M(B" . "$B&M(B") ( "$B&N(B" . "$B&N(B") ( "$B&O(B" . "$B&O(B") ( "$B&P(B" . "$B&P(B") ( "$B&Q(B" . "$B&Q(B") ( "$B&R(B" . "$B&R(B") ( "$B&S(B" . "$B&S(B") ( "$B&T(B" . "$B&T(B") ( "$B&U(B" . "$B&U(B") ( "$B&V(B" . "$B&V(B") ( "$B&W(B" . "$B&W(B") ( "$B&X(B" . "$B&X(B") ; ( "$B&Y(B" . "$B&Y(B") ; ( "$B&Z(B" . "$B&Z(B") ; ( "$B&[(B" . "$B&[(B") ; ( "$B&\(B" . "$B&\(B") ; ( "$B&](B" . "$B&](B") ; ( "$B&^(B" . "$B&^(B") ; ( "$B&_(B" . "$B&_(B") ; ( "$B&`(B" . "$B&`(B") ;(a) ( "$B&a(B" . "$B&a(B") ;(b) ( "$B&b(B" . "$B&b(B") ;(c) ( "$B&c(B" . "$B&c(B") ;(d) ( "$B&d(B" . "$B&d(B") ;(e) ( "$B&e(B" . "$B&e(B") ;(f) ( "$B&f(B" . "$B&f(B") ;(g) ( "$B&g(B" . "$B&g(B") ;(h) ( "$B&h(B" . "$B&h(B") ;(i) ( "$B&i(B" . "$B&i(B") ;(j) ( "$B&j(B" . "$B&j(B") ;(k) ( "$B&k(B" . "$B&k(B") ;(l) ( "$B&l(B" . "$B&l(B") ;(m) ( "$B&m(B" . "$B&m(B") ;(n) ( "$B&n(B" . "$B&n(B") ;(o) ( "$B&o(B" . "$B&o(B") ;(p) ( "$B&p(B" . "$B&p(B") ;(q) ( "$B&q(B" . "$B&q(B") ;(r) ( "$B&r(B" . "$B&r(B") ;(s) ( "$B&s(B" . "$B&s(B") ;(t) ( "$B&t(B" . "$B&t(B") ;(u) ( "$B&u(B" . "$B&u(B") ;(v) ( "$B&v(B" . "$B&v(B") ;(w) ( "$B&w(B" . "$B&w(B") ;(x) ( "$B&x(B" . "$B&x(B") ;(y) ( "$B&y(B" . "$B&y(B") ;(z) ( "$B&z(B" . "$B&z(B") ; ( "$B&{(B" . "$B&{(B") ; ( "$B&|(B" . "$B&|(B") ; ( "$B&}(B" . "$B&}(B") ; ( "$B&~(B" . "$B&~(B") )) (defvar egg:*greek-alist* *ku6-alist*) (defvar *ku7-alist* '( ( "$B'!(B" . "$B'!(B") ( "$B'"(B" . "$B'"(B") ( "$B'#(B" . "$B'#(B") ( "$B'$(B" . "$B'$(B") ( "$B'%(B" . "$B'%(B") ( "$B'&(B" . "$B'&(B") ( "$B''(B" . "$B''(B") ( "$B'((B" . "$B'((B") ( "$B')(B" . "$B')(B") ( "$B'*(B" . "$B'*(B") ( "$B'+(B" . "$B'+(B") ( "$B',(B" . "$B',(B") ( "$B'-(B" . "$B'-(B") ( "$B'.(B" . "$B'.(B") ( "$B'/(B" . "$B'/(B") ( "$B'0(B" . "$B'0(B") ( "$B'1(B" . "$B'1(B") ( "$B'2(B" . "$B'2(B") ( "$B'3(B" . "$B'3(B") ( "$B'4(B" . "$B'4(B") ( "$B'5(B" . "$B'5(B") ( "$B'6(B" . "$B'6(B") ( "$B'7(B" . "$B'7(B") ( "$B'8(B" . "$B'8(B") ( "$B'9(B" . "$B'9(B") ( "$B':(B" . "$B':(B") ( "$B';(B" . "$B';(B") ( "$B'<(B" . "$B'<(B") ( "$B'=(B" . "$B'=(B") ( "$B'>(B" . "$B'>(B") ( "$B'?(B" . "$B'?(B") ( "$B'@(B" . "$B'@(B") ( "$B'A(B" . "$B'A(B") ;(1) ( "$B'B(B" . "$B'B(B") ;(2) ( "$B'C(B" . "$B'C(B") ;(3) ( "$B'D(B" . "$B'D(B") ;(4) ( "$B'E(B" . "$B'E(B") ;(5) ( "$B'F(B" . "$B'F(B") ;(6) ( "$B'G(B" . "$B'G(B") ;(7) ( "$B'H(B" . "$B'H(B") ;(8) ( "$B'I(B" . "$B'I(B") ;(9) ( "$B'J(B" . "$B'J(B") ;(10) ( "$B'K(B" . "$B'K(B") ;(11) ( "$B'L(B" . "$B'L(B") ;(12) ( "$B'M(B" . "$B'M(B") ;(13) ( "$B'N(B" . "$B'N(B") ;(14) ( "$B'O(B" . "$B'O(B") ;(15) ( "$B'P(B" . "$B'P(B") ( "$B'Q(B" . "$B'Q(B") ( "$B'R(B" . "$B'R(B") ( "$B'S(B" . "$B'S(B") ( "$B'T(B" . "$B'T(B") ( "$B'U(B" . "$B'U(B") ( "$B'V(B" . "$B'V(B") ( "$B'W(B" . "$B'W(B") ( "$B'X(B" . "$B'X(B") ( "$B'Y(B" . "$B'Y(B") ( "$B'Z(B" . "$B'Z(B") ( "$B'[(B" . "$B'[(B") ( "$B'\(B" . "$B'\(B") ( "$B'](B" . "$B'](B") ( "$B'^(B" . "$B'^(B") ( "$B'_(B" . "$B'_(B") ( "$B'`(B" . "$B'`(B") ( "$B'a(B" . "$B'a(B") ( "$B'b(B" . "$B'b(B") ( "$B'c(B" . "$B'c(B") ( "$B'd(B" . "$B'd(B") ( "$B'e(B" . "$B'e(B") ( "$B'f(B" . "$B'f(B") ( "$B'g(B" . "$B'g(B") ( "$B'h(B" . "$B'h(B") ( "$B'i(B" . "$B'i(B") ( "$B'j(B" . "$B'j(B") ( "$B'k(B" . "$B'k(B") ( "$B'l(B" . "$B'l(B") ( "$B'm(B" . "$B'm(B") ( "$B'n(B" . "$B'n(B") ( "$B'o(B" . "$B'o(B") ( "$B'p(B" . "$B'p(B") ( "$B'q(B" . "$B'q(B") ;i ( "$B'r(B" . "$B'r(B") ;ii ( "$B's(B" . "$B's(B") ;iii ( "$B't(B" . "$B't(B") ;iv ( "$B'u(B" . "$B'u(B") ;v ( "$B'v(B" . "$B'v(B") ;vi ( "$B'w(B" . "$B'w(B") ;vii ( "$B'x(B" . "$B'x(B") ;viii ( "$B'y(B" . "$B'y(B") ;ix ( "$B'z(B" . "$B'z(B") ;x ( "$B'{(B" . "$B'{(B") ;| ( "$B'|(B" . "$B'|(B") ;' ( "$B'}(B" . "$B'}(B") ;'' ( "$B'~(B" . "$B'~(B") )) (defvar egg:*russian-alist* *ku7-alist*) (defvar *ku8-alist* '( ( "$B(!(B" . "$B(!(B") ( "$B("(B" . "$B("(B") ( "$B(#(B" . "$B(#(B") ( "$B($(B" . "$B($(B") ( "$B(%(B" . "$B(%(B") ( "$B(&(B" . "$B(&(B") ( "$B('(B" . "$B('(B") ( "$B(((B" . "$B(((B") ( "$B()(B" . "$B()(B") ( "$B(*(B" . "$B(*(B") ( "$B(+(B" . "$B(+(B") ( "$B(,(B" . "$B(,(B") ( "$B(-(B" . "$B(-(B") ( "$B(.(B" . "$B(.(B") ( "$B(/(B" . "$B(/(B") ( "$B(0(B" . "$B(0(B") ( "$B(1(B" . "$B(1(B") ( "$B(2(B" . "$B(2(B") ( "$B(3(B" . "$B(3(B") ( "$B(4(B" . "$B(4(B") ( "$B(5(B" . "$B(5(B") ( "$B(6(B" . "$B(6(B") ( "$B(7(B" . "$B(7(B") ( "$B(8(B" . "$B(8(B") ( "$B(9(B" . "$B(9(B") ( "$B(:(B" . "$B(:(B") ( "$B(;(B" . "$B(;(B") ( "$B(<(B" . "$B(<(B") ( "$B(=(B" . "$B(=(B") ( "$B(>(B" . "$B(>(B") ( "$B(?(B" . "$B(?(B") ( "$B(@(B" . "$B(@(B") ; ( "$B(A(B" . "$B(A(B") ; ( "$B(B(B" . "$B(B(B") ; ( "$B(C(B" . "$B(C(B") ; ( "$B(D(B" . "$B(D(B") ; ( "$B(E(B" . "$B(E(B") ;* ( "$B(F(B" . "$B(F(B") ;* ( "$B(G(B" . "$B(G(B") ;* ( "$B(H(B" . "$B(H(B") ;* ( "$B(I(B" . "$B(I(B") ;* ( "$B(J(B" . "$B(J(B") ;* ( "$B(K(B" . "$B(K(B") ;* ( "$B(L(B" . "$B(L(B") ;* ( "$B(M(B" . "$B(M(B") ;* ( "$B(N(B" . "$B(N(B") ;* ( "$B(O(B" . "$B(O(B") ;* ( "$B(P(B" . "$B(P(B") ;* ( "$B(Q(B" . "$B(Q(B") ;* ( "$B(R(B" . "$B(R(B") ;* ( "$B(S(B" . "$B(S(B") ;* ( "$B(T(B" . "$B(T(B") ;* ( "$B(U(B" . "$B(U(B") ;* ( "$B(V(B" . "$B(V(B") ;* ( "$B(W(B" . "$B(W(B") ;* ( "$B(X(B" . "$B(X(B") ;* ( "$B(Y(B" . "$B(Y(B") ;* ( "$B(Z(B" . "$B(Z(B") ;* ( "$B([(B" . "$B([(B") ;* ( "$B(\(B" . "$B(\(B") ;* ( "$B(](B" . "$B(](B") ;* ( "$B(^(B" . "$B(^(B") ;* ( "$B(_(B" . "$B(_(B") ;* ( "$B(`(B" . "$B(`(B") ;* ( "$B(a(B" . "$B(a(B") ;* ( "$B(b(B" . "$B(b(B") ;* ( "$B(c(B" . "$B(c(B") ;* ( "$B(d(B" . "$B(d(B") ;* ( "$B(e(B" . "$B(e(B") ;* ( "$B(f(B" . "$B(f(B") ;* ( "$B(g(B" . "$B(g(B") ;* ( "$B(h(B" . "$B(h(B") ;* ( "$B(i(B" . "$B(i(B") ;* ( "$B(j(B" . "$B(j(B") ;* ( "$B(k(B" . "$B(k(B") ;* ( "$B(l(B" . "$B(l(B") ;* ( "$B(m(B" . "$B(m(B") ;* ( "$B(n(B" . "$B(n(B") ;* ( "$B(o(B" . "$B(o(B") ;* ( "$B(p(B" . "$B(p(B") ;* ( "$B(q(B" . "$B(q(B") ;* ( "$B(r(B" . "$B(r(B") ;* ( "$B(s(B" . "$B(s(B") ;* ( "$B(t(B" . "$B(t(B") ;* ( "$B(u(B" . "$B(u(B") ;* ( "$B(v(B" . "$B(v(B") ;* ( "$B(w(B" . "$B(w(B") ;* ( "$B(x(B" . "$B(x(B") ;* ( "$B(y(B" . "$B(y(B") ;* ( "$B(z(B" . "$B(z(B") ; ( "$B({(B" . "$B({(B") ; ( "$B(|(B" . "$B(|(B") ; ( "$B(}(B" . "$B(}(B") ; ( "$B(~(B" . "$B(~(B") )) (defvar egg:*keisen-alist* *ku8-alist*) (defun make-all-jis-code-alist () (let ((result nil) (ku 116)) (while (< 32 ku) (let ((ten 126)) (while (< 32 ten) (setq result (cons (let ((str (make-string 1 0))) (aset str 0 (make-char 'japanese-jisx0208 ku ten)) (cons str str)) result)) (setq ten (1- ten)))) (setq ku (1- ku))) result)) (defun make-jis-first-level-code-alist () (let ((result nil) (ku 79)) (while (<= 48 ku) (let ((ten 126)) (while (<= 33 ten) (setq result (cons (let ((str (make-string 1 0))) (aset str 0 (make-char 'japanese-jisx0208 ku ten)) (cons str str)) result)) (setq ten (1- ten)))) (setq ku (1- ku))) result)) (defun make-jis-second-level-code-alist () (let ((result nil) (ku 116)) (while (<= 80 ku) (let ((ten 126)) (while (<= 33 ten) (setq result (cons (let ((str (make-string 1 0))) (aset str 0 (make-char 'japanese-jisx0208 ku ten)) (cons str str)) result)) (setq ten (1- ten)))) (setq ku (1- ku))) result)) (defun make-jis-hojo-kanji-code-alist () (let ((result nil) (ku 109)) (while (<= 34 ku) (let ((ten 126)) (while (<= 33 ten) (setq result (cons (let ((str (make-string 1 0))) ; by T.Shingu (aset str 0 (make-char 'japanese-jisx0212 ku ten)) (cons str str)) result)) (setq ten (1- ten)))) (setq ku (1- ku))) result)) ;;;(defvar egg:*all-jis-code-alist* (make-all-jis-code-alist)) (defvar egg:*first-level-alist* (make-jis-first-level-code-alist)) (defvar egg:*second-level-alist* (make-jis-second-level-code-alist)) (defvar egg:*hojo-kanji-alist* (make-jis-hojo-kanji-code-alist)) (defvar *symbol-input-menu* (list 'menu "$B5-9fF~NO(B:" (list (cons "JIS$BF~NO(B" '(jis-code-input)) (cons "$B5-9f(B" (list 'menu "$B5-9f(B:" egg:*symbol-alist*)) (cons "$B1Q?t;z(B" (list 'menu "$B1Q?t;z(B:" egg:*alphanumeric-alist*)) (cons "$B$R$i$,$J(B" (list 'menu "$B$R$i$,$J(B:" egg:*hiragana-alist*)) (cons "$B%+%?%+%J(B" (list 'menu "$B%+%?%+%J(B:" egg:*katakana-alist*)) (cons "$B%.%j%7%cJ8;z(B" (list 'menu "$B%.%j%7%cJ8;z(B:" egg:*greek-alist*)) (cons "$B%m%7%"J8;z(B" (list 'menu "$B%m%7%"J8;z(B:" egg:*russian-alist*)) (cons "$B7S@~(B" (list 'menu "$B7S@~(B:" egg:*keisen-alist*)) ;; 92.7.8 by T.Shingu (cons "$BIt/$7;~4V$,3]$+$j$^$9!#!K(B" ;; (list 'menu "$BA4%3!<%I(B:" egg:*all-jis-code-alist*)) ))) wnn7egg-1.02.orig/elisp/xemacs21/wnn7egg-leim.el0100644000764400003210000000453407474174160021534 0ustar ishikawaishikawa;;; wnn7egg-leim.el --- Egg/Wnn-related code for LEIM ;; Copyright (C) 2001 OMRON SOFTWARE Co., Ltd. ;; Shamelessly ripped off from ;; ;; egg-leim.el --- Egg-related code for LEIM ;; Copyright (C) 1997 Stephen Turnbull ;; Copyright (C) 1997 Free Software Foundation, Inc. ;; ;; Shamelessly ripped off from ;; ;; skk-leim.el --- SKK related code for LEIM ;; Copyright (C) 1997 ;; Murata Shuuichirou ;; ;; Author: OMRON SOFTWARE Co., Ltd. ;; Keywords: japanese, input method, LEIM, Wnn7 ;; Last Modified: 2001/5/30 00:00:00 ;; This program 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 versions 2, or (at your option) ;; any later version. ;; This program 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 XEmacs, see the file COPYING. If not, write to the Free ;; Software Foundation Inc., 59 Temple Place - Suite 330, Boston, ;; MA 02111-1307, USA. ;;; TODO ;; ;; Add pointers to Egg documentation in LEIM format (defvar wnn7-activate nil "T if wnn7egg is activeate.") (make-variable-buffer-local 'wnn7-activate) (set-default 'wnn7-activate nil) (if (featurep 'xemacs) (if (fboundp 'set-input-method) (defun select-input-method (lang) (set-input-method lang)))) (defun wnn7egg-activate (&optional name) (require 'wnn7egg) (require 'wnn7egg-cnv) (setq inactivate-current-input-method-function 'wnn7egg-inactivate) (setq wnn7egg-default-startup-file "eggrc-wnn7") (wnn7-egg-mode) (setq wnn7-activate t);;;; (toggle-egg-mode)) (defun wnn7egg-inactivate () (setq wnn7-activate nil);;;; (cond (egg:*mode-on* (toggle-egg-mode)))) (defun wnn7-p () (or (and current-input-method (string-match "japanese-egg-wnn7" current-input-method)) wnn7-activate)) (register-input-method 'japanese-egg-wnn7 "Japanese" 'wnn7egg-activate nil "Wnn7EGG - an interface to the Wnn7 kana to kanji conversion program") (provide 'wnn7egg-leim) ;;; wnn7egg-leim.el ends here wnn7egg-1.02.orig/elisp/xemacs21/wnn7egg-lib.el0100644000764400003210000023354007474174160021355 0ustar ishikawaishikawa;; Wnn7Egg is Egg modified for Wnn7, and the current maintainer ;; is OMRON SOFTWARE Co., Ltd. ;; ;; This file is part of Wnn7Egg. ;; (base code is egg/wnn.el (eggV4) and wnnfns.c) ;; ;;; ------------------------------------------------------------------ ;;; ;;; Wnn7Egg $B!J(BWnn "$B$J$J(B"$B$?$^$4!K(B--- Wnn7 Emacs Client ;;; ;;; Wnn7Egg $B$O!"!V$?$^$4Bh#3HG!W(Bv3.09 $B$r%Y!<%9$K(B $B!V$?$^$4Bh#4HG!W$NDL?.!"(B ;;; $B%i%$%V%i%jIt$rAH$_9~$s$@!"(BWnn7 $B$N0Y$N@lMQ%/%i%$%"%s%H$G$9!#(B ;;; ;;; $B$9$Y$F$N%=!<%9$,(B Emacs Lisp $B$G5-=R$5$l$F$$$k$N$G!"(BWnn SDK/Library $B$rI,MW(B ;;; $B$H$;$:!"(BGNU Emacs $B5Z$S(B XEmacs $B4D6-$G;HMQ$9$k$3$H$,$G$-$^$9!#;HMQ5vBz>r7o(B ;;; $B$O(B GPL $B$G$9!#(B ;;; ;;; GNU Emacs 20.3 $B0J9_!"(BXEmacs 21.x $B0J9_$GF0:n3NG'$7$F$$$^$9!#(B ;;; ;;; ;;; Wnn7Egg $B$O(B Wnn7 $B$N5!G=$G$"$k3Z!9F~NO!JF~NOM=B,!K!"O"A[JQ49$r%5%]!<%H(B ;;; $B$7$F$$$^$9!#(B ;;; ;;; $B!V$?$^$4!W$HFHN)!?6&B8$G$-$k$h$&$K!"1F6A$9$k$r(B ;;; "wnn7..." $B$H$$$&7A$KJQ99$7$F$$$^$9!#(B ;;; ;;; ------------------------------------------------------------------ ;;; wnn7egg-lib.el --- high level Interface with Wnn7 Jserver ;; Copyright (C) 2001 OMRON SOFTWARE Co., Ltd. ;; Author: OMRON SOFTWARE Co., Ltd. ;; Keywords: input method ;; This file is part of Wnn7Egg. ;; And this file is composed from egg/wnn.el (eggV4) and wnnfns.c (eggV3.09) ;; egg/wnn.el --- WNN Support (high level interface) in Egg ;; Input Method Architecture ;; Copyright (C) 1999,2000 PFU LIMITED ;; Author: NIIBE Yutaka ;; KATAYAMA Yoshio ;; wnnfns.c --- Jserver Interface for Mule ;; Coded by Yutaka Ishikawa at ETL (yisikawa@etl.go.jp) ;; Satoru Tomura at ETL (tomura@etl.go.jp) ;; This program 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. ;; This program 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: ;;; Change log: ;;; 2002/5/22 $BL5JQ49<-=q!"J8@a@Z$j<-=q$NDI2C=hM}$N=$@5(B ;;; 2002/5/22 $B@\F,8l%Q%i%a!<%?(B prefix-flag $B$N@_DjCM$N=$@5(B ;;; 2002/5/16 XEmacs $B$G%f!<%6<-=q$N3JG<>l=jJQ99$,@5$7$/9T$J$($J$$LdBj$NBP1~(B ;;; 2002/5/16 $B%f!<%6<-=q$N%/%i%$%"%s%HE>AwF0:n$K$*$1$kIT6q9g=$@5(B ;;; 2002/5/16 $BM=B,%b!<%I;~$K5UJQ49F0:n$,@5$7$/9T$J$($J$$LdBj$KBP1~(B ;;; 2001/9/30 v1.01 (bug fix) ;;; 2001/5/30 First Release ;;; Code: ;;; Last modified date: 2002/5/22 (require 'wnn7egg-edep) (if (featurep 'xemacs) (require 'wnn7egg-rpcx21) (require 'wnn7egg-rpc)) (defun egg:error (form &rest mesg) (apply 'notify (or form "%s") mesg) (apply 'error (or form "%s") mesg)) (defvar wnn7-message-type 'japanese) (defun wnn7-toggle-message-type () "Toggle whether wnn reports info in english or japanese." (interactive) (if (eq wnn7-message-type 'japanese) (setq wnn7-message-type 'english) (setq wnn7-message-type 'japanese))) (defvar *wnn7-message-alist* '((english ((open-wnn "Connected with Wnn on host %s") (cannot-connect "Cannot connect with Wnn") (no-rcfile "No wnn7egg-startup-file on %s") (file-saved "Wnn dictionary and frequency data recorded.") (no-dir "directory %s missing. Create it? ") (fail-dir "failed to create directory %s") (create-dir "directory %s created") (no-dict1 "dictionary file %s is missing: %s") (no-dict2 "dictionary file %s is missing. Create it? ") (create-dict "dictionary file %s is created") (no-freq1 "frequency file %s is missing: %s") (no-freq2 "frequency file %s is missing. Create it? ") (create-freq "frequency file %s is created") (no-match "unmatch dictionary and freq. file %s. Re-create it? ") (re-create-freq "frequency file %s is re-created") (henkan-mode-indicator "$B4A(B") (begin-henkan "Fence starting character: ") (end-henkan "Fence ending character: ") (kugiri-dai "Large bunsetsu separator: ") (kugiri-sho "Small bunsetsu separator: ") (face-henkan "Face for conversion: ") (face-dai "Face for large bunsetsu: ") (face-sho "Face for small bunsetsu: ") (jikouho "Entries:") (off-msg "%s %s(%s:%s) turned off.") (henkan-help "Kanji conversion mode: Bunsetsu motion commands \\[wnn7-henkan-first-bunsetu]\tFirst bunsetsu\t\\[wnn7-henkan-last-bunsetu]\tLast bunsetsu \\[wnn7-henkan-backward-bunsetu]\tPrevious bunsetsu\t\\[wnn7-henkan-forward-bunsetu]\tNext bunsetsu Bunsetsu conversion commands \\[wnn7-henkan-next-kouho-dai]\tNext larger match\t\\[wnn7-henkan-next-kouho-sho]\tNext smaller match \\[wnn7-henkan-previous-kouho]\tPrevious match\t\\[wnn7-henkan-next-kouho]\tNext match \\[wnn7-henkan-bunsetu-nobasi-dai]\tExtend bunsetsu largest\t\\[wnn7-henkan-bunsetu-chijime-dai]\tShrink bunsetsu smallest \\[wnn7-henkan-bunsetu-nobasi-sho]\tExtend bunsetsu\t\\[wnn7-henkan-bunsetu-chijime-sho]\tShrink bunsetsu \\[wnn7-henkan-select-kouho-dai]\tMenu select largest match\t\\[wnn7-henkan-select-kouho-sho]\tMenu select smallest match Conversion commands \\[wnn7-henkan-kakutei]\tComplete conversion commit\t\\[wnn7-henkan-kakutei-before-point]\tCommit before point \\[wnn7-henkan-quit]\tAbort conversion ") (hinsimei "Hinshi (product/noun) name:") (jishotouroku-yomi "Dictionary entry for$B!X(B%s$B!Y(B reading:") (touroku-jishomei "Name of dictionary:" ) (registerd "Dictonary entry$B!X(B%s$B!Y(B(%s: %s) registered in %s.") (yomi "Reading$B!'(B") (no-yomi "No dictionary entry for $B!X(B%s$B!Y(B.") (jisho "Dictionary:") (hindo "Frequency:") (kanji "Kanji:") (no-predict "Not input-predict-mode.") (no-wnn7egg "Not wnn7egg.") (no-rensou "No association candidates.") (register-notify "Dictonary entry$B!X(B%s$B!Y(B(%s: %s) registered in %s.") (cannot-remove "Cannot delete entry from system dictionary.") (enter-hindo "Enter frequency:") (remove-notify "Dictonary entry$B!X(B%s$B!Y(B(%s) removed from %s.") (removed "Dictonary entry$B!X(B%s$B!Y(B(%s) removed from %s.") (pseud-bunsetsu "pseud clause") (jishomei "Dictionary name:" ) (comment "Comment:") (jisho-comment "Dictionary:%s: comment:%s") (param ("$B#N(B ( $BBg(B ) $BJ8@a2r@O$N#N(B" "$BBgJ8@aCf$N>.J8@a$N:GBg?t(B" "$B448l$NIQEY$N%Q%i%a!<%?(B" "$B>.J8@aD9$N%Q%i%a!<%?(B" "$B448lD9$N%Q%i%a!<%?(B" "$B:#;H$C$?$h%S%C%H$N%Q%i%a!<%?(B" "$B<-=q$N%Q%i%a!<%?(B" "$B>.J8@a$NI>2ACM$N%Q%i%a!<%?(B" "$BBgJ8@aD9$N%Q%i%a!<%?(B" "$B>.J8@a?t$N%Q%i%a!<%?(B" "$B5?;wIJ;l(B $B?t;z$NIQEY(B" "$B5?;wIJ;l(B $B%+%J$NIQEY(B" "$B5?;wIJ;l(B $B1Q?t$NIQEY(B" "$B5?;wIJ;l(B $B5-9f$NIQEY(B" "$B5?;wIJ;l(B $BJD3g8L$NIQEY(B" "$B5?;wIJ;l(B $BIUB08l$NIQEY(B" "$B5?;wIJ;l(B $B3+3g8L$NIQEY(B")) )) (japanese ((open-wnn "$B%[%9%H(B %s $B$N(B Wnn $B$r5/F0$7$^$7$?(B") (cannot-connect "Wnn $B$H@\B3$G$-$^$;$s$G$7$?(B") (no-rcfile "%s $B>e$K(B wnn7egg-startup-file $B$,$"$j$^$;$s!#(B") (file-saved "Wnn$B$NIQEY>pJs!&<-=q>pJs$rB`Hr$7$^$7$?!#(B") (no-dir "$B%G%#%l%/%H%j(B %s $B$,$"$j$^$;$s!#:n$j$^$9$+(B? ") (fail-dir "$B%G%#%l%/%H%j(B %s $B$N:n@.$K<:GT$7$^$7$?(B") (create-dir "$B%G%#%l%/%H%j(B %s $B$r:n$j$^$7$?(B") (no-dict1 "$B<-=q%U%!%$%k(B %s $B$,$"$j$^$;$s(B: %s") (no-dict2 "$B<-=q%U%!%$%k(B %s $B$,$"$j$^$;$s!#:n$j$^$9$+(B? ") (create-dict "$B<-=q%U%!%$%k(B %s $B$r:n$j$^$7$?(B") (no-freq1 "$BIQEY%U%!%$%k(B %s $B$,$"$j$^$;$s(B: %s") (no-freq2 "$BIQEY%U%!%$%k(B %s $B$,$"$j$^$;$s!#:n$j$^$9$+(B? ") (create-freq "$BIQEY%U%!%$%k(B %s $B$r:n$j$^$7$?(B") (no-match "$B<-=q$HIQEY(B %s $B$N@09g@-$,$"$j$^$;$s!#:n$jD>$7$^$9$+(B? ") (re-create-freq "$BIQEY%U%!%$%k(B %s $B$r:n$jD>$7$^$7$?(B") (henkan-mode-indicator "$B4A(B") (begin-henkan "$BJQ493+;OJ8;zNs(B: ") (end-henkan "$BJQ49=*N;J8;zNs(B: ") (kugiri-dai "$BBgJ8@a6h@Z$jJ8;zNs(B: ") (kugiri-sho "$B>.J8@a6h@Z$jJ8;zNs(B: ") (face-henkan "$BJQ496h4VI=<(B0@-(B: ") (face-dai "$BBgJ8@a6h4VI=<(B0@-(B: ") (face-sho "$B>.J8@a6h4VI=<(B0@-(B: ") (jikouho "$BA0J8@a(B\t\\[wnn7-henkan-forward-bunsetu]\t$BD>8eJ8@a(B $BJQ49JQ99(B \\[wnn7-henkan-next-kouho-dai]\t$BBgJ8@a.J8@a.J8@a?-$7(B\t\\[wnn7-henkan-bunsetu-chijime-sho]\t$B>.J8@a=L$a(B \\[wnn7-henkan-select-kouho-dai]\t$BBgJ8@aJQ498uJdA*Br(B\t\\[wnn7-henkan-select-kouho-sho]\t$B>.J8@aJQ498uJdA*Br(B $BJQ493NDj(B \\[wnn7-henkan-kakutei]\t$BA4J8@a3NDj(B\t\\[wnn7-henkan-kakutei-before-point]\t$BD>A0J8@a$^$G3NDj(B \\[wnn7-henkan-quit]\t$BJQ49Cf;_(B ") (hinsimei "$BIJ;lL>(B:") (jishotouroku-yomi "$B<-=qEPO?!X(B%s$B!Y(B $BFI$_(B :") (touroku-jishomei "$BEPO?<-=qL>(B:" ) (registerd "$B<-=q9`L\!X(B%s$B!Y(B(%s: %s)$B$r(B%s$B$KEPO?$7$^$7$?!#(B" ) (yomi "$B$h$_!'(B") (no-yomi "$B<-=q9`L\!X(B%s$B!Y$O$"$j$^$;$s!#(B") (jisho "$B<-=q!'(B") (hindo " $BIQEY!'(B") (kanji "$B4A;z!'(B") (no-predict "$BF~NOM=B,%b!<%I$G$O$"$j$^$;$s!#(B") (no-wnn7egg "$B;HMQCf$N(B input method $B$O(B wnn7egg $B$G$O$"$j$^$;$s(B") (no-rensou "$BO"A[8uJd$O$"$j$^$;$s!#(B") (register-notify "$B<-=q9`L\!X(B%s$B!Y(B(%s: %s)$B$r(B%s$B$KEPO?$7$^$9!#(B") (cannot-remove "$B%7%9%F%`<-=q9`L\$O:o=|$G$-$^$;$s!#(B") (enter-hindo "$BIQEY$rF~$l$F2<$5$$(B: ") (remove-notify "$B<-=q9`L\!X(B%s$B!Y(B(%s)$B$r(B%s$B$+$i:o=|$7$^$9!#(B") (removed "$B<-=q9`L\!X(B%s$B!Y(B(%s)$B$r(B%s$B$+$i:o=|$7$^$7$?!#(B") (pseud-bunsetsu "$B5?;wJ8@a(B") (jishomei "$B<-=qL>(B:" ) (comment "$B%3%a%s%H(B: ") (jisho-comment "$B<-=q(B:%s: $B%3%a%s%H(B:%s") (param ("$B#N(B ( $BBg(B ) $BJ8@a2r@O$N#N(B" "$BBgJ8@aCf$N>.J8@a$N:GBg?t(B" "$B448l$NIQEY$N%Q%i%a!<%?(B" "$B>.J8@aD9$N%Q%i%a!<%?(B" "$B448lD9$N%Q%i%a!<%?(B" "$B:#;H$C$?$h%S%C%H$N%Q%i%a!<%?(B" "$B<-=q$N%Q%i%a!<%?(B" "$B>.J8@a$NI>2ACM$N%Q%i%a!<%?(B" "$BBgJ8@aD9$N%Q%i%a!<%?(B" "$B>.J8@a?t$N%Q%i%a!<%?(B" "$B5?;wIJ;l(B $B?t;z$NIQEY(B" "$B5?;wIJ;l(B $B%+%J$NIQEY(B" "$B5?;wIJ;l(B $B1Q?t$NIQEY(B" "$B5?;wIJ;l(B $B5-9f$NIQEY(B" "$B5?;wIJ;l(B $BJD3g8L$NIQEY(B" "$B5?;wIJ;l(B $BIUB08l$NIQEY(B" "$B5?;wIJ;l(B $B3+3g8L$NIQEY(B")) )))) (defun wnn7-msg-get (message) (or (nth 1 (assoc message (nth 1 (assoc wnn7-message-type *wnn7-message-alist*)))) (format "No message. Check *wnn7-message-alist* %s %s" wnn7-message-type message))) ;;; ;;; secure compatibility with eggV4 translation engine ;;; (defcustom wnn-one-level-conversion nil "*Don't use major clause (dai bunsetu/da wenjie/dae munjeol), if non-NIL.") (defcustom wnn-uniq-level 'wnn-uniq "Uniq level for candidate selection. wnn-no-uniq: Use all candidates. wnn-uniq-entry: Use only one among same dictionary entry candidates. wnn-uniq: Use only one among same hinshi candidates. (default) wnn-uniq-kanji: Use only one among same kanji candidates.") (defcustom wnn-auto-save-dictionaries 0 "*Save dictionaries automatically after N-th end conversion, if positive") ;; Retern value of system-name may differ from hostname. (defconst wnn-system-name (or (with-temp-buffer (condition-case nil (call-process "hostname" nil `(,(current-buffer) nil) "hostname") (error)) (goto-char (point-min)) (if (re-search-forward "[\0- ]" nil 0) (goto-char (1- (point)))) (if (> (point) 1) (buffer-substring 1 (point)))) (system-name))) ;;; ;;; ;;; (defvar wnn7-process nil "Process Number to Wnn7 jserver") (defvar wnn7-server-default-port 22273) (defvar wnn7-server-proc-name "Wnn7") (defvar wnn7-server-buffer-name "*Wnn7*") (defvar wnn7-server-coding-system '(fixed-euc-jp fixed-euc-jp)) (defvar wnn7-active-server-name nil "connecting server host") (defvar wnn7-active-server-port nil "connecting server port") (defcustom wnn7-usr-dic-dir (concat "usr/" (user-login-name)) "*Directory of user dictionary for Wnn.") (defmacro WNN-const (c) (cond ((eq c 'BUN_SENTOU) -1) ((eq c 'NO_EXIST) 1) ((eq c 'NO_MATCH) 10) ((eq c 'IMA_OFF) -4) ((eq c 'IMA_ON) -3) ((eq c 'CONNECT) 1) ((eq c 'CONNECT_BK) 1) ((eq c 'HIRAGANA) -1) ((eq c 'KATAKANA) -11) ((eq c 'IKEIJI_ENTRY) -50) ((eq c 'LEARNING_LEN) 3) ((eq c 'MUHENKAN_DIC) -3) ((eq c 'HINDO_NOP) -2) ((eq c 'HINDO_INC) -3) ((eq c 'DIC_RW) 0) ((eq c 'DIC_RDONLY) 1) ((eq c 'DIC_GROUP) 3) ((eq c 'DIC_MERGE) 4) ((eq c 'NOTRANS_LEARN) 1) ((eq c 'BMODIFY_LEARN) 2) ((eq c 'WNN_REV_DICT) 3) ((eq c 'WNN_FI_SYSTEM_DICT) 6) ((eq c 'WNN_FI_USER_DICT) 7) ((eq c 'WNN_GROUP_DICT) 9) ((eq c 'WNN_MERGE_DICT) 10) ((eq c 'WNNDS_FILE_READ_ERROR) 90))) ;; ((eq c 'DIC_NO_TEMPS) ?\x3f))) ; cannot eval on xemacs ;; Retern value of system-name may differ from hostname. (defconst wnn-system-name (or (with-temp-buffer (condition-case nil (call-process "hostname" nil `(,(current-buffer) nil) "hostname") (error)) (goto-char (point-min)) (if (re-search-forward "[\0- ]" nil 0) (goto-char (1- (point)))) (if (> (point) 1) (buffer-substring 1 (point)))) (system-name))) ;;; ;;; environment information ;;; (defvar wnn7-env-norm nil "Normal Dic-search Environment for Wnn7 conversion server") (defvar wnn7-env-rev nil "Reverse Dic-search Environment for Wnn7 conversion server") (defvar env-normal t "Select translation mode to normal if t") (defun wnn7-env-create (proc env-id &optional name) (if name (set (setq name (make-symbol name)) (make-vector 5 nil))) (vector proc env-id name (make-vector 2 (WNN-const DIC_RDONLY)))) (defsubst wnn7env-get-proc (env) (aref env 0)) (defsubst wnn7env-get-env-id (env) (aref env 1)) (defsubst wnn7env-get-hinshi (env h) (or (get (aref env 2) h) -1)) (defsubst wnn7env-set-hinshi (env h v)(put (aref env 2) h v)) (defsubst wnn7env-get-auto-learn (env)(aref env 3)) (defsubst wnn7env-get-notrans (env) (aref (wnn7env-get-auto-learn env) 0)) (defsubst wnn7env-get-bmodify (env) (aref (wnn7env-get-auto-learn env) 1)) (defsubst wnn7env-set-notrans (env v) (aset (wnn7env-get-auto-learn env) 0 v)) (defsubst wnn7env-set-bmodify (env v) (aset (wnn7env-get-auto-learn env) 1 v)) (defun wnn7env-get-client-file (env name) (let ((hash (intern-soft name (symbol-value (aref env 2))))) (and hash (symbol-value hash)))) (defun wnn7env-set-client-file (env name) (set (intern (concat wnn-system-name "!" name) (symbol-value (aref env 2))) name)) (defun wnn7-set-hinshi (env sym name) (let ((hinshi (wnn7rpc-hinshi-number (wnn7env-get-proc env) name))) (if (>= hinshi 0) (wnn7env-set-hinshi env sym hinshi)))) ;;; ;;; client information & bunsetsu information ;;; ;;;* $BJ8@a%j%9%H!#JQ497k2L$r.J8@aC10L$N%j%9%H$K$J$C$F$$$k(B (defvar wnn7-bun-list nil "Bunsetsu infomation for Wnn7 conversion server") ;; ::= [ ;; ;; ;; ;; ;; ] ;; ;; ::= [ ] ;; (defsubst wnn7-bunsetsu-create (env jirilen dic-no entry freq right-now hinshi status status-backward kangovect evaluation) (vector env jirilen dic-no entry freq right-now hinshi status status-backward kangovect evaluation nil nil nil nil nil nil nil nil nil nil)) (defsubst wnn7-bunsetsu-get-env (b) (aref b 0)) (defsubst wnn7-bunsetsu-set-env (b env) (aset b 0 env)) (defsubst wnn7-bunsetsu-get-jirilen (b) (aref b 1)) (defsubst wnn7-bunsetsu-get-dic-no (b) (aref b 2)) (defsubst wnn7-bunsetsu-set-dic-no (b dic) (aset b 2 dic)) (defsubst wnn7-bunsetsu-get-entry (b) (aref b 3)) (defsubst wnn7-bunsetsu-set-entry (b ent) (aset b 3 ent)) (defsubst wnn7-bunsetsu-get-freq (b) (aref b 4)) (defsubst wnn7-bunsetsu-get-right-now (b) (aref b 5)) (defsubst wnn7-bunsetsu-get-hinshi (b) (aref b 6)) (defsubst wnn7-bunsetsu-get-status (b) (aref b 7)) (defsubst wnn7-bunsetsu-get-status-backward (b) (aref b 8)) (defsubst wnn7-bunsetsu-get-kangovect (b) (aref b 9)) (defsubst wnn7-bunsetsu-get-evaluation (b) (aref b 10)) (defsubst wnn7-bunsetsu-get-converted (b) (aref b 11)) (defsubst wnn7-bunsetsu-set-converted (b cvt) (aset b 11 cvt)) (defsubst wnn7-bunsetsu-get-yomi (b) (aref b 12)) (defsubst wnn7-bunsetsu-set-yomi (b yomi) (aset b 12 yomi)) (defsubst wnn7-bunsetsu-get-fuzokugo (b) (aref b 13)) (defsubst wnn7-bunsetsu-set-fuzokugo (b fuzokugo) (aset b 13 fuzokugo)) (defsubst wnn7-bunsetsu-get-dai-evaluation (b) (aref b 14)) (defsubst wnn7-bunsetsu-set-dai-evaluation (b de) (aset b 14 de)) (defsubst wnn7-bunsetsu-get-dai-continue (b) (aref b 15)) (defsubst wnn7-bunsetsu-set-dai-continue (b dc) (aset b 15 dc)) (defsubst wnn7-bunsetsu-get-change-top (b) (aref b 16)) (defsubst wnn7-bunsetsu-set-change-top (b top) (aset b 16 top)) (defsubst wnn7-bunsetsu-get-zenkouho (b) (aref b 17)) (defsubst wnn7-bunsetsu-set-zenkouho (b z) (aset b 17 z)) (defsubst wnn7-bunsetsu-get-freq-down (b) (aref b 18)) (defsubst wnn7-bunsetsu-set-freq-down (b fd) (aset b 18 fd)) (defsubst wnn7-bunsetsu-get-fi-rel (b) (aref b 19)) (defsubst wnn7-bunsetsu-set-fi-rel (b fr) (aset b 19 fr)) (defsubst wnn7-bunsetsu-get-context (b) (aref b 20)) (defsubst wnn7-bunsetsu-set-context (b c) (aset b 20 c)) (defsubst wnn7-zenkouho-create (pos list converted dai prev-b next-b) (vector pos list converted dai prev-b next-b)) (defsubst wnn7-bunsetsu-get-zenkouho-pos (b) (aref (wnn7-bunsetsu-get-zenkouho b) 0)) (defsubst wnn7-bunsetsu-set-zenkouho-pos (b p) (aset (wnn7-bunsetsu-get-zenkouho b) 0 p)) (defsubst wnn7-bunsetsu-get-zenkouho-list (b) (aref (wnn7-bunsetsu-get-zenkouho b) 1)) (defsubst wnn7-bunsetsu-get-zenkouho-converted (b) (aref (wnn7-bunsetsu-get-zenkouho b) 2)) (defsubst wnn7-bunsetsu-get-zenkouho-dai (b) (aref (wnn7-bunsetsu-get-zenkouho b) 3)) (defsubst wnn7-bunsetsu-get-zenkouho-prev-b (b) (aref (wnn7-bunsetsu-get-zenkouho b) 4)) (defsubst wnn7-bunsetsu-get-zenkouho-next-b (b) (aref (wnn7-bunsetsu-get-zenkouho b) 5)) (defsubst wnn7-bunsetsu-connect-prev (bunsetsu) (= (wnn7-bunsetsu-get-status bunsetsu) (WNN-const CONNECT))) (defsubst wnn7-bunsetsu-connect-next (bunsetsu) (= (wnn7-bunsetsu-get-status-backward bunsetsu) (WNN-const CONNECT_BK))) (defsubst wnn7-context-create (dic-no entry jirilen hinshi fuzokugo converted freq right-now) (vector dic-no entry jirilen hinshi fuzokugo converted freq right-now (egg-chars-in-period converted 0 (length converted)))) (defsubst wnn7-context-dic-no (context) (aref context 0)) (defsubst wnn7-context-entry (context) (aref context 1)) (defsubst wnn7-context-jirilen (context) (aref context 2)) (defsubst wnn7-context-hinshi (context) (aref context 3)) (defsubst wnn7-context-fuzokugo (context) (aref context 4)) (defsubst wnn7-context-converted (context) (aref context 5)) (defsubst wnn7-context-freq (context) (aref context 6)) (defsubst wnn7-context-set-freq (context f) (aset context 6 f)) (defsubst wnn7-context-right-now (context) (aref context 7)) (defsubst wnn7-context-set-right-now (context r) (aset context 7 r)) (defsubst wnn7-context-length (context) (aref context 8)) (defun wnn7-null-context () (list (wnn7-context-create -2 0 0 0 "" "" 0 0) (wnn7-context-create -2 0 0 0 "" "" 0 0))) (defun wnn7-get-bunsetsu-converted (bunsetsu) (concat (wnn7-bunsetsu-get-converted bunsetsu) (wnn7-bunsetsu-get-fuzokugo bunsetsu))) (defun wnn7-get-bunsetsu-source (bunsetsu) (concat (wnn7-bunsetsu-get-yomi bunsetsu) (wnn7-bunsetsu-get-fuzokugo bunsetsu))) (defun wnn7-get-major-bunsetsu-converted (bunsetsu) (mapconcat 'wnn7-get-bunsetsu-converted bunsetsu "")) (defun wnn7-get-major-bunsetsu-source (bunsetsu) (mapconcat 'wnn7-get-bunsetsu-source bunsetsu "")) (defun wnn7-major-bunsetsu-set-context (bunsetsu-list context) (while bunsetsu-list (wnn7-bunsetsu-set-context (car bunsetsu-list) context) (setq bunsetsu-list (cdr bunsetsu-list)))) (defsubst wnn7-bunsetsu-equal (bunsetsu-1 bunsetsu-2) (and (= (wnn7-bunsetsu-get-dic-no bunsetsu-1) (wnn7-bunsetsu-get-dic-no bunsetsu-2)) (= (wnn7-bunsetsu-get-entry bunsetsu-1) (wnn7-bunsetsu-get-entry bunsetsu-2)) (= (wnn7-bunsetsu-get-kangovect bunsetsu-1) (wnn7-bunsetsu-get-kangovect bunsetsu-2)) (equal (wnn7-bunsetsu-get-converted bunsetsu-1) (wnn7-bunsetsu-get-converted bunsetsu-2)) (equal (wnn7-bunsetsu-get-fuzokugo bunsetsu-1) (wnn7-bunsetsu-get-fuzokugo bunsetsu-2)))) (defun wnn7-bunsetsu-list-equal (b1 b2) (while (and b1 b2 (wnn7-bunsetsu-equal (car b1) (car b2))) (setq b1 (cdr b1) b2 (cdr b2))) (and (null b1) (null b2))) (defun wnn7-bunsetsu-list-copy (bunsetsu) (copy-sequence bunsetsu)) (defmacro wnn7-uniq-hash-string (uniq-level) `(mapconcat (lambda (b) (concat ,@(cond ((eq uniq-level 'wnn-uniq) '((number-to-string (wnn7-bunsetsu-get-hinshi b)))) ((eq uniq-level 'wnn-uniq-entry) '((number-to-string (wnn7-bunsetsu-get-dic-no b)) "+" (number-to-string (wnn7-bunsetsu-get-entry b))))) "\0" (wnn7-bunsetsu-get-converted b) "\0" (wnn7-bunsetsu-get-fuzokugo b))) bunsetsu "\0")) (defun wnn7-uniq-hash (bunsetsu hash-table) (intern (cond ((eq wnn-uniq-level 'wnn-uniq) (wnn7-uniq-hash-string wnn-uniq)) ((eq wnn-uniq-level 'wnn-uniq-entry) (wnn7-uniq-hash-string wnn-uniq-entry)) (t (wnn7-uniq-hash-string nil))) hash-table)) (defun wnn7-uniq-candidates (candidates) (if (eq wnn-uniq-level 'wnn-no-uniq) candidates (let ((hash-table (make-vector (length candidates) 0))) (delq nil (mapcar (lambda (b) (let ((sym (wnn7-uniq-hash b hash-table))) (if (null (boundp sym)) (set sym b)))) candidates))))) (defun wnn7-server-zenkouho-bun-p (bunno) (let ((bunsetsu (nth bunno wnn7-bun-list))) (if (vectorp (wnn7-bunsetsu-get-zenkouho bunsetsu)) t nil))) (defun wnn7-get-major-bunsetsu (bunno) "get major bunsetsu of bunno position." (let ((bun (nth bunno wnn7-bun-list)) bunsetsu) (while bun (setq bunsetsu (cons bun bunsetsu) bunno (1+ bunno) bun (and (wnn7-bunsetsu-get-dai-continue bun) (nth bunno wnn7-bun-list)))) (nreverse bunsetsu))) (defun wnn7-get-minor-bunsetsu (bunno) "get minor bunsetsu of bunno positon." (list (nth bunno wnn7-bun-list))) (defun wnn7-get-next-major-bunsetsu (bunno) "get all the major bunsetsu after bunno position." (let* ((bun1 (nth bunno wnn7-bun-list)) (bunno (1+ bunno)) (bun2 (nth bunno wnn7-bun-list)) bunsetsu) (while (and bun1 bun2) (if (null (wnn7-bunsetsu-get-dai-continue bun1)) (while bun2 (setq bunsetsu (cons bun2 bunsetsu) bunno (1+ bunno) bun2 (nth bunno wnn7-bun-list))) (setq bun1 (nth bunno wnn7-bun-list) bunno (1+ bunno) bun2 (nth bunno wnn7-bun-list)))) (nreverse bunsetsu))) (defun wnn7-get-pre-prev-bunsetsu (bunno) "get all bunsetsu before bunno position." (let (bunsetsu) (while (<= 0 bunno) (setq bunsetsu (cons (nth bunno wnn7-bun-list) bunsetsu) bunno (1- bunno))) bunsetsu)) (defun wnn7-get-prev-major-bunsetsu (bunno) "get part of major bunsetsu before bunno position." (let* ((bunno (1- bunno)) (bun (if (< bunno 0) nil (nth bunno wnn7-bun-list))) bunsetsu) (while bun (setq bunsetsu (cons bun bunsetsu) bunno (1- bunno)) (if (< bunno 0) (setq bun nil) (setq bun (nth bunno wnn7-bun-list)) (if (null (wnn7-bunsetsu-get-dai-continue bun)) (setq bun nil)))) (cons bunsetsu (1+ bunno)))) (defun wnn7-get-prev-minor-bunsetsu (bunno) "get minor bunsetsu before bunno position." (let ((bunno (1- bunno))) (if (< bunno 0) nil (list (nth bunno wnn7-bun-list))))) ;;; ;;; dictionary file information ;;; (defsubst wnn7dic-get-id (dic) (aref dic 0)) (defsubst wnn7dic-get-comment (dic) (aref dic 8)) (defsubst wnn7dic-get-dictname (dic) (aref dic 9)) (defsubst wnn7-dicinfo-entry (info) (aref info 0)) (defsubst wnn7-dicinfo-id (info freq) (aref info (+ 1 freq))) (defsubst wnn7-dicinfo-mode (info freq) (aref info (+ 3 freq))) (defsubst wnn7-dicinfo-enable (info) (aref info 5)) (defsubst wnn7-dicinfo-nice (info) (aref info 6)) (defsubst wnn7-dicinfo-reverse (info) (aref info 7)) (defsubst wnn7-dicinfo-comment (info) (aref info 8)) (defsubst wnn7-dicinfo-name (info freq) (aref info (+ 9 freq))) (defsubst wnn7-dicinfo-passwd (info freq) (aref info (+ 11 freq))) (defsubst wnn7-dicinfo-type (info) (aref info 13)) (defsubst wnn7-dicinfo-words (info) (aref info 14)) (defsubst wnn7-dicinfo-local (info freq) (aref info (+ 15 freq))) (defsubst wnn7-filename (p) (substitute-in-file-name (if (consp p) (concat wnn7-usr-dic-dir "/" (car p)) p))) (defsubst wnn7-client-file-p (filename) (and (stringp filename) (= (aref filename 0) ?!))) (defsubst wnn7-client-filename (filename) (substitute-in-file-name (expand-file-name (substring filename 1) "~"))) ;;;----------------------------------------------------------------------- ;;; ;;; open, connect, close ;;; (defun wnn7-comm-sentinel (proc reason) (let ((inhibit-quit t)) (if (string= (process-status proc) "closed") (kill-buffer (process-buffer proc)) (progn (delete-process proc) (kill-buffer (process-buffer proc)))))) (defun wnn7-server-start (hname) (let ((save-inhibit-quit inhibit-quit) (inhibit-quit t) (proc nil) buf msg) (unwind-protect (progn (setq buf (generate-new-buffer wnn7-server-buffer-name)) (save-excursion (set-buffer buf) (erase-buffer) (buffer-disable-undo) (set-buffer-multibyte nil) (setq egg-fixed-euc wnn7-server-coding-system)) (setq msg (format "Wnn: connecting to jserver at %s(%d)..." hname wnn7-active-server-port)) (message "%s" msg) (let ((inhibit-quit save-inhibit-quit)) (condition-case nil (setq proc (open-network-stream wnn7-server-proc-name buf hname wnn7-active-server-port)) ((error quit)))) (when proc (process-kill-without-query proc) (if (featurep 'xemacs) (set-process-coding-system proc 'binary 'binary) (set-process-coding-system proc 'no-conversion 'no-conversion)) (set-process-sentinel proc 'wnn7-comm-sentinel) (set-marker-insertion-type (process-mark proc) t)) proc) (if proc (message (concat msg "done")) (if buf (kill-buffer buf)) (setq proc nil))))) (defun wnn7-server-open (proc hname lname) (let ((result (wnn7rpc-open proc hname lname))) (when (/= 0 result) (delete-process wnn7-process) (kill-buffer (process-buffer proc)) (setq wnn7-process nil)) result)) (defun wnn7-server-connect (proc lname &optional rev) (let ((envid (wnn7rpc-connect proc lname)) (env nil)) (if (< envid 0) (progn (egg:error "%s" (wnn7rpc-get-error-message (- envid))) envid) (setq env (wnn7-env-create proc envid lname)) (wnn7-set-hinshi env 'noun "$BL>;l(B") (wnn7-set-hinshi env 'settou "$B@\F,8l(B($B$*(B)") (wnn7-set-hinshi env 'rendaku "$BO"By(B") (if rev (setq wnn7-env-rev env) (setq wnn7-env-norm env)) envid))) (defun wnn7-server-isconnect () (let ((status)) (if (and wnn7-process (setq status (process-status wnn7-process))) (if (or (equal 'open status) (equal 'run status)) t nil) nil))) (defun wnn7-server-close () "Close the connection to jserver, Dictionary and frequency files are not saved." (if wnn7-env-norm (wnn7rpc-disconnect wnn7-env-norm)) (if wnn7-env-rev (wnn7rpc-disconnect wnn7-env-rev)) (if (wnn7-server-isconnect) (wnn7rpc-close wnn7-process)) (delete-process wnn7-process) (kill-buffer (process-buffer wnn7-process)) (setq wnn7-process nil wnn7-env-norm nil wnn7-env-rev nil wnn7-bun-list nil)) (defun wnn7-server-set-rev (rev) (if (null rev) (progn ;;(wnn7-bunsetsu-set-env wnn7-buf wnn7-env-norm) (setq env-normal t)) ;;(wnn7-bunsetsu-set-env wnn7-buf wnn7-env-rev) (setq env-normal nil))) ;;; ;;; ;;; dictionary & hinshi ;;; ;;; (defun wnn7-server-hinsi-name (no) (wnn7rpc-hinshi-name wnn7-process no)) (defun wnn7-server-dict-list () (let ((env (if env-normal wnn7-env-norm wnn7-env-rev))) (wnn7-get-dictionary-list-with-environment env))) (defun wnn7-get-dictionary-list-with-environment (env) (wnn7rpc-get-fi-dictionary-list-with-environment env wnn7-dic-no-temps)) (defun wnn7-server-dict-comment (env dicno comment) (let (dinfo fid) (setq dinfo (wnn7rpc-get-dictionary-info env dicno)) (setq fid (wnn7-dicinfo-id dinfo 0)) (wnn7rpc-set-file-comment env fid comment))) (defun wnn7-file-loaded-client (env name fid) (let ((len (length wnn-system-name)) local-name) (and (> (length name) len) (equal (substring name 0 len) wnn-system-name) (prog1 (wnn7-client-file-p (substring name len)) (setq local-name (wnn7-client-filename (substring name len)))) (= (wnn7rpc-file-loaded-local (wnn7env-get-proc env) local-name t) fid) local-name))) (defun wnn7-server-dict-save () "Save all dictionaries and frequency files." (let* ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (dic-list (wnn7-get-dictionary-list-with-environment env)) info freq fid name local-name) (while dic-list (setq info (car dic-list) dic-list (cdr dic-list) freq 0) (while (<= freq 1) (setq fid (wnn7-dicinfo-id info freq) name (wnn7-dicinfo-name info freq)) (if (and (> fid 0) (= (wnn7-dicinfo-mode info freq) 0)) (cond ((= (wnn7-dicinfo-local info freq) 1) (wnn7rpc-write-file env fid name)) ((setq local-name (wnn7env-get-client-file env name)) (wnn7rpc-file-receive env fid local-name)) ((and (setq local-name (wnn7-file-loaded-client env name fid)) (file-writable-p local-name)) (wnn7rpc-file-receive env fid local-name)))) (setq freq (1+ freq)))))) (defun wnn7-server-inspect (bunno) (let* ((bunsetsu (nth bunno wnn7-bun-list)) (env (wnn7-bunsetsu-get-env bunsetsu)) (converted (wnn7-get-bunsetsu-converted bunsetsu)) (yomi (wnn7-bunsetsu-get-yomi bunsetsu)) (fuzokugo (wnn7-bunsetsu-get-fuzokugo bunsetsu)) (hinshi-no (wnn7-bunsetsu-get-hinshi bunsetsu)) (dic-no (wnn7-bunsetsu-get-dic-no bunsetsu)) (entry (wnn7-bunsetsu-get-entry bunsetsu)) (now (wnn7-bunsetsu-get-right-now bunsetsu)) (freq (wnn7-bunsetsu-get-freq bunsetsu)) (evaluation (wnn7-bunsetsu-get-evaluation bunsetsu)) (evaluation-dai (or (wnn7-bunsetsu-get-dai-evaluation bunsetsu) "---")) (kangovect (wnn7-bunsetsu-get-kangovect bunsetsu)) hinshi dic) (setq hinshi (wnn7rpc-hinshi-name (wnn7env-get-proc env) hinshi-no)) (setq dic (if (>= dic-no 0) (wnn7-dict-name (car (wnn7rpc-get-dictionary-info env dic-no))) (wnn7-msg-get 'pseud-bunsetsu))) (format "%s %s+%s(%s %s:%s Freq:%s%s) S:%s D:%s V:%s " converted yomi fuzokugo hinshi dic entry (if (= now 1) "*" " ") freq evaluation evaluation-dai kangovect))) (defun wnn7-dict-name (dic-info) (let ((comment (wnn7dic-get-comment dic-info)) (name (wnn7dic-get-dictname dic-info))) (cond ((null (string= comment "")) comment) ((wnn7-client-file-p name) name) (t (file-name-nondirectory name))))) ;;; ;;; ;;; dictionary file operation ;;; ;;; (defun wnn7-server-fisys-dict-add (dname fname frw &optional fpass) (wnn7-server-dict-add-body t dname fname t nil frw nil fpass)) (defun wnn7-server-fiusr-dict-add (dname fname drw frw &optional dpass fpass) (wnn7-server-dict-add-body t dname fname nil drw frw dpass fpass)) (defun wnn7-server-dict-add (dname fname prior drw frw &optional dpass fpass) (wnn7-server-dict-add-body nil dname fname prior drw frw dpass fpass)) (defun wnn7-server-dict-add-body (fi dname fname prior drw frw dpass fpass) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (rev (if env-normal nil t)) did fid result) (if (equal dname "") (setq dname nil)) (if (equal fname "") (setq fname nil)) (cond ((numberp (setq dpass (wnn7rpc-read-passwd-file dpass))) (message "%s" (wnn7rpc-get-error-message (- dpass))) nil) ((numberp (setq fpass (if fname (wnn7rpc-read-passwd-file fpass) ""))) (message "%s" (wnn7rpc-get-error-message (- fpass))) nil) ((and (setq did (wnn7-open-dictionary env fi dname drw "" dpass fpass)) (setq fid (wnn7-open-frequency env fi did fname frw "" fpass))) (if fi (setq result (wnn7rpc-set-fi-dictionary env did fid prior drw frw dpass fpass)) (setq drw (cond ((eq drw (WNN-const DIC_GROUP)) (WNN-const DIC_RW)) ((eq drw (WNN-const DIC_MERGE)) (WNN-const DIC_RDONLY)) (t drw)) result (wnn7rpc-set-dictionary env did fid prior drw frw dpass fpass rev))) (cond ((>= result 0) t) ((or (null frw) (/= result (- (WNN-const NO_MATCH)))) (message "%s (%s): %s" dname (if fname fname "") (wnn7rpc-get-error-message (- result))) nil) ((and (y-or-n-p (format (wnn7-msg-get 'no-match) fname)) (>= (wnn7rpc-file-discard env fid) 0) (wnn7-file-remove wnn7-process fname fpass) (wnn7-create-frequency env fi did fname "" fpass)) (message (wnn7-msg-get 're-create-freq) fname) (if fi (setq prior (if prior (wnn-const WNN_FI_SYSTEM_DICT) (wnn-const WNN_FI_USER_DICT)))) (and (>= (setq fid (wnn7-open-file env fname)) 0) (>= (wnn7rpc-set-dictionary env did fid prior drw frw dpass fpass rev) 0)))))))) (defun wnn7-file-remove (proc filename passwd) (let ((result (if (wnn7-client-file-p filename) (wnn7rpc-file-remove-client proc (wnn7-client-filename filename) passwd) (wnn7rpc-file-remove proc (wnn7-filename filename) passwd)))) (or (= result 0) (progn (message (wnn7rpc-get-error-message (- result))) nil)))) (defun wnn7-get-autolearning-dic-mode (env type) (let* ((dic (wnn7rpc-get-autolearning-dic env type)) (info (and (> dic 0) (wnn7rpc-get-dictionary-info env (1- dic))))) (if (vectorp (car-safe info)) (wnn7-dicinfo-mode (car info) 0) (WNN-const DIC_RDONLY)))) (defun wnn7-server-bmodify-dict-add (dname prior drw &optional dpass) (let* ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (type (WNN-const BMODIFY_LEARN)) (did (wnn7rpc-get-autolearning-dic env type)) (param-list (wnn7-make-henkan-parameter)) (name 'bunsetsugiri) mode vmask) (setq mode (wnn7-server-autolearn-dic-add type did dname prior drw dpass)) (when mode (setq vmask (lsh 1 14)) (aset param-list 14 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list)) (wnn7env-set-bmodify env (wnn7-get-autolearning-dic-mode env (WNN-const BMODIFY_LEARN))))) (defun wnn7-server-notrans-dict-add (dname prior drw &optional dpass) (let* ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (type (WNN-const NOTRANS_LEARN)) (did (wnn7rpc-get-autolearning-dic env type)) (param-list (wnn7-make-henkan-parameter)) (name 'muhenkan) mode vmask) (setq mode (wnn7-server-autolearn-dic-add type did dname prior drw dpass)) (when mode (setq vmask (lsh 1 15)) (aset param-list 15 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list)) (wnn7env-set-notrans env (wnn7-get-autolearning-dic-mode env (WNN-const NOTRANS_LEARN))))) (defun wnn7-temporary-dic-add (env rev) (let ((result (wnn7rpc-temporary-dic-loaded env))) (if (= result 0) (wnn7rpc-temporary-dic-add env rev) result))) (defun wnn7-server-autolearn-dic-add (type did dname prior drw dpass) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (rev (if env-normal nil t)) result) (or (numberp drw) (setq drw (if drw 0 1))) (cond ((< did 0) (message "%s" (wnn7rpc-get-error-message (- did))) nil) ((> did 0) (setq result (wnn7-temporary-dic-add env rev)) (if (>= result 0) drw (message "%s" (wnn7rpc-get-error-message (- result))) nil)) ((numberp (setq dpass (wnn7rpc-read-passwd-file dpass))) (message "%s" (wnn7rpc-get-error-message (- dpass))) nil) ((setq did (wnn7-open-dictionary env nil dname t "" dpass "" nil)) (if (and (>= (setq did (wnn7rpc-set-dictionary env did -1 prior drw drw dpass "" rev)) 0) (>= (setq did (wnn7rpc-set-autolearning-dic env type did)) 0) (>= (setq did (wnn7-temporary-dic-add env rev)) 0)) drw (message "%s" (wnn7rpc-get-error-message (- did))) nil))))) (defun wnn7-server-fuzokugo-set (file) (let* ((env (if env-normal wnn7-env-norm wnn7-env-rev)) fid result) (setq fid (wnn7-open-file env file)) (setq result (wnn7rpc-set-fuzokugo-file env fid)) (if (< result 0) (message "%s" (wnn7rpc-get-error-message (- result)))) result)) ;;; ;;; ;;; parameter operation ;;; ;;; ;; henkan-parameter ::=[ ;; ;; ;; ;; ;; ;; ;; (defun wnn7-make-henkan-parameter () (make-vector 24 0)) (defmacro wnn7-make-henkan-parameter-list () ''(last-is-first complex okuri-learn okuri prefix-learn prefix suffix-learn common-learn freq-func numeric alphabet symbol yuragi rendaku bunsetsugiri muhenkan fi-relation-learn fi-freq-func)) (defun wnn7-server-get-param () (let ((env (if env-normal wnn7-env-norm wnn7-env-rev))) (wnn7rpc-get-conversion-parameter env))) (defun wnn7-server-set-param (v) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev))) (wnn7rpc-set-conversion-parameter env v))) (defun wnn7-server-set-last-is-first (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'last-is-first) vmask) (setq vmask (lsh 1 0)) (aset param-list 0 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-complex-conv-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'complex) vmask) (setq vmask (lsh 1 1)) (aset param-list 1 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-okuri-learn-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'okuri-learn) vmask) (setq vmask (lsh 1 2)) (aset param-list 2 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-okuri-flag (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'okuri) vmask) (setq vmask (lsh 1 3)) (aset param-list 3 (cond ((or (eq mode -1) (eq mode 'regulation)) -1) ((or (eq mode 0) (eq mode 'no)) 0) ((or (eq mode 1) (eq mode 'yes)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-prefix-learn-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'prefix-learn) vmask) (setq vmask (lsh 1 4)) (aset param-list 4 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-prefix-flag (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'prefix) vmask) (setq vmask (lsh 1 5)) (aset param-list 5 (cond ((or (eq mode 0) (eq mode 'hiragana)) 0) ((or (eq mode 1) (eq mode 'kanji)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-suffix-learn-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'suffix-learn) vmask) (setq vmask (lsh 1 6)) (aset param-list 6 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-common-learn-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'common-learn) vmask) (setq vmask (lsh 1 7)) (aset param-list 7 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-freq-func-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'freq-func) vmask) (setq vmask (lsh 1 8)) (aset param-list 8 (cond ((or (eq mode 0) (eq mode 'not)) 0) ((or (eq mode 1) (eq mode 'always)) 1) ((or (eq mode 2) (eq mode 'high)) 2) ((or (eq mode 3) (eq mode 'normal)) 3) ((or (eq mode 4) (eq mode 'low)) 4) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-numeric-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'numeric) vmask) (setq vmask (lsh 1 9)) (aset param-list 9 (cond ((or (eq mode -2) (eq mode 'han)) -2) ((or (eq mode -12) (eq mode 'zen)) -12) ((or (eq mode -13) (eq mode 'kan)) -13) ((or (eq mode -15) (eq mode 'kansuuji)) -15) ((or (eq mode -16) (eq mode 'kanold)) -16) ((or (eq mode -17) (eq mode 'hancan)) -17) ((or (eq mode -18) (eq mode 'zencan)) -18) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-alphabet-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'alphabet) vmask) (setq vmask (lsh 1 10)) (aset param-list 10 (cond ((or (eq mode -4) (eq mode 'han)) -4) ((or (eq mode -30) (eq mode 'zen)) -30) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-symbol-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'symbol) vmask) (setq vmask (lsh 1 11)) (aset param-list 11 (cond ((or (eq mode -5) (eq mode 'han)) -5) ((or (eq mode -40) (eq mode 'jis)) -40) ((or (eq mode -41) (eq mode 'asc)) -41) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-yuragi-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'yuragi) vmask) (setq vmask (lsh 1 12)) (aset param-list 12 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-rendaku-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'rendaku) vmask) (setq vmask (lsh 1 13)) (aset param-list 13 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-yosoku-learn-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'yosoku-learn) vmask) (setq vmask (lsh 1 22)) (aset param-list 18 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-yosoku-max-disp (max) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'yosoku-max-disp) vmask) (setq vmask (lsh 1 23)) (aset param-list 19 (cond ((and (<= max 10) (>= max 1) max)) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-yosoku-last-is-first-mode (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'yosoku-last-is-first) vmask) (setq vmask (lsh 1 24)) (aset param-list 20 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-boin-kabusoku (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'wnn7-set-boin-kabusoku) vmask) (setq vmask (lsh 1 26)) (aset param-list 21 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-shiin-choka (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'wnn7-set-shiin-choka) vmask) (setq vmask (lsh 1 27)) (aset param-list 22 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param env vmask param-list))) (defun wnn7-server-set-n-choka (mode) (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (param-list (wnn7-make-henkan-parameter)) (name 'wnn7-set-n-choka) vmaskh vmaskl) (setq vmaskh (lsh 1 12)) (setq vmaskl 0) (aset param-list 23 (cond ((or (eq mode 0) (eq mode nil)) 0) ((or (eq mode 1) (eq mode t)) 1) (t (egg:error "%s: Wrong type argument" name)))) (wnn7rpc-set-conversion-env-param-highbit env vmaskh vmaskl param-list))) (defconst HINSHI_NO_ATEJI 114) (defconst HINSHI_NO_GOYOU 115) (defconst HINSHI_NO_ATEJI_START 64946) (defconst HINSHI_NO_ATEJI_END 64965) (defconst HINSHI_NO_GOYOU_START 64925) (defconst HINSHI_NO_GOYOU_END 64945) (defun wnn7-server-set-nihongo-kosei (mode) "" (unless mode (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (hlist nil) hend nhinshi) (setq hend HINSHI_NO_ATEJI_END) (setq hlist nil) (while (>= hend HINSHI_NO_ATEJI_START) (setq hlist (cons hend hlist) hend (1- hend))) (setq hlist (cons HINSHI_NO_ATEJI hlist)) (setq hlist (append hlist '(0))) (setq nhinshi (length hlist) nhinshi (- nhinshi)) (wnn7rpc-set-henkan-hinshi env 1 nhinshi hlist) (setq hend HINSHI_NO_GOYOU_END) (setq hlist nil) (while (>= hend HINSHI_NO_GOYOU_START) (setq hlist (cons hend hlist) hend (1- hend))) (setq hlist (cons HINSHI_NO_GOYOU hlist)) (setq hlist (append hlist '(0))) (setq nhinshi (length hlist) nhinshi (- nhinshi)) (wnn7rpc-set-henkan-hinshi env 1 nhinshi hlist))) 0) ;;; ;;; ;;; file operation ;;; ;;; (defun wnn7-open-file (env filename) "Open the file FILENAME on the environment ENV. Return file ID. NIL means NO-file. On failure, return negative error code." (and filename (if (wnn7-client-file-p filename) (wnn7rpc-file-send env (wnn7-client-filename filename)) (wnn7rpc-file-read env (wnn7-filename filename))))) (defun wnn7-create-directory (env path noquery) "Create directory to the path. Retun non-NIL value on success." (if (wnn7-client-file-p path) (let ((local-name (directory-file-name (file-name-directory (wnn7-client-filename path))))) (cond ((file-directory-p local-name) t) ((or noquery (y-or-n-p (format (wnn7-msg-get 'no-dir) (file-name-directory path)))) (make-directory local-name t) ;; server $BB&$N%G%#%l%/%H%j$b:n@.$7$F$*$/(B (wnn7-create-directory env (concat wnn7-usr-dic-dir "/foo") t) (if (file-directory-p local-name) (progn (message (wnn7-msg-get 'create-dir) path) t) (message (wnn7-msg-get 'fail-dir) path) nil)))) (let ((name (directory-file-name (file-name-directory (wnn7-filename path)))) create-list) (setq path name) (while (and name (/= (wnn7rpc-access env name 0) 0)) (setq create-list (cons name create-list) name (file-name-directory name) name (and name (directory-file-name name)))) (or (null create-list) (if (or noquery (y-or-n-p (format (wnn7-msg-get 'no-dir) path))) (let ((result 0)) (while (and (>= result 0) create-list) (setq result (wnn7rpc-mkdir env (car create-list)) create-list (cdr create-list))) (if (>= result 0) (progn (message (wnn7-msg-get 'create-dir) path) t) (message (wnn7-msg-get 'fail-dir) path) nil))))))) (defun wnn7-open-dictionary (env fi name rw comment dpasswd fpasswd &optional noquery) (let ((dic-id (wnn7-open-file env name))) (cond ((null dic-id) (message "Wnn: cannot omit dictionary name") nil) ((>= dic-id 0) dic-id) ((or (null rw) (and (/= dic-id (- (WNN-const NO_EXIST))) (/= dic-id (- (WNN-const WNNDS_FILE_READ_ERROR))))) (message (wnn7-msg-get 'no-dict1) name (wnn7rpc-get-error-message (- dic-id))) nil) ((and (or noquery (y-or-n-p (format (wnn7-msg-get 'no-dict2) name))) (wnn7-create-directory env name noquery) (wnn7-create-dictionary env name (wnn7rpc-writable-dic-type env fi rw) comment dpasswd fpasswd)) (message (wnn7-msg-get 'create-dict) name) (setq dic-id (wnn7-open-file env name)) (if (>= dic-id 0) dic-id (message "%s" (wnn7rpc-get-error-message (- dic-id))) nil))))) (defun wnn7-create-dictionary (env name type comment dpasswd fpasswd) "Create a dictionary file on the server or the client depending on name." (let ((result (if (wnn7-client-file-p name) (wnn7rpc-dic-file-create-client env (wnn7-client-filename name) type comment dpasswd fpasswd) (wnn7rpc-dic-file-create env (wnn7-filename name) type comment dpasswd fpasswd)))) (or (= result 0) (progn (message (wnn7rpc-get-error-message (- result))) nil)))) (defun wnn7-open-frequency (env fi dic-id name rw comment passwd) (let ((freq-id (wnn7-open-file env name))) (cond ((null freq-id) -1) ((>= freq-id 0) freq-id) ((or (null rw) (and (/= freq-id (- (WNN-const NO_EXIST))) (/= freq-id (- (WNN-const WNNDS_FILE_READ_ERROR))))) (message (wnn7-msg-get 'no-freq1) name (wnn7rpc-get-error-message (- freq-id))) nil) ((and (y-or-n-p (format (wnn7-msg-get 'no-freq2) name)) (wnn7-create-directory env name nil) (wnn7-create-frequency env fi dic-id name comment passwd)) (message (wnn7-msg-get 'create-freq) name) (setq freq-id (wnn7-open-file env name)) (if (>= freq-id 0) freq-id (message "%s" (wnn7rpc-get-error-message (- freq-id))) nil))))) (defun wnn7-create-frequency (env fi dic-id name comment passwd) "Create a frequency file on the server or the client depending on name." (let ((result (if (wnn7-client-file-p name) (wnn7rpc-hindo-file-create-client env fi dic-id (wnn7-client-filename name) comment passwd) (wnn7rpc-hindo-file-create env fi dic-id (wnn7-filename name) comment passwd)))) (or (= result 0) (progn (message (wnn7rpc-get-error-message (- result))) nil)))) ;;; ;;; henkan ;;; (defun wnn7-server-henkan-begin (yomi) ;; bun_no = 0, bun_no2 = -1, USE_MAE (let ((env (if env-normal wnn7-env-norm wnn7-env-rev)) (hinshi (WNN-const BUN_SENTOU)) (fuzokugo "") (v nil) result context) (setq context (wnn7-null-context) result (wnn7-renbunsetsu-conversion env yomi hinshi fuzokugo v context)) (if (numberp result) (progn (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil) (if wnn-one-level-conversion (while (consp result) (wnn7-bunsetsu-set-dai-continue (car result) nil) (setq result (cdr result)))) (setq wnn7-bun-list result) (setq result (cons (length result) result))))) (defun wnn7-server-bunsetu-kanji (bunno) (let* ((bunsetsu (nth bunno wnn7-bun-list)) (kanji (wnn7-get-bunsetsu-converted bunsetsu))) kanji)) (defun wnn7-server-bunsetu-yomi (bunno) (let* ((bunsetsu (nth bunno wnn7-bun-list)) (yomi (wnn7-get-bunsetsu-source bunsetsu))) yomi)) (defun wnn7-server-dai-top (bunno) "$BJ8@a$,BgJ8@a$N@hF,$J$i(B t" (let ((bun1 (nth bunno wnn7-bun-list)) bun2) (if (< (setq bunno (1- bunno)) 0) t (setq bun2 (nth bunno wnn7-bun-list)) (if (and (null (wnn7-bunsetsu-get-dai-continue bun2)) (or (wnn7-bunsetsu-get-dai-continue bun1) (null (wnn7-bunsetsu-get-dai-continue bun1)))) t nil)))) (defun wnn7-server-dai-end (bunno) "$B pos 0) (null (eq (wnn7-bunsetsu-get-zenkouho head) t))) (setq cand (cons (nth pos cand) (delq (nth pos cand) cand))))) (setq cand (wnn7-uniq-candidates cand) pos (wnn7-candidate-pos bunsetsu cand) converted (wnn7-get-candidates-converted cand)) (wnn7-set-candidate-info bunsetsu (wnn7-zenkouho-create pos cand converted major prev-b next-b)) (wnn7-add-freq-down head cand) (cons pos converted)))) (defsubst wnn7-uniq-bunsetsu-equal (bunsetsu-1 bunsetsu-2) (and (or (eq wnn-uniq-level 'wnn-uniq-kanji) (and (eq wnn-uniq-level 'wnn-uniq) (= (wnn7-bunsetsu-get-hinshi bunsetsu-1) (wnn7-bunsetsu-get-hinshi bunsetsu-2))) (and (= (wnn7-bunsetsu-get-dic-no bunsetsu-1) (wnn7-bunsetsu-get-dic-no bunsetsu-2)) (= (wnn7-bunsetsu-get-entry bunsetsu-1) (wnn7-bunsetsu-get-entry bunsetsu-2)) (or (eq wnn-uniq-level 'wnn-uniq-entry) (= (wnn7-bunsetsu-get-kangovect bunsetsu-1) (wnn7-bunsetsu-get-kangovect bunsetsu-2))))) (equal (wnn7-bunsetsu-get-converted bunsetsu-1) (wnn7-bunsetsu-get-converted bunsetsu-2)) (equal (wnn7-bunsetsu-get-fuzokugo bunsetsu-1) (wnn7-bunsetsu-get-fuzokugo bunsetsu-2)))) (defun wnn7-uniq-bunsetsu-list-equal (b1 b2) (while (and b1 b2 (wnn7-uniq-bunsetsu-equal (car b1) (car b2))) (setq b1 (cdr b1) b2 (cdr b2))) (and (null b1) (null b2))) (defun wnn7-candidate-pos (bunsetsu candidates) (let ((n 0) pos) (while (and (null pos) candidates) (if (wnn7-uniq-bunsetsu-list-equal (car candidates) bunsetsu) (setq pos n) (setq candidates (cdr candidates) n (1+ n)))) (or pos -1))) ;;; ;;; ;;; frequency and flag operation ;;; ;;; (defvar wnn-auto-save-dic-count 0) (defun wnn7-server-hindo-update () (let* ((head (car wnn7-bun-list)) (env (wnn7-bunsetsu-get-env head))) (prog1 (progn (wnn7-clear-now-flag wnn7-bun-list) (wnn7-merge-fi-rel head (cdr wnn7-bun-list)) (wnn7rpc-set-fi-priority env (wnn7-bunsetsu-get-fi-rel head)) (wnn7-optimize-in-local wnn7-bun-list) (wnn7-optimize-in-server wnn7-bun-list)) (setq wnn-auto-save-dic-count (1+ wnn-auto-save-dic-count)) (when (eq wnn-auto-save-dic-count wnn-auto-save-dictionaries) (wnn7-server-dict-save) (setq wnn-auto-save-dic-count 0))))) (defun wnn7-clear-now-flag (bunsetsu-list) (let ((env (wnn7-bunsetsu-get-env (car bunsetsu-list))) fd) (while bunsetsu-list (setq fd (wnn7-bunsetsu-get-freq-down (car bunsetsu-list)) bunsetsu-list (cdr bunsetsu-list)) (while fd (wnn7rpc-set-frequency env (caar fd) (cdar fd) (WNN-const IMA_OFF) (WNN-const HINDO_NOP)) (setq fd (cdr fd)))))) (defun wnn7-add-freq-down (bunsetsu down-list) (let ((freq-down (wnn7-bunsetsu-get-freq-down bunsetsu)) b-list b pair) (while down-list (setq b-list (car down-list) down-list (cdr down-list)) (while b-list (setq b (car b-list) b-list (cdr b-list) pair (cons (wnn7-bunsetsu-get-dic-no b) (wnn7-bunsetsu-get-entry b))) (if (and (/= (wnn7-bunsetsu-get-right-now b) 0) (/= (car pair) -1) (null (member pair freq-down))) (setq freq-down (cons pair freq-down))))) (wnn7-bunsetsu-set-freq-down bunsetsu freq-down))) (defun wnn7-merge-freq-down (bunsetsu b-list) (let ((freq-down0 (wnn7-bunsetsu-get-freq-down bunsetsu)) freq-down1) (while b-list (setq freq-down1 (wnn7-bunsetsu-get-freq-down (car b-list)) b-list (cdr b-list)) (while freq-down1 (if (null (member (car freq-down1) freq-down0)) (setq freq-down0 (cons (car freq-down1) freq-down0))) (setq freq-down1 (cdr freq-down1))) (wnn7-bunsetsu-set-freq-down bunsetsu freq-down0)))) (defun wnn7-merge-fi-rel (bunsetsu b-list) (let ((fi-rel (cons nil (wnn7-bunsetsu-get-fi-rel bunsetsu)))) (if (eq bunsetsu (car b-list)) (setq b-list (cdr b-list))) (while b-list (nconc fi-rel (wnn7-bunsetsu-get-fi-rel (car b-list))) (wnn7-bunsetsu-set-fi-rel (car b-list) nil) (setq b-list (cdr b-list))) (wnn7-bunsetsu-set-fi-rel bunsetsu (cdr fi-rel)))) (defun wnn7-optimize-in-local (bunsetsu-list) (let ((env (wnn7-bunsetsu-get-env (car bunsetsu-list))) b prev-b next-b major-top entry hinshi) (setq next-b (car bunsetsu-list) bunsetsu-list (cdr bunsetsu-list)) (while next-b (setq major-top (null (and b (wnn7-bunsetsu-get-dai-continue b))) prev-b b b next-b next-b (car bunsetsu-list) bunsetsu-list (cdr bunsetsu-list) hinshi (wnn7-bunsetsu-get-hinshi b)) (when (or (and (/= (wnn7env-get-notrans env) (WNN-const DIC_RDONLY)) (= (wnn7-bunsetsu-get-dic-no b) -1) (or (= (wnn7-bunsetsu-get-entry b) (WNN-const HIRAGANA)) (= (wnn7-bunsetsu-get-entry b) (WNN-const KATAKANA))) (>= (wnn7-bunsetsu-get-jirilen b) (WNN-const LEARNING_LEN))) (= (wnn7-bunsetsu-get-entry b) (WNN-const IKEIJI_ENTRY))) (setq entry (wnn7-notrans-auto-learning b)) (when (/= entry -1) (wnn7-bunsetsu-set-dic-no b (WNN-const MUHENKAN_DIC)) (wnn7-bunsetsu-set-entry b entry))) (cond ((and next-b major-top (wnn7-bunsetsu-get-dai-continue b)) (wnn7-adjacent-learning b next-b)) ((and prev-b (= hinshi (wnn7env-get-hinshi env 'rendaku)) (equal (wnn7-bunsetsu-get-fuzokugo prev-b) "")) (wnn7-adjacent-learning prev-b b)) ((and next-b (= hinshi (wnn7env-get-hinshi env 'settou))) (wnn7-adjacent-learning b next-b)) ((and (/= (wnn7env-get-bmodify env) (WNN-const DIC_RDONLY)) (wnn7-bunsetsu-get-change-top b) next-b (/= (wnn7-bunsetsu-get-hinshi next-b) (wnn7env-get-hinshi env 'rendaku)) (/= hinshi (wnn7env-get-hinshi env 'settou))) (wnn7-bmodify-learning b next-b)))))) (defun wnn7-notrans-auto-learning (bunsetsu) (let ((env (wnn7-bunsetsu-get-env bunsetsu))) (wnn7rpc-auto-learning env (WNN-const NOTRANS_LEARN) (wnn7-bunsetsu-get-yomi bunsetsu) (wnn7-bunsetsu-get-converted bunsetsu) "" (if (= (wnn7-bunsetsu-get-entry bunsetsu) (WNN-const IKEIJI_ENTRY)) (wnn7-bunsetsu-get-hinshi bunsetsu) (wnn7env-get-hinshi env 'noun)) 0))) (defun wnn7-adjacent-learning (bunsetsu1 bunsetsu2) (let* ((env (wnn7-bunsetsu-get-env bunsetsu1)) (yomi (concat (wnn7-bunsetsu-get-yomi bunsetsu1) (wnn7-bunsetsu-get-yomi bunsetsu2))) (kanji (concat (wnn7-bunsetsu-get-converted bunsetsu1) (wnn7-bunsetsu-get-converted bunsetsu2))) (hinshi (wnn7env-get-hinshi env 'noun))) (if (= (wnn7env-get-bmodify env) (WNN-const DIC_RW)) (wnn7rpc-auto-learning env (WNN-const BMODIFY_LEARN) yomi kanji "" hinshi 0) (wnn7rpc-temporary-learning env yomi kanji "" hinshi 0)))) (defun wnn7-bmodify-learning (bunsetsu1 bunsetsu2) (let ((env (wnn7-bunsetsu-get-env bunsetsu1)) (yomi (concat (wnn7-bunsetsu-get-yomi bunsetsu1) (wnn7-bunsetsu-get-fuzokugo bunsetsu1) (wnn7-bunsetsu-get-yomi bunsetsu2))) (kanji (concat (wnn7-bunsetsu-get-converted bunsetsu1) (wnn7-bunsetsu-get-fuzokugo bunsetsu1) (wnn7-bunsetsu-get-converted bunsetsu2))) (hinshi (wnn7-bunsetsu-get-hinshi bunsetsu2))) (wnn7rpc-auto-learning env (WNN-const BMODIFY_LEARN) yomi kanji "" hinshi 0))) (defun wnn7-optimize-in-server (bunsetsu-list) (let ((env (wnn7-bunsetsu-get-env (car bunsetsu-list))) (context (wnn7-bunsetsu-get-context (car bunsetsu-list))) b) (wnn7-context-set-right-now (car context) (WNN-const HINDO_NOP)) (wnn7-context-set-freq (car context) (WNN-const HINDO_NOP)) (wnn7-context-set-right-now (nth 1 context) (WNN-const HINDO_NOP)) (wnn7-context-set-freq (nth 1 context) (WNN-const HINDO_NOP)) (while bunsetsu-list (setq b (car bunsetsu-list) bunsetsu-list (cdr bunsetsu-list) context (cons (wnn7-context-create (wnn7-bunsetsu-get-dic-no b) (wnn7-bunsetsu-get-entry b) (wnn7-bunsetsu-get-jirilen b) (wnn7-bunsetsu-get-hinshi b) (wnn7-bunsetsu-get-fuzokugo b) (wnn7-bunsetsu-get-converted b) (WNN-const IMA_ON) (WNN-const HINDO_INC)) context))) (prog1 (list (car context) (nth 1 context)) (wnn7rpc-optimize-fi env (nreverse context))))) (defun wnn7-server-henkan-kakutei (bunno pos) (let* ((bunsetsu (wnn7-get-major-bunsetsu bunno)) (head (car bunsetsu)) (next-b (wnn7-get-next-major-bunsetsu bunno)) (prev-b (car (wnn7-get-prev-major-bunsetsu bunno))) (cand-list (wnn7-bunsetsu-get-zenkouho-list head)) (cand (nth pos cand-list)) (c-head (car cand)) top bunno2) (setq bunno2 (cdr (wnn7-get-prev-major-bunsetsu bunno)) top (wnn7-get-pre-prev-bunsetsu (1- bunno2))) (wnn7-bunsetsu-set-zenkouho-pos head pos) (wnn7-bunsetsu-set-change-top c-head (wnn7-bunsetsu-get-change-top head)) (wnn7-bunsetsu-set-freq-down c-head (wnn7-bunsetsu-get-freq-down head)) (wnn7-merge-fi-rel c-head bunsetsu) (wnn7-major-bunsetsu-set-context cand (wnn7-bunsetsu-get-context head)) (wnn7-set-candidate-info cand (wnn7-bunsetsu-get-zenkouho head)) (if (and prev-b (null wnn-one-level-conversion)) (progn (wnn7-bunsetsu-set-dai-continue (wnn7-get-bunsetsu-tail prev-b) (wnn7-bunsetsu-connect-prev c-head)))) (setq wnn7-bun-list (append top prev-b cand next-b)))) (defun wnn7-server-henkan-kakutei-sho (bunno pos) (let* ((bunsetsu (wnn7-get-minor-bunsetsu bunno)) (head (car bunsetsu)) (next-b (nthcdr (1+ bunno) wnn7-bun-list)) (prev-b (wnn7-get-pre-prev-bunsetsu (1- bunno))) (cand-list (wnn7-bunsetsu-get-zenkouho-list head)) (cand (nth pos cand-list)) (c-head (car cand)) top bunno2) ;;(setq bunno2 (wnn7-get-prev-minor-bunsetsu bunno) ;; top (wnn7-get-pre-prev-bunsetsu (1- bunno2))) (wnn7-bunsetsu-set-zenkouho-pos head pos) (wnn7-bunsetsu-set-change-top c-head (wnn7-bunsetsu-get-change-top head)) (wnn7-bunsetsu-set-freq-down c-head (wnn7-bunsetsu-get-freq-down head)) (wnn7-merge-fi-rel c-head bunsetsu) (wnn7-major-bunsetsu-set-context cand (wnn7-bunsetsu-get-context head)) (wnn7-set-candidate-info cand (wnn7-bunsetsu-get-zenkouho head)) ;; (if (and prev-b (null wnn-one-level-conversion)) ;; (progn ;; (wnn7-bunsetsu-set-dai-continue (wnn7-get-bunsetsu-tail prev-b) ;; (wnn7-bunsetsu-connect-prev c-head)))) (setq wnn7-bun-list (append top prev-b cand next-b)))) (defun wnn7-server-bunsetu-henkou (bunno len major) (let (bunsetsu next-b prev-b tail env yomi context yomi1 yomi2 hinshi fuzokugo new tmplen) (if major (setq bunsetsu (wnn7-get-major-bunsetsu bunno) prev-b (wnn7-get-pre-prev-bunsetsu (1- bunno)) next-b (wnn7-get-next-major-bunsetsu bunno)) (setq bunsetsu (wnn7-get-minor-bunsetsu bunno) prev-b (wnn7-get-pre-prev-bunsetsu (1- bunno)) next-b (list (nthcdr (1+ bunno) wnn7-bun-list)))) (setq tmplen (length (wnn7-get-major-bunsetsu-source bunsetsu))) (when (< tmplen len) (nconc bunsetsu (list (car next-b))) (setq next-b (cdr next-b))) (setq tail (wnn7-get-bunsetsu-tail prev-b) env (wnn7-bunsetsu-get-env (car bunsetsu)) yomi (wnn7-get-major-bunsetsu-source bunsetsu) context (wnn7-bunsetsu-get-context (car bunsetsu))) (if tail (setq hinshi (wnn7-bunsetsu-get-hinshi tail) fuzokugo (wnn7-bunsetsu-get-fuzokugo tail)) (setq hinshi -1 fuzokugo "")) (setq yomi1 (substring yomi 0 len) yomi2 (concat (substring yomi len) (wnn7-get-major-bunsetsu-source next-b))) (setq new (wnn7-tanbunsetsu-conversion env yomi1 hinshi fuzokugo nil major)) (if (numberp new) (egg:error "%s" (wnn7rpc-get-error-message (- new)))) (if (and prev-b (null wnn-one-level-conversion)) (wnn7-bunsetsu-set-dai-continue tail (wnn7-bunsetsu-connect-prev (car new)))) (wnn7-bunsetsu-set-change-top (car new) t) (wnn7-merge-freq-down (car new) bunsetsu) (wnn7-merge-fi-rel (car new) bunsetsu) (wnn7-merge-fi-rel (car new) next-b) (wnn7-major-bunsetsu-set-context new context) (if (= (length yomi2) 0) (setq next-b nil) (setq tail (wnn7-get-bunsetsu-tail new) next-b (wnn7-renbunsetsu-conversion env yomi2 (wnn7-bunsetsu-get-hinshi tail) (wnn7-bunsetsu-get-fuzokugo tail) nil context)) (if (numberp next-b) (egg:error "%s" (wnn7rpc-get-error-message (- next-b)))) (if (and (null major) (null wnn-one-level-conversion)) (wnn7-bunsetsu-set-dai-continue tail (wnn7-bunsetsu-connect-prev (car next-b))))) (setq new (append prev-b new next-b)) (cons (length new) new))) ;; new-bunsetsu-list (defun wnn7-renbunsetsu-conversion (env yomi hinshi fuzokugo v context) (let ((result (wnn7rpc-fi-renbunsetsu-conversion env yomi hinshi fuzokugo v context))) (prog1 result (if wnn-one-level-conversion (while (consp result) (wnn7-bunsetsu-set-dai-continue (car result) nil) (setq result (cdr result))))))) (defun wnn7-tanbunsetsu-conversion (env yomi hinshi fuzokugo v major) (if (or (null major) wnn-one-level-conversion) (wnn7rpc-tanbunsetsu-conversion env yomi hinshi fuzokugo v) (wnn7rpc-daibunsetsu-conversion env yomi hinshi fuzokugo v))) (defun wnn7-server-synonym (bunno pos major) (let (bunsetsu head env yomi yomi_org next-b prev-b hinshi fuzokugo converted cand cand-list c-head v) (if major (setq bunsetsu (wnn7-get-major-bunsetsu bunno) prev-b (car (wnn7-get-prev-major-bunsetsu bunno)) next-b (wnn7-get-next-major-bunsetsu bunno)) (setq bunsetsu (wnn7-get-minor-bunsetsu bunno) prev-b (wnn7-get-prev-minor-bunsetsu bunno) next-b (list (nthcdr (1+ bunno) wnn7-bun-list)))) (setq head (car bunsetsu) env (wnn7-bunsetsu-get-env head) cand-list (wnn7-bunsetsu-get-zenkouho-list head) cand (nth pos cand-list) c-head (car cand) yomi (wnn7-get-bunsetsu-converted c-head) yomi_org (wnn7-get-bunsetsu-source c-head)) (if prev-b (setq prev-b (wnn7-get-bunsetsu-tail prev-b) hinshi (wnn7-bunsetsu-get-hinshi prev-b) fuzokugo (wnn7-bunsetsu-get-fuzokugo prev-b)) (setq hinshi -1 fuzokugo "")) (if next-b (setq next-b (car next-b) v (wnn7-bunsetsu-get-kangovect next-b))) (if (vectorp (wnn7-bunsetsu-get-zenkouho head)) (setq pos (wnn7-bunsetsu-get-zenkouho-pos head) cand (wnn7-bunsetsu-get-zenkouho-list head))) (setq cand (wnn7rpc-assoc-with-data env yomi hinshi fuzokugo v (wnn7-bunsetsu-get-hinshi c-head) ;; jirihin yomi_org (wnn7-bunsetsu-get-jirilen c-head); jirilen (length (wnn7-get-bunsetsu-source c-head)); yomilen* (length (wnn7-get-bunsetsu-converted c-head)); kanjilen* (length (wnn7-bunsetsu-get-converted c-head)))); real_kanjilen (if (numberp cand) (egg:error "%s" (wnn7rpc-get-error-message (- cand))) (if cand (progn (setq cand (wnn7-uniq-candidates cand) pos 0 converted (wnn7-get-candidates-converted cand)) (wnn7-set-candidate-info bunsetsu (wnn7-zenkouho-create pos cand converted major prev-b next-b)) (wnn7-add-freq-down head cand) (cons pos converted)) nil)))) ;;; ;;; ;;; predictive input ;;; ;;; (defvar egg-predict-status nil) (defun wnn7-server-predict-init () (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-init env))) (if (= result 0) (progn (wnn7rpc-yosoku-init-time-keydata env) (wnn7rpc-yosoku-init-inputinfo env) (setq egg-predict-status t)) (if (= result -16) (egg:error "%s" "$B%7%9%F%`M=B,<-=q%U%!%$%k$,8+$D$+$j$^$;$s(B") (egg:error "%s" (wnn7rpc-get-error-message (- result)))) nil))) (defun wnn7-server-predict-free () (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-free env))) (setq egg-predict-status nil) (if (= result 0) t (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil))) (defun wnn7-server-predict-start (str) (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-yosoku env str))) (if (numberp result) (if (= result -3011) result (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil) result))) (defun wnn7-server-predict-toroku (&optional kakutei-str) (when env-normal (let* ((bunlist wnn7-bun-list) (head (car bunlist)) (env wnn7-env-norm) ykouho yklist result) (if kakutei-str ;; before convert (setq ykouho (vector kakutei-str (length (encode-coding-string (comm-format-truncate-after-null kakutei-str) egg-mb-euc)) kakutei-str (length (encode-coding-string (comm-format-truncate-after-null kakutei-str) egg-mb-euc)) 0) yklist (cons ykouho yklist)) ;; after convert ;;(setq env (wnn7-bunsetsu-get-env head)) (let (bun bunsetsu) (while bunlist (setq bun (car bunlist) bunsetsu nil) (while bun (setq bunsetsu (cons bun bunsetsu) bunlist (cdr bunlist) bun (and (wnn7-bunsetsu-get-dai-continue bun) bunlist (car bunlist)))) (setq bunsetsu (nreverse bunsetsu)) (when bunsetsu (setq ykouho (vector (wnn7-get-major-bunsetsu-source bunsetsu) (length (encode-coding-string (comm-format-truncate-after-null (mapconcat 'wnn7-bunsetsu-get-yomi bunsetsu "")) egg-mb-euc)) (wnn7-get-major-bunsetsu-converted bunsetsu) (length (encode-coding-string (comm-format-truncate-after-null (mapconcat 'wnn7-bunsetsu-get-converted bunsetsu "")) egg-mb-euc)) (wnn7-bunsetsu-get-hinshi (car (nreverse bunsetsu)))) yklist (cons ykouho yklist))))) (setq yklist (nreverse yklist))) (if (= (setq result (wnn7rpc-yosoku-toroku env (length yklist) yklist)) 0) t (if (not (eq result -3011)) (egg:error "%s" (wnn7rpc-get-error-message (- result)))) nil)))) (defun wnn7-server-predict-selected-cand (pos) (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-selected-cand env pos))) (if (>= result 0) result (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil))) (defun wnn7-server-predict-delete-cand (pos) (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-delete-cand env pos))) (if (= result 0) t (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil))) (defun wnn7-server-predict-cancel-toroku () (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-cancel-latest-toroku env))) (if (= result 0) t (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil))) (defun wnn7-server-predict-reset-connective () (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-reset-pre-yosoku env))) (if (= result 0) t (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil))) (defun wnn7-server-predict-save-data () (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-save-datalist env))) (if (= result 0) t (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil))) (defun wnn7-server-predict-set-timeinfo (yosokuselect throughyosoku inputtime keylen) (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-set-timeinfo env yosokuselect throughyosoku inputtime keylen))) (if (= result 0) t (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil))) (defun wnn7-server-predict-set-user-inputinfo (allkey userkey yosokuselect) (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-set-user-inputinfo env allkey userkey yosokuselect))) (if (= result 0) t (egg:error "%s" (wnn7rpc-get-error-message (- result))) nil))) (defun wnn7-server-predict-status () (let* ((env wnn7-env-norm) (result (wnn7rpc-yosoku-status env))) result)) (provide 'wnn7egg-lib) ;;; wnn7egg-lib.el ends here wnn7egg-1.02.orig/elisp/xemacs21/wnn7egg-rpcx21.el0100644000764400003210000020553207474174160021726 0ustar ishikawaishikawa;; Wnn7Egg is Egg modified for Wnn7, and the current maintainer ;; is OMRON SOFTWARE Co., Ltd. ;; ;; This file is part of Wnn7Egg. (base code is egg/wnnrpc.el (eggV4)) ;; ;;; ------------------------------------------------------------------ ;;; ;;; Wnn7Egg $B!J(BWnn "$B$J$J(B"$B$?$^$4!K(B--- Wnn7 Emacs Client ;;; ;;; Wnn7Egg $B$O!"!V$?$^$4Bh#3HG!W(Bv3.09 $B$r%Y!<%9$K(B $B!V$?$^$4Bh#4HG!W$NDL?.!"(B ;;; $B%i%$%V%i%jIt$rAH$_9~$s$@!"(BWnn7 $B$N0Y$N@lMQ%/%i%$%"%s%H$G$9!#(B ;;; ;;; $B$9$Y$F$N%=!<%9$,(B Emacs Lisp $B$G5-=R$5$l$F$$$k$N$G!"(BWnn SDK/Library $B$rI,MW(B ;;; $B$H$;$:!"(BGNU Emacs $B5Z$S(B XEmacs $B4D6-$G;HMQ$9$k$3$H$,$G$-$^$9!#;HMQ5vBz>r7o(B ;;; $B$O(B GPL $B$G$9!#(B ;;; ;;; GNU Emacs 20.3 $B0J9_!"(BXEmacs 21.x $B0J9_$GF0:n3NG'$7$F$$$^$9!#(B ;;; ;;; ;;; Wnn7Egg $B$O(B Wnn7 $B$N5!G=$G$"$k3Z!9F~NO!JF~NOM=B,!K!"O"A[JQ49$r%5%]!<%H(B ;;; $B$7$F$$$^$9!#(B ;;; ;;; $B!V$?$^$4!W$HFHN)!?6&B8$G$-$k$h$&$K!"1F6A$9$k$r(B ;;; "wnn7..." $B$H$$$&7A$KJQ99$7$F$$$^$9!#(B ;;; ;;; ------------------------------------------------------------------ ;;; egg/wnnrpc.el --- WNN Support (low level interface) in Egg ;;; Input Method Architecture ;; Copyright (C) 1999, 2000 Free Software Foundation, Inc ;; Author: NIIBE Yutaka ;; KATAYAMA Yoshio ; Korean, Chinese support. ;; Maintainer: TOMURA Satoru ;; Keywords: mule, multilingual, input method ;; This file is part of EGG. ;; EGG is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; EGG is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;;; 2002/5/16 XEmacs$B$K$*$$$F%f!<%6<-=q$N%/%i%$%"%s%HE>Aw$,$G$-$J$$LdBj$NBP1~(B ;;; 2001/9/30 Modified Error Messages ;;; Code: (defun wnn-perform-replace (from-string replacements) "perform-replace $B$h$jITI,MW$J%*%W%7%g%s!"=hM}!"%(%3! emacs-minor-version 1) (funcall search-function search-string limit) (funcall search-function search-string limit t))) ;; If the search string matches immediately after ;; the previous match, but it did not match there ;; before the replacement was done, ignore the match. (if (or (eq lastrepl (point))) (if (or (eobp) (and limit (>= (point) limit))) nil ;; Don't replace the null string ;; right after end of previous replacement. (forward-char 1) (let ((case-fold-search qr-case-fold-search)) (if (> emacs-minor-version 1) (funcall search-function search-string limit) (funcall search-function search-string limit t)))) t)) ;; Save the data associated with the real match. (setq real-match-data (match-data)) ;; If time for a change, advance to next replacement string. (if (and (listp replacements) (= next-rotate-count replace-count)) (progn (setq next-rotate-count (+ next-rotate-count repeat-count)) (setq next-replacement (nth replacement-index replacements)) (setq replacement-index (% (1+ replacement-index) (length replacements))))) (store-match-data real-match-data) (replace-match next-replacement nocasify literal) (setq replace-count (1+ replace-count)) (setq lastrepl (point))) ;; Useless in XEmacs. We handle (de)highlighting through ;; perform-replace-next-event. ;(replace-dehighlight) ) (or unread-command-events) (and keep-going stack))) (if (> emacs-minor-version 1) (require 'wnn7egg-comx214) (require 'wnn7egg-comx21)) (defmacro wnn-file-string () (string-as-unibyte (decode-coding-string "$B#W#n#n$N%U%!%$%k(B" 'euc-jp))) (defmacro wnn-const (c) "Macro for WNN constants." (cond ((eq c 'JS_VERSION) 0) ((eq c 'JS_OPEN) 1) ((eq c 'JS_CLOSE) 3) ((eq c 'JS_CONNECT) 5) ((eq c 'JS_DISCONNECT) 6) ((eq c 'JS_ENV_EXIST) 7) ((eq c 'JS_ENV_STICKY) 8) ((eq c 'JS_ENV_UNSTICKY) 9) ((eq c 'JS_KANREN) 17) ((eq c 'JS_KANTAN_SHO) 18) ((eq c 'JS_KANZEN_SHO) 19) ((eq c 'JS_KANTAN_DAI) 20) ((eq c 'JS_KANZEN_DAI) 21) ((eq c 'JS_HINDO_SET) 24) ((eq c 'JS_DIC_ADD) 33) ((eq c 'JS_DIC_DELETE) 34) ((eq c 'JS_DIC_USE) 35) ((eq c 'JS_DIC_LIST) 36) ((eq c 'JS_DIC_INFO) 37) ((eq c 'JS_FUZOKUGO_SET) 41) ((eq c 'JS_FUZOKUGO_GET) 48) ((eq c 'JS_WORD_ADD) 49) ((eq c 'JS_WORD_DELETE) 50) ((eq c 'JS_WORD_SEARCH) 51) ((eq c 'JS_WORD_SEARCH_BY_ENV) 52) ((eq c 'JS_WORD_INFO) 53) ((eq c 'JS_WORD_COMMENT_SET) 54) ((eq c 'JS_PARAM_SET) 65) ((eq c 'JS_PARAM_GET) 66) ((eq c 'JS_MKDIR) 81) ((eq c 'JS_ACCESS) 82) ((eq c 'JS_WHO) 83) ((eq c 'JS_ENV_LIST) 85) ((eq c 'JS_FILE_LIST_ALL) 86) ((eq c 'JS_DIC_LIST_ALL) 87) ((eq c 'JS_FILE_READ) 97) ((eq c 'JS_FILE_WRITE) 98) ((eq c 'JS_FILE_SEND) 99) ((eq c 'JS_FILE_RECEIVE) 100) ((eq c 'JS_HINDO_FILE_CREATE) 101) ((eq c 'JS_DIC_FILE_CREATE) 102) ((eq c 'JS_FILE_REMOVE) 103) ((eq c 'JS_FILE_LIST) 104) ((eq c 'JS_FILE_INFO) 105) ((eq c 'JS_FILE_LOADED) 106) ((eq c 'JS_FILE_LOADED_LOCAL) 107) ((eq c 'JS_FILE_DISCARD) 108) ((eq c 'JS_FILE_COMMENT_SET) 109) ((eq c 'JS_FILE_PASSWORD_SET) 110) ((eq c 'JS_FILE_STAT) 111) ((eq c 'JS_KILL) 112) ((eq c 'JS_HINSI_LIST) 114) ((eq c 'JS_HINSI_NAME) 115) ((eq c 'JS_HINSI_NUMBER) 116) ((eq c 'JS_HINSI_DICTS) 117) ((eq c 'JS_HINSI_TABLE_SET) 118) ((eq c 'JS_ACCESS_ADD_HOST) #xf00011) ((eq c 'JS_ACCESS_ADD_USER) #xf00012) ((eq c 'JS_ACCESS_REMOVE_HOST) #xf00013) ((eq c 'JS_ACCESS_REMOVE_USER) #xf00014) ((eq c 'JS_ACCESS_ENABLE) #xf00015) ((eq c 'JS_ACCESS_DISABLE) #xf00016) ((eq c 'JS_ACCESS_GET_INFO) #xf00017) ((eq c 'JS_TEMPORARY_DIC_ADD) #xf00021) ((eq c 'JS_TEMPORARY_DIC_DELETE) #xf00022) ((eq c 'JS_AUTOLEARNING_WORD_ADD) #xf00023) ((eq c 'JS_SET_AUTOLEARNING_DIC) #xf00024) ((eq c 'JS_GET_AUTOLEARNING_DIC) #xf00025) ((eq c 'JS_IS_LOADED_TEMPORARY_DIC) #xf00026) ((eq c 'JS_TEMPORARY_WORD_ADD) #xf00027) ((eq c 'JS_SET_HENKAN_ENV) #xf00031) ((eq c 'JS_GET_HENKAN_ENV) #xf00032) ((eq c 'JS_SET_HENKAN_HINSI) #xf00033) ((eq c 'JS_GET_HENKAN_HINSI) #xf00034) ((eq c 'JS_HENKAN_WITH_DATA) #xf00035) ((eq c 'JS_FI_DIC_ADD) #xf00061) ((eq c 'JS_FI_HINDO_FILE_CREATE) #xf00062) ((eq c 'JS_FI_KANREN) #xf00065) ((eq c 'JS_SET_FI_PRIORITY) #xf00066) ((eq c 'JS_OPTIMIZE_FI) #xf00067) ((eq c 'JS_HENKAN_IKEIJI) #xf0006f) ((eq c 'JS_LOCK) #xf00071) ((eq c 'JS_UNLOCK) #xf00072) ((eq c 'JS_FI_DIC_LIST) #xf00081) ((eq c 'JS_FI_DIC_LIST_ALL) #xf00082) ((eq c 'JS_FUZOKUGO_LIST) #xf00083) ((eq c 'JS_YOSOKU_INIT) #xf01001) ((eq c 'JS_YOSOKU_FREE) #xf01002) ((eq c 'JS_YOSOKU_YOSOKU) #xf01003) ((eq c 'JS_YOSOKU_TOROKU) #xf01004) ((eq c 'JS_YOSOKU_SELECTED_CAND) #xf01005) ((eq c 'JS_YOSOKU_DELETE_CAND) #xf01006) ((eq c 'JS_YOSOKU_CANCEL_LATEST_TOROKU) #xf01007) ((eq c 'JS_YOSOKU_RESET_PRE_YOSOKU) #xf01008) ((eq c 'JS_YOSOKU_IKKATSU_TOROKU) #xf01009) ((eq c 'JS_YOSOKU_SAVE_DATALIST) #xf0100a) ((eq c 'JS_YOSOKU_INIT_TIME_KEYDATA) #xf0100b) ((eq c 'JS_YOSOKU_INIT_INPUTINFO) #xf0100c) ((eq c 'JS_YOSOKU_SET_USER_INPUTINFO) #xf0100d) ((eq c 'JS_YOSOKU_SET_TIMEINFO) #xf0100e) ((eq c 'JS_YOSOKU_STATUS) #xf0100f) ((eq c 'JS_YOSOKU_SET_PARAM) #xf01010) ((eq c 'JS_YOSOKU_IKKATSU_TOROKU_INIT) #xf01011) ((eq c 'JS_YOSOKU_IKKATSU_TOROKU_END) #xf01012) ((eq c 'JS_HENKAN_ASSOC) #xf01013) ((eq c 'JLIB_VERSION) #x4003) ((eq c 'JLIB_VERSION_WNN6) #x4f00) ((eq c 'JLIB_VERSION_WNN7) #x4f01) ((eq c 'WNN_C_LOCAL) "!") ((eq c 'WNN_FT_DICT_FILE) 1) ((eq c 'WNN_FT_HINDO_FILE) 2) ((eq c 'WNN_FILE_STRING) (encode-coding-string "$B#W#n#n$N%U%!%$%k(B" 'euc-jp)) ((eq c 'WNN_FILE_STRING7) (encode-coding-string "$B#W#n#n#7%U%!%$%k(B" 'euc-jp)) ((eq c 'WNN_FILE_STRING_LEN) 16) ((eq c 'WNN_PASSWD_LEN) 16) ((eq c 'WNN_HOST_LEN) 16) ((eq c 'WNN_UNIQ_LEN) 28) ((eq c 'WNN_FILE_HEADER_LEN) 128) ((eq c 'WNN_FILE_HEADER_PAD) 36) ((eq c 'WNN_FILE_BODY_PAD) 116) ((eq c 'WNN_ENVNAME_LEN) 32) ((eq c 'WNN_MAX_ENV_OF_A_CLIENT) 32) ((eq c 'WNN_MAX_DIC_OF_AN_ENV) 30) ((eq c 'WNN_MAX_FILE_OF_AN_ENV) 60) ((eq c 'WNN_ACK) 0) ((eq c 'WNN_NAK) -1) ((eq c 'WNN_NO_EXIST) 1) ((eq c 'WNN_OPENF_ERR) 16) ((eq c 'WNN_JSERVER_DEAD) 70) ((eq c 'WNN_BAD_VERSION) 73) ((eq c 'WNN_FILE_READ_ERROR) 90) ((eq c 'WNN_FILE_WRITE_ERROR) 91) ((eq c 'WNN_INCORRECT_PASSWD) 94) ((eq c 'WNN_FILE_IN_USE) 95) ((eq c 'WNN_UNLINK) 96) ((eq c 'WNN_FILE_CREATE_ERROR) 97) ((eq c 'WNN_NOT_A_FILE) 98) ((eq c 'WNN_INODE_CHECK_ERROR) 99) ((eq c 'WNN_UD_DICT) 2) ((eq c 'WNN_REV_DICT) 3) ((eq c 'CWNN_REV_DICT) #x103) ((eq c 'BWNN_REV_DICT) #x203) ((eq c 'WNN_COMPACT_DICT) 5) ((eq c 'WNN_FI_SYSTEM_DICT) 6) ((eq c 'WNN_FI_USER_DICT) 7) ((eq c 'WNN_FI_HINDO_FILE) 8) ((eq c 'WNN_GROUP_DICT) 9) ((eq c 'WNN_MERGE_DICT) 10) ((eq c 'WNN_VECT_NO) -1) ((eq c 'WNN_VECT_BUNSETSU) 2) ((eq c 'WNN_VECT_KANREN) 0) ((eq c 'WNN_VECT_KANZEN) 1) ((eq c 'WNN_VECT_KANTAN) 1))) (defvar wnn7-dic-no-temps #x3f) (defconst wnn7rpc-error-message '((Japanese . [ nil "$B%U%!%$%k$,B8:_$7$^$;$s(B" nil "$B%a%b%j(B allocation $B$G<:GT$7$^$7$?(B" nil "$B<-=q$G$O$"$j$^$;$s(B" "$BIQEY%U%!%$%k$G$O$"$j$^$;$s(B" "$BIUB08l%U%!%$%k$G$O$"$j$^$;$s(B" nil "$B<-=q%F!<%V%k$,0lGU$G$9(B" "$BIQEY%U%!%$%k$,;XDj$5$l$?<-=q$NIQEY%U%!%$%k$G$O$"$j$^$;$s(B" nil nil nil nil nil "$B%U%!%$%k$,%*!<%W%s$G$-$^$;$s(B" "$B@5$7$$IQEY%U%!%$%k$G$O$"$j$^$;$s(B" "$B@5$7$$IUB08l%U%!%$%k$G$O$"$j$^$;$s(B" "$BIUB08l$N8D?t(B, $B%Y%/%?D9$5$J$I$,B?2a$.$^$9(B" "$B$=$NHV9f$N<-=q$O;H$o$l$F$$$^$;$s(B" nil nil nil "$BIUB08l%U%!%$%k$NFbMF$,@5$7$/$"$j$^$;$s(B" "$B5?;wIJ;lHV9f$,0[>o$G$9(B(hinsi.data $B$,@5$7$/$"$j$^$;$s(B)" "$BL$Dj5A$NIJ;l$,A0Ce%U%!%$%k$rFI$_9~$`$3$H$,$G$-$^$;$s(B" "$B%Q%9%o!<%I$,4V0c$C$F$$$^$9(B" "$B%U%!%$%k$,FI$_9~$^$l$F$$$^$9(B" "$B%U%!%$%k$,:o=|$G$-$^$;$s(B" "$B%U%!%$%k$,:n@.=PMh$^$;$s(B" "WNN $B$N%U%!%$%k$G$"$j$^$;$s(B" "$B%U%!%$%k$N(B inode $B$H(B FILE_UNIQ $B$r0lCW$5$;$k;v$,$G$-$^$;$s(B" "$BIJ;l%U%!%$%k$,Bg$-2a$.$^$9(B" "$BIJ;l%U%!%$%k$,Bg$-2a$.$^$9(B" "$BIJ;l%U%!%$%k$,B8:_$7$^$;$s(B" "$BIJ;l%U%!%$%k$NFbMF$,4V0c$C$F$$$^$9(B" nil "$BIJ;l%U%!%$%k$,FI$_9~$^$l$F$$$^$;$s(B" "$BIJ;lL>$,4V0c$C$F$$$^$9(B" "$BIJ;lHV9f$,4V0c$C$F$$$^$9(B" nil "$B$=$NA`:n$O%5%]!<%H$5$l$F$$$^$;$s(B" "$B%Q%9%o!<%I$NF~$C$F$$$k%U%!%$%k$,%*!<%W%s$G$-$^$;$s(B" "uumrc $B%U%!%$%k$,B8:_$7$^$;$s(B" "uumrc $B%U%!%$%k$N7A<0$,8m$C$F$$$^$9(B" "$B$3$l0J>e4D6-$r:n$k$3$H$O$G$-$^$;$s(B" "$B$3$N%/%i%$%"%s%H$,FI$_9~$s$@%U%!%$%k$G$"$j$^$;$s(B" "$B<-=q$KIQEY%U%!%$%k$,$D$$$F$$$^$;$s(B" "$B%Q%9%o!<%I$N%U%!%$%k$,:n@.=PMh$^$;$s(B" ])) "Array of WNN error messages. Indexed by error code.") (defconst wnn7rpc-error-message500 '((Japanese . [ "$B0l;~3X=,<-=q$,4{$K4D6-$KEPO?$5$l$F$$$^$9(B" "$B0l;~3X=,<-=q$N4D6-$X$NEPO?$K<:GT$7$^$7$?(B" "$B0l;~3X=,<-=q$N4D6-$+$i$N:o=|$K<:GT$7$^$7$?(B" "$B%Q%i%a!<%?<+F0%A%e!<%K%s%0=hM}$r=i4|2=$9$k$3$H$,$G$-$^$;$s(B" "$B%Q%i%a!<%?<+F0%A%e!<%K%s%0%G!<%?$r:n@.$9$k$3$H$,$G$-$^$;$s(B" "$B%Q%i%a!<%?<+F0%A%e!<%K%s%0%G!<%?$,4V0c$C$F$$$^$9(B" ])) "Array of WNN error messages part of 500-1000. caution, start-no. is 500") (defconst wnn7rpc-error-message3000 '((Japanese . [ nil "$B#F#I4X78<-=q%U%!%$%k$G$O$"$j$^$;$s(B" "$B#F#I4X78IQEY%U%!%$%k$G$O$"$j$^$;$s(B" "$B#F#I4X78%7%9%F%`<-=q$G$O$"$j$^$;$s(B" "$B#F#I4X78%f!<%6<-=q$G$O$"$j$^$;$s(B" "$B8E$$%P!<%8%g%s$NIUB08l%U%!%$%k$,@_Dj$5$l$F$$$^$9(B" "$B#1$D$NIQEY%U%!%$%k$r0[$J$k<-=q4V$G6&MQ$7$h$&$H$7$^$7$?(B" nil nil nil "$B%5!<%P$,%m%C%/$5$l$F$$$^$9(B" "$B%i%$%;%s%9$, n-bunsetsu 0) (comm-unpack (u u u u u u u u u u u u) end start jiritsugo-end dic-no entry freq right-now hinshi status status-backward kangovect evaluation) (setq slist (cons (wnn7-bunsetsu-create env (1+ (- jiritsugo-end start)) dic-no entry freq right-now hinshi status status-backward kangovect evaluation) slist)) (setq n-bunsetsu (1- n-bunsetsu))) (prog1 (setq slist (nreverse slist)) (while slist (comm-unpack (S S S) result source fuzokugo) (wnn7-bunsetsu-set-converted (car slist) result) (wnn7-bunsetsu-set-yomi (car slist) source) (wnn7-bunsetsu-set-fuzokugo (car slist) fuzokugo) (setq slist (cdr slist)))))) (defun wnn7rpc-receive-dai-bunsetsu-list (env n-dai separate) (let ((proc (wnn7env-get-proc env)) n-bunstsu kanji-length dlist slist end start n-sho evaluation n retval) (comm-unpack (u u) n-bunstsu kanji-length) (while (> n-dai 0) (comm-unpack (u u u u) end start n-sho evaluation) (setq dlist (cons (cons n-sho evaluation) dlist) n-dai (1- n-dai))) (setq dlist (nreverse dlist) slist (wnn7rpc-receive-sho-bunsetsu-list env n-bunstsu)) (if (null separate) (prog1 slist (while dlist (setq n (caar dlist)) (while (> n 0) (wnn7-bunsetsu-set-dai-evaluation (car slist) (cdar dlist)) (wnn7-bunsetsu-set-dai-continue (car slist) (> n 1)) (setq slist (cdr slist) n (1- n))) (setq dlist (cdr dlist)))) (while dlist (setq retval (cons slist retval) n (caar dlist)) (while (> n 1) (wnn7-bunsetsu-set-dai-evaluation (car slist) (cdar dlist)) (wnn7-bunsetsu-set-dai-continue (car slist) t) (setq slist (cdr slist) n (1- n))) (wnn7-bunsetsu-set-dai-evaluation (car slist) (cdar dlist)) (wnn7-bunsetsu-set-dai-continue (car slist) (wnn7-bunsetsu-connect-next (car slist))) (setq slist (prog1 (cdr slist) (setcdr slist nil)) dlist (cdr dlist))) (nreverse retval)))) (defun wnn7rpc-renbunsetsu-conversion (env yomi hinshi fuzokugo v) "Convert YOMI string into Kanji. HINSHI and FUZOKUGO are information of preceding bunsetsu." (wnn7rpc-call-with-environment env () (comm-format (u u S i S i i i) (wnn-const JS_KANREN) env-id yomi hinshi fuzokugo (or v (wnn-const WNN_VECT_KANREN)) (if v (wnn-const WNN_VECT_KANREN) (wnn-const WNN_VECT_NO)) (wnn-const WNN_VECT_BUNSETSU)) (wnn7rpc-get-result (wnn7rpc-receive-dai-bunsetsu-list env result nil)))) (defun wnn7rpc-fi-renbunsetsu-conversion (env yomi hinshi fuzokugo v context) "Convert YOMI string into Kanji. HINSHI and FUZOKUGO are information of preceding bunsetsu." (wnn7rpc-call-with-environment env (result) (comm-format (u u S i S i i i i i i i S i i i i S) (wnn-const JS_FI_KANREN) env-id yomi hinshi fuzokugo (or v (wnn-const WNN_VECT_KANREN)) (if v (wnn-const WNN_VECT_KANREN) (wnn-const WNN_VECT_NO)) (wnn-const WNN_VECT_BUNSETSU) (wnn7-context-dic-no (car context)) (wnn7-context-entry (car context)) (wnn7-context-jirilen (car context)) (wnn7-context-hinshi (car context)) (wnn7-context-fuzokugo (car context)) (wnn7-context-dic-no (nth 1 context)) (wnn7-context-entry (nth 1 context)) (wnn7-context-jirilen (nth 1 context)) (wnn7-context-hinshi (nth 1 context)) (wnn7-context-fuzokugo (nth 1 context))) (setq result (wnn7rpc-get-result (wnn7rpc-receive-dai-bunsetsu-list env result nil))) (prog1 result (unless (numberp result) (wnn7-bunsetsu-set-fi-rel (car result) (wnn7rpc-get-fi-relation-data env)) (while result (wnn7-bunsetsu-set-context (car result) context) (setq result (cdr result))))))) (defun wnn7rpc-get-fi-relation-data (env) "Receive FI relation data from the server." (let ((proc (wnn7env-get-proc env)) fi-dic dic entry offset num result) (comm-unpack (i) num) (while (> num 0) (comm-unpack (u u u u) fi-dic dic entry offset) (setq result (cons (vector fi-dic dic entry offset -2 -4) result) num (1- num))) (nreverse result))) (defun wnn7rpc-tanbunsetsu-conversion (env yomi hinshi fuzoku v) "" (wnn7rpc-call-with-environment env (kanji-length) (comm-format (u u S i S i i) (wnn-const JS_KANTAN_SHO) env-id yomi hinshi fuzoku (or v (wnn-const WNN_VECT_KANTAN)) (if v (wnn-const WNN_VECT_KANTAN) (wnn-const WNN_VECT_NO))) (wnn7rpc-get-result (comm-unpack (u) kanji-length) ; ignore kanji-length (wnn7rpc-receive-sho-bunsetsu-list env result)))) (defun wnn7rpc-get-bunsetsu-candidates (env yomi hinshi fuzoku v) "" (wnn7rpc-call-with-environment env (kanji-length) (comm-format (u u S i S i i) (wnn-const JS_KANZEN_SHO) env-id yomi hinshi fuzoku (or v (wnn-const WNN_VECT_KANZEN)) (if v (wnn-const WNN_VECT_KANZEN) (wnn-const WNN_VECT_NO))) (wnn7rpc-get-result (comm-unpack (u) kanji-length) ; ignore kanji-length (mapcar (lambda (b) (wnn7-bunsetsu-set-dai-continue b (wnn7-bunsetsu-connect-next b)) (list b)) (wnn7rpc-receive-sho-bunsetsu-list env result))))) (defun wnn7rpc-daibunsetsu-conversion (env yomi hinshi fuzoku v) "" (wnn7rpc-call-with-environment env (n-sho-bunsetsu kanji-size) (comm-format (u u S i S i i) (wnn-const JS_KANTAN_DAI) env-id yomi hinshi fuzoku (or v (wnn-const WNN_VECT_KANTAN)) (if v (wnn-const WNN_VECT_KANTAN) (wnn-const WNN_VECT_NO))) (wnn7rpc-get-result (wnn7rpc-receive-dai-bunsetsu-list env result nil)))) (defun wnn7rpc-get-daibunsetsu-candidates (env yomi hinshi fuzoku v) "" (wnn7rpc-call-with-environment env (n-sho-bunsetsu kanji-size) (comm-format (u u S i S i i) (wnn-const JS_KANZEN_DAI) env-id yomi hinshi fuzoku (or v (wnn-const WNN_VECT_KANZEN)) (if v (wnn-const WNN_VECT_KANZEN) (wnn-const WNN_VECT_NO))) (wnn7rpc-get-result (wnn7rpc-receive-dai-bunsetsu-list env result t)))) (defun wnn7rpc-set-frequency (env dicno entry ima hindo) "" (wnn7rpc-call-with-environment env () (comm-format (u u i i i i) (wnn-const JS_HINDO_SET) env-id dicno entry ima hindo) (wnn7rpc-get-result))) (defun wnn7rpc-set-fi-priority (env fi-rel) "" (wnn7rpc-call-with-environment env () (progn (comm-format (u u u) (wnn-const JS_SET_FI_PRIORITY) env-id (length fi-rel)) (while fi-rel (comm-format (i i i i i i) (aref (car fi-rel) 0) (aref (car fi-rel) 1) (aref (car fi-rel) 2) (aref (car fi-rel) 3) (aref (car fi-rel) 4) (aref (car fi-rel) 5)) (setq fi-rel (cdr fi-rel)))) (wnn7rpc-get-result))) (defun wnn7rpc-optimize-fi (env context) "" (wnn7rpc-call-with-environment env (c) (progn (comm-format (u u u) (wnn-const JS_OPTIMIZE_FI) env-id (length context)) (while context (setq c (car context) context (cdr context)) (comm-format (i i i i i S) (wnn7-context-dic-no c) (wnn7-context-entry c) (wnn7-context-right-now c) (wnn7-context-freq c) (wnn7-context-length c) (concat (wnn7-context-converted c) (wnn7-context-fuzokugo c))))) (wnn7rpc-get-result))) (defun wnn7rpc-close (proc) "" (if (and (eq (process-status proc) 'open) (buffer-live-p (process-buffer proc))) (save-excursion (set-buffer (process-buffer proc)) (erase-buffer) (comm-format (u) (wnn-const JS_CLOSE)) (goto-char (point-max)) (process-send-region proc (point-min) (point-max)) (if (and (not (eq (process-status proc) 'exit)) (buffer-live-p (process-buffer proc))) (accept-process-output proc comm-accept-timeout))) (egg:error "process %s was killed" proc))) (defun wnn7rpc-env-exist (proc envname) "" (comm-call-with-proc proc (result) (comm-format (u s) (wnn-const JS_ENV_EXIST) envname) (comm-unpack (u) result) result)) (defun wnn7rpc-make-env-sticky (env) "" (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_ENV_STICKY) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-make-env-unsticky (env) "" (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_ENV_UNSTICKY) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-disconnect (env) "" (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_DISCONNECT) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-add-word (env dictionary yomi kanji comment hinshi initial-freq) "" (wnn7rpc-call-with-environment env () (comm-format (u u u S S S u u) (wnn-const JS_WORD_ADD) env-id dictionary yomi kanji comment hinshi initial-freq) (wnn7rpc-get-result))) (defun wnn7rpc-auto-learning (env type yomi kanji comment hinshi initial-freq) "" (wnn7rpc-call-with-environment env () (comm-format (u u u S S S u u) (wnn-const JS_AUTOLEARNING_WORD_ADD) env-id type yomi kanji comment hinshi initial-freq) (wnn7rpc-get-result))) (defun wnn7rpc-temporary-learning (env yomi kanji comment hinshi initial-freq) "" (wnn7rpc-call-with-environment env () (comm-format (u u S S S u u) (wnn-const JS_AUTOLEARNING_WORD_ADD) env-id yomi kanji comment hinshi initial-freq) (wnn7rpc-get-result))) (defun wnn7rpc-get-dictionary-list-with-environment (env) "" (wnn7rpc-call-with-environment env (n-dic) (comm-format (u u) (wnn-const JS_DIC_LIST) env-id) (comm-unpack (u) n-dic) (wnn7rpc-receive-dictionary-list proc n-dic))) (defun wnn7rpc-get-fi-dictionary-list-with-environment (env mask) "" (wnn7rpc-call-with-environment env (n-dic) (comm-format (u u u) (wnn-const JS_FI_DIC_LIST) env-id mask) (comm-unpack (u) n-dic) (wnn7rpc-receive-dictionary-list proc n-dic))) (defun wnn7rpc-receive-dictionary-list (proc n-dic) (let (entry dic freq dic-mode freq-mode enable-flag nice rev comment dicname freqname dic-passwd freq-passwd type gosuu dic-local-flag freq-local-flag retval) (while (> n-dic 0) (comm-unpack (u u u u u u u u S s s s s u u u u) entry dic freq dic-mode freq-mode enable-flag nice rev comment dicname freqname dic-passwd freq-passwd type gosuu dic-local-flag freq-local-flag) (setq retval (cons (vector entry dic freq dic-mode freq-mode enable-flag nice rev comment dicname freqname dic-passwd freq-passwd type gosuu dic-local-flag freq-local-flag) retval) n-dic (1- n-dic))) (nreverse retval))) (defsubst wnndic-get-id (dic) (aref dic 0)) (defsubst wnndic-get-comment (dic) (aref dic 8)) (defsubst wnndic-get-dictname (dic) (aref dic 9)) (defun wnn7rpc-get-writable-dictionary-id-list (env) "" (wnn7rpc-call-with-environment env (dic-list dic) (comm-format (u u i) (wnn-const JS_HINSI_DICTS) env-id -1) (wnn7rpc-get-result (while (> result 0) (comm-unpack (u) dic) (setq dic-list (nconc dic-list (list dic)) result (1- result))) dic-list))) (defun wnn7rpc-get-hinshi-list (env dic name) "" (wnn7rpc-call-with-environment env (hinshi hinshi-list str-size) (comm-format (u u u S) (wnn-const JS_HINSI_LIST) env-id dic name) (wnn7rpc-get-result (comm-unpack (u) str-size) ; ignore (while (> result 0) (comm-unpack (S) hinshi) (setq hinshi-list (nconc hinshi-list (list hinshi)) result (1- result))) hinshi-list))) (defun wnn7rpc-hinshi-number (proc name) "" (wnn7rpc-call-with-proc proc () (comm-format (u S) (wnn-const JS_HINSI_NUMBER) name) (wnn7rpc-get-result))) (defun wnn7rpc-get-conversion-parameter (env) "" (wnn7rpc-call-with-environment env (n nsho p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15) (comm-format (u u) (wnn-const JS_PARAM_GET) env-id) (wnn7rpc-get-result (comm-unpack (u u u u u u u u u u u u u u u u u) n nsho p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15) (vector n nsho p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15)))) (defun wnn7rpc-get-conversion-env-param (env) "" (wnn7rpc-call-with-environment env (p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20 p21 p22 p23 p24) (comm-format (u u) (wnn-const JS_GET_HENKAN_ENV) env-id) (wnn7rpc-get-result (comm-unpack (i i i i i i i i i i i i i i i i i i i i i i i i) p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20 p21 p22 p23 p24) (vector p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20 p21 p22 p23 p24)))) (defun wnn7rpc-file-loaded (proc path) "" (comm-call-with-proc proc (result) (comm-format (u s) (wnn-const JS_FILE_LOADED) path) (comm-unpack (u) result) result)) (defun wnn7rpc-write-file (env fid filename) (wnn7rpc-call-with-environment env () (comm-format (u u u s) (wnn-const JS_FILE_WRITE) env-id fid filename) (wnn7rpc-get-result))) (defun wnn7rpc-get-fuzokugo-file (env) "" (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_FUZOKUGO_GET) env-id) (wnn7rpc-get-result))) (defsubst wnn7rpc-receive-file-list (proc) (let ((i 0) flist nfiles fid local ref-count type name) (comm-unpack (u) nfiles) (while (> nfiles 0) (comm-unpack (u u u u s) fid local ref-count type name) (setq flist (nconc flist (list (vector fid local ref-count type name))) nfiles (1- nfiles))) flist)) (defun wnn7rpc-get-file-list (proc) "" (comm-call-with-proc proc () (comm-format (u) (wnn-const JS_FILE_LIST_ALL)) (wnn7rpc-receive-file-list proc))) (defun wnn7rpc-get-file-list-with-env (env) "" (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_FILE_LIST) env-id) (wnn7rpc-receive-file-list proc))) (defun wnn7rpc-file-attribute (env path) "3: dictionary, 4: hindo file, 5: fuzokugo-file" (wnn7rpc-call-with-environment env (result) (comm-format (u u s) (wnn-const JS_FILE_STAT) env-id path) (comm-unpack (u) result) result)) (defun wnn7rpc-get-file-info (env fid) "" (wnn7rpc-call-with-environment env (name local ref-count type) (comm-format (u u u) (wnn-const JS_FILE_INFO) env-id fid) (wnn7rpc-get-result (comm-unpack (s u u u) name local ref-count type) (vector name local ref-count type)))) (defmacro wnn7rpc-receive-vector (n) `(let ((v (make-vector ,n -1)) (i 0) j) (while (< i ,n) (comm-unpack (u) j) (aset v i j) (setq i (1+ i))) v)) (defun wnn7rpc-who (proc) "" (comm-call-with-proc proc (who socket username hostname) (comm-format (u) (wnn-const JS_WHO)) (wnn7rpc-get-result (while (> result 0) (comm-unpack (u s s) socket username hostname) (setq who (nconc who (list (vector socket username hostname (wnn7rpc-receive-vector (wnn-const WNN_MAX_ENV_OF_A_CLIENT))))) result (1- result))) who))) (defun wnn7rpc-get-env-list (proc) (comm-call-with-proc proc (envs id name count fuzokugo dic-max) (comm-format (u) (wnn-const JS_ENV_LIST)) (wnn7rpc-get-result (while (> result 0) (comm-unpack (u s u u u) id name count fuzokugo dic-max) (setq envs (nconc envs (list (vector id name count fuzokugo dic-max (wnn7rpc-receive-vector (wnn-const WNN_MAX_DIC_OF_AN_ENV)) (wnn7rpc-receive-vector (wnn-const WNN_MAX_FILE_OF_AN_ENV))))) result (1- result))) envs))) (defun wnn7rpc-kill (proc) "" (comm-call-with-proc proc (result) (comm-format (u) (wnn-const JS_KILL)) (comm-unpack (u) result) result)) (defun wnn7rpc-delete-dictionary (env dic) "" (wnn7rpc-call-with-environment env () (comm-format (u u u) (wnn-const JS_DIC_DELETE) env-id dic) (wnn7rpc-get-result))) (defun wnn7rpc-set-flag-on-dictionary (env dic flag) "" (wnn7rpc-call-with-environment env () (comm-format (u u u u) (wnn-const JS_DIC_USE) env-id dic flag) (wnn7rpc-get-result))) (defun wnn7rpc-get-dictionary-list (proc) "" (wnn7rpc-call-with-proc proc (n-dic) (comm-format (u) (wnn-const JS_DIC_LIST_ALL)) (comm-unpack (u) n-dic) (wnn7rpc-receive-dictionary-list proc n-dic))) (defun wnn7rpc-delete-word (env dic entry) "" (wnn7rpc-call-with-environment env () (comm-format (u u u u) (wnn-const JS_WORD_DELETE) env-id dic entry) (wnn7rpc-get-result))) (defun wnn7rpc-receive-word (proc yomi) (let (dic serial hinshi hindo right-now internal-hindo internal-right-now kanji comment l l1) (comm-unpack (u) dic) (while (>= dic 0) (comm-unpack (u u u u u u) serial hinshi hindo right-now internal-hindo internal-right-now) (setq l (cons (vector dic serial hinshi hindo right-now internal-hindo internal-right-now yomi nil nil) l)) (comm-unpack (u) dic)) (setq l (nreverse l) l1 l) (while l1 (comm-unpack (S S) kanji comment) (aset (car l1) 8 kanji) (aset (car l1) 9 comment) (setq l1 (cdr l1))) l)) (defun wnn7rpc-search-word-in-dictionary (env dic yomi) "" (wnn7rpc-call-with-environment env (n-entries len) (comm-format (u u u S) (wnn-const JS_WORD_SEARCH) env-id dic yomi) (comm-unpack (u u) n-entries len) ; ignore (wnn7rpc-receive-word proc yomi))) (defun wnn7rpc-search-word (env yomi) "" (wnn7rpc-call-with-environment env (n-entries len) (comm-format (u u S) (wnn-const JS_WORD_SEARCH_BY_ENV) env-id yomi) (comm-unpack (u u) n-entries len) ; ignore (wnn7rpc-receive-word proc yomi))) (defun wnn7rpc-get-word-info (env dic entry) "" (wnn7rpc-call-with-environment env (n-entries len yomi) (comm-format (u u u u) (wnn-const JS_WORD_INFO) env-id dic entry) (wnn7rpc-get-result (comm-unpack (S) yomi) (comm-unpack (u u) n-entries len) ; ignore (wnn7rpc-receive-word proc yomi)))) (defun wnn7rpc-set-comment-on-word (env dic entry comment) "" (wnn7rpc-call-with-environment env () (comm-format (u u u u S) (wnn-const JS_WORD_COMMENT_SET) env-id dic entry comment) (wnn7rpc-get-result))) (defun wnn7rpc-get-dictionary-info (env dic) "" (wnn7rpc-call-with-environment env () (comm-format (u u u) (wnn-const JS_DIC_INFO) env-id dic) (wnn7rpc-get-result (wnn7rpc-receive-dictionary-list proc 1)))) (defun wnn7rpc-set-file-comment (env fid comment) "" (wnn7rpc-call-with-environment env () (comm-format (u u u S) (wnn-const JS_FILE_COMMENT_SET) env-id fid comment) (wnn7rpc-get-result))) (defun wnn7rpc-hinshi-name (proc hinshi) "" (wnn7rpc-call-with-proc proc () (comm-format (u u) (wnn-const JS_HINSI_NAME) hinshi) (wnn7rpc-get-result (comm-unpack (S) result) result))) (defun wnn7rpc-set-file-password (env fid which old new) "WHICH: 1: DIC, 2: HINDO, 3(0): Both" (wnn7rpc-call-with-environment env () (comm-format (u u u u s s) (wnn-const JS_FILE_PASSWORD_SET) env-id fid which old new) (wnn7rpc-get-result))) (defun wnn7rpc-set-hinshi-table (env dic hinshi-table) "" (wnn7rpc-call-with-environment env () (comm-format (u u u S) (wnn-const JS_HINSI_TABLE_SET) env-id dic hinshi-table) (wnn7rpc-get-result))) (defmacro with-current-buffer-bin (buffer &rest body) "Temporarily make BUFFER the current buffer and execute the forms in BODY. The value returned is the value of the last form in BODY. See also `with-temp-buffer'." `(save-current-buffer (set-buffer ,buffer) (let ((coding-system-for-read 'binary) (coding-system-for-write 'binary)) (set-buffer-multibyte nil) ,@body))) (defmacro with-temp-buffer-bin (&rest forms) "Create a temporary buffer, and evaluate FORMS there like `progn'. See also `with-temp-file' and `with-output-to-string'." (let ((temp-buffer (make-symbol "temp-buffer"))) `(let ((,temp-buffer (get-buffer-create (generate-new-buffer-name " *temp*")))) (unwind-protect (let ((coding-system-for-read 'binary) (coding-system-for-write 'binary)) (set-buffer-multibyte nil) (with-current-buffer-bin ,temp-buffer ,@forms)) (and (buffer-name ,temp-buffer) (kill-buffer ,temp-buffer)))))) (defmacro wnn7rpc-with-temp-buffer (&rest body) ; `(with-temp-buffer ; (let ((coding-system-for-read 'binary) ; (coding-system-for-write 'binary)) ; (set-buffer-multibyte nil) ; ,@body))) `(with-temp-buffer-bin (let ((coding-system-for-read 'binary) (coding-system-for-write 'binary)) (set-buffer-multibyte nil) ,@body))) (defmacro with-temp-file-bin (file &rest forms) (let ((temp-file (make-symbol "temp-file")) (temp-buffer (make-symbol "temp-buffer"))) `(let ((,temp-file ,file) (,temp-buffer (get-buffer-create (generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 (with-current-buffer ,temp-buffer ,@forms) (with-current-buffer ,temp-buffer (widen) (let ((coding-system-for-read 'binary) (coding-system-for-write 'binary)) (write-region (point-min) (point-max) ,temp-file nil 0)))) (and (buffer-name ,temp-buffer) (kill-buffer ,temp-buffer)))))) (defmacro wnn7rpc-with-write-file (filename error-handler &rest body) ; `(condition-case error ; (with-temp-file ,filename ; (let ((coding-system-for-read 'binary) ; (coding-system-for-write 'binary)) ; (set-buffer-multibyte nil) ; ,@body)) ; (file-error ,error-handler))) `(condition-case error (with-temp-file-bin ,filename (let ((coding-system-for-read 'binary) (coding-system-for-write 'binary)) (set-buffer-multibyte nil) ,@body)) (file-error ,error-handler))) (defmacro wnn7rpc-terminate-current-command (errno) `(progn (comm-call-with-proc-1 proc () (comm-format (i) (wnn-const WNN_NAK))) (- (wnn-const ,errno)))) (defun wnn7rpc-get-local-filename (name) (if (and (string-match (wnn-const WNN_C_LOCAL) name) (string= (substring name 0 (match-beginning 0)) wnn-system-name)) (substring name (match-end 0)) name)) ;;
::= ( ) ;; ::= string ;; ::= string (defun wnn7rpc-scan-file-header () (let ((proc nil) type uniq1 uniq2 passwd) (if (and (> (point-max) (wnn-const WNN_FILE_HEADER_LEN)) ;;; (equal (buffer-substring 1 (1+ (wnn-const WNN_FILE_STRING_LEN))) ;;; (wnn-const WNN_FILE_STRING))) (or (equal (buffer-substring 1 (1+ (wnn-const WNN_FILE_STRING_LEN))) (wnn-const WNN_FILE_STRING)) (equal (buffer-substring 1 (1+ (wnn-const WNN_FILE_STRING_LEN))) (wnn-const WNN_FILE_STRING7)))) (progn (goto-char (1+ (wnn-const WNN_FILE_STRING_LEN))) (comm-unpack (u v v v) type uniq1 (wnn-const WNN_UNIQ_LEN) uniq2 (wnn-const WNN_UNIQ_LEN) passwd (wnn-const WNN_PASSWD_LEN)) (list type uniq1 uniq2 passwd))))) (defun wnn7rpc-get-file-header (filename) (wnn7rpc-with-temp-buffer (if (null (file-readable-p filename)) (list nil (make-string (wnn-const WNN_UNIQ_LEN) 0) "" "") (insert-file-contents-internal filename nil 0 (wnn-const WNN_FILE_HEADER_LEN)) (wnn7rpc-scan-file-header)))) (defun wnn7rpc-check-local-file (path &optional preserve) (let ((header (wnn7rpc-get-file-header path))) (cond ((null header) (- (wnn-const WNN_NOT_A_FILE))) ((null (car header)) (if (file-exists-p path) (- (wnn-const WNN_OPENF_ERR)) (- (wnn-const WNN_NO_EXIST)))) (t (if (wnn7rpc-check-inode header path) header (if preserve (- (wnn-const WNN_INODE_CHECK_ERROR)) (wnn7rpc-change-file-uniq header path) (wnn7rpc-check-local-file path t))))))) (defsubst wnn7rpc-get-inode (uniq) (+ (lsh (aref uniq 8) 24) (lsh (aref uniq 9) 16) (lsh (aref uniq 10) 8) (aref uniq 11))) (defun wnn7rpc-check-inode (header path) (let ((inode (nth 10 (file-attributes path)))) (and inode (= inode (wnn7rpc-get-inode (nth 1 header)))))) (defun wnn7rpc-make-uniq (attributes) (wnn7rpc-with-temp-buffer (let ((ctime (nth 6 attributes)) (ino (nth 10 attributes)) (devno (nth 11 attributes))) (if (numberp devno) (comm-format (U i u V) ctime devno ino wnn-system-name (wnn-const WNN_HOST_LEN)) ;; Emacs 21 returns returns negative devno as 16 bits uint pair (comm-format (U U u V) ctime (list (car devno) (cdr devno)) ino wnn-system-name (wnn-const WNN_HOST_LEN))) (buffer-string)))) (defun wnn7rpc-change-file-uniq (header path &optional new) (wnn7rpc-with-write-file path nil (insert-file-contents-internal path) (if (wnn7rpc-scan-file-header) (let ((uniq (wnn7rpc-make-uniq (file-attributes path)))) (goto-char (1+ (wnn-const WNN_FILE_STRING_LEN))) (delete-region (point) (1+ (wnn-const WNN_FILE_HEADER_LEN))) (comm-format (u v v v v) (car header) uniq (wnn-const WNN_UNIQ_LEN) (if new uniq (nth 1 header)) (wnn-const WNN_UNIQ_LEN) (nth 3 header) (wnn-const WNN_PASSWD_LEN) "" (wnn-const WNN_FILE_HEADER_PAD)) t)))) (defun wnn7rpc-check-passwd (proc passwd header) (let ((env-id -1)) (unwind-protect (if (< (setq env-id (wnn7rpc-connect proc "")) 0) -1 (wnn7rpc-call-with-environment (wnn7-env-create proc env-id) (file-id) (comm-format (u u v) (wnn-const JS_FILE_SEND) env-id (nth 1 header) (wnn-const WNN_UNIQ_LEN)) (comm-unpack (u) file-id) (if (>= file-id 0) (progn (wnn7rpc-get-result) ; ignore result code (- (wnn-const WNN_FILE_IN_USE))) (wnn7rpc-get-result (comm-call-with-proc-1 proc () (comm-format (s B) (concat wnn-system-name "!TEMPFILE") (wnn7rpc-make-dummy-dictionary header)) (wnn7rpc-get-result (let ((egg-fixed-euc (list egg-fixed-euc egg-fixed-euc))) (wnn7rpc-set-dictionary (wnn7-env-create proc env-id) result -1 1 t t passwd "" nil)))))))) (if (>= env-id 0) (wnn7rpc-disconnect (wnn7-env-create proc env-id)))))) (defun wnn7rpc-make-dummy-dictionary (header) (wnn7rpc-with-temp-buffer (comm-format (v u v v v v u v) ;;; (wnn-const WNN_FILE_STRING) (wnn-const WNN_FILE_STRING_LEN) (wnn-const WNN_FILE_STRING7) (wnn-const WNN_FILE_STRING_LEN) (wnn-const WNN_FT_DICT_FILE) (nth 1 header) (wnn-const WNN_UNIQ_LEN) (nth 1 header) (wnn-const WNN_UNIQ_LEN) (nth 3 header) (wnn-const WNN_PASSWD_LEN) "" (wnn-const WNN_FILE_HEADER_PAD) (wnn-const WNN_REV_DICT) "" (wnn-const WNN_FILE_BODY_PAD)) (buffer-string))) (defun wnn7rpc-file-loaded-local (proc path &optional preserve) "" (let ((header (wnn7rpc-check-local-file path preserve))) (if (numberp header) -1 (comm-call-with-proc proc (result) (comm-format (u v) (wnn-const JS_FILE_LOADED_LOCAL) (nth 1 header) (wnn-const WNN_UNIQ_LEN)) (comm-unpack (u) result) result)))) (defun wnn7rpc-file-receive (env fid local-filename) "" (condition-case err (wnn7rpc-call-with-environment env (filename) (comm-format (u u u) (wnn-const JS_FILE_RECEIVE) env-id fid) (comm-unpack (s) filename) (if (null local-filename) (setq local-filename (wnn7rpc-get-local-filename filename))) (let ((header (wnn7rpc-get-file-header local-filename)) contents) (if (null header) (wnn7rpc-terminate-current-command WNN_NOT_A_FILE) (comm-call-with-proc-1 proc () (comm-format (u v) (wnn-const WNN_ACK) (nth 1 header) (wnn-const WNN_UNIQ_LEN))) (wnn7rpc-get-result (cond ((= result 0) 0) ((null (file-writable-p local-filename)) (wnn7rpc-terminate-current-command WNN_FILE_WRITE_ERROR)) (t (wnn7rpc-with-write-file local-filename (- (wnn-const WNN_FILE_WRITE_ERROR)) (comm-call-with-proc proc () (comm-format (u) (wnn-const WNN_ACK)) (comm-unpack (B) contents)) (insert contents) (save-excursion (goto-char (point-min)) (wnn-perform-replace "\377\0" "\377")) (if (= result 2) (insert-file-contents-internal local-filename nil (1- (point)))) (save-excursion (set-buffer (process-buffer proc)) (wnn7rpc-get-result))))))))) ((quit error) (wnn7rpc-call-with-environment env () (comm-format (i) (wnn-const WNN_NAK))) (signal (car err) (cdr err))))) (defun wnn7rpc-file-send (env filename) "" (let ((header (wnn7rpc-check-local-file filename))) (if (numberp header) header (condition-case err (wnn7rpc-call-with-environment env (file-id) (comm-format (u u v) (wnn-const JS_FILE_SEND) env-id (nth 1 header) (wnn-const WNN_UNIQ_LEN)) (comm-unpack (u) file-id) (if (>= file-id 0) (wnn7rpc-get-result (wnn7env-set-client-file env filename) file-id) (wnn7rpc-get-result (comm-call-with-proc-1 proc () (comm-format (s B) (concat wnn-system-name "!" filename) (wnn7rpc-with-temp-buffer (insert-file-contents-internal filename) (buffer-string))) (wnn7rpc-get-result (wnn7env-set-client-file env filename) result))))) ((quit error) (wnn7rpc-call-with-environment env () (comm-format (s B B B B B B) "" "" "" "" "" "" "")) (signal (car err) (cdr err))))))) (defun wnn7rpc-file-remove-client (proc name passwd) (let (header) (cond ((/= (wnn7rpc-file-loaded-local proc name) -1) (- (wnn-const WNN_FILE_IN_USE))) ((null (file-readable-p name)) (- (wnn-const WNN_FILE_READ_ERROR))) ((null (numberp (car (setq header (wnn7rpc-get-file-header name))))) (- (wnn-const WNN_NOT_A_FILE))) ((< (wnn7rpc-check-passwd proc passwd header) 0) (- (wnn-const WNN_INCORRECT_PASSWD))) (t (condition-case nil (progn (delete-file name) 0) (error (- (wnn-const WNN_UNLINK)))))))) (defun wnn7rpc-dic-file-create-client (env dicname type comment passwd hpasswd) (if (and (null (file-exists-p dicname)) (file-writable-p dicname) (or (eq type (wnn-const WNN_REV_DICT)) (eq type (wnn-const CWNN_REV_DICT)) (eq type (wnn-const BWNN_REV_DICT)) (eq type (wnn-const WNN_UD_DICT)) (eq type (wnn-const WNN_FI_USER_DICT))) (wnn7rpc-create-and-move-to-client env nil dicname type comment passwd hpasswd)) 0 (- (wnn-const WNN_FILE_CREATE_ERROR)))) (defun wnn7rpc-hindo-file-create-client (env fi dic-id freqname comment passwd) (if (and (null (file-exists-p freqname)) (file-writable-p freqname) (wnn7rpc-create-and-move-to-client env dic-id freqname fi comment passwd nil)) 0 (- (wnn-const WNN_FILE_CREATE_ERROR)))) (defun wnn7rpc-make-temp-name (env) (let ((n 0) (temp-form "usr/temp")) (while (= (wnn7rpc-access env (concat temp-form (number-to-string n)) 0) 0) (setq n (1+ n))) (concat temp-form (number-to-string n)))) (defun wnn7rpc-create-and-move-to-client (env dic-id filename type comment passwd hpasswd) (let ((tempfile (wnn7rpc-make-temp-name env)) (created -1) (fid -1)) (unwind-protect (progn (if (numberp type) (setq created (wnn7rpc-dic-file-create env tempfile type comment passwd hpasswd)) (setq created (wnn7rpc-hindo-file-create env type dic-id tempfile comment passwd))) (if (and (>= created 0) (>= (setq fid (wnn7rpc-file-read env tempfile)) 0) (>= (wnn7rpc-file-receive env fid filename) 0)) (wnn7rpc-change-file-uniq (wnn7rpc-get-file-header filename) filename t) (condition-case nil (delete-file filename) (error)) nil)) (if (>= fid 0) (wnn7rpc-file-discard env fid)) (if (>= created 0) (wnn7rpc-file-remove (wnn7env-get-proc env) tempfile passwd))))) (defun wnn7rpc-read-passwd-file (filename) (cond ((null filename) "") ((null (file-readable-p filename)) (- (wnn-const WNN_FILE_READ_ERROR))) (t (wnn7rpc-with-temp-buffer (insert-file-contents-internal filename nil 0 (1- (wnn-const WNN_PASSWD_LEN))) (goto-char 1) (if (and (search-forward-regexp "[\0\n]" nil 0) (= (preceding-char) 0)) (backward-char)) (buffer-substring 1 (point)))))) ;;; ;;; Wnn7 new function: ;;; Input Prediction ;;; ;;; (defun wnn7rpc-yosoku-init (env) "Initialize input prediction function" (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_YOSOKU_INIT) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-free (env) "Free input prediction function area from server." (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_YOSOKU_FREE) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-yosoku (env moji) "Execute input prediction." (wnn7rpc-call-with-environment env (candnum len kouho kouho-list) (comm-format (u u E) (wnn-const JS_YOSOKU_YOSOKU) env-id moji) (wnn7rpc-get-result (comm-unpack (u) candnum) (while (> candnum 0) (comm-unpack (u s) len kouho) (setq kouho (decode-coding-string kouho 'euc-jp)) (setq kouho-list (nconc kouho-list (list kouho)) candnum (1- candnum))) kouho-list))) (defun wnn7rpc-yosoku-toroku (env bun-suu yosoku-bunsetsu) "Register the input prediction candidate." (wnn7rpc-call-with-environment env () (progn (comm-format (u u u) (wnn-const JS_YOSOKU_TOROKU) env-id bun-suu) (while yosoku-bunsetsu (comm-format (E u E u u) (aref (car yosoku-bunsetsu) 0) (aref (car yosoku-bunsetsu) 1) (aref (car yosoku-bunsetsu) 2) (aref (car yosoku-bunsetsu) 3) (aref (car yosoku-bunsetsu) 4)) (setq yosoku-bunsetsu (cdr yosoku-bunsetsu)))) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-selected-cand (env selectpos) "Select the input prediction candidate." (wnn7rpc-call-with-environment env () (comm-format (u u u) (wnn-const JS_YOSOKU_SELECTED_CAND) env-id selectpos) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-delete-cand (env selectpos) "Delete the input prediction candidate." (wnn7rpc-call-with-environment env () (comm-format (u u u) (wnn-const JS_YOSOKU_DELETE_CAND) env-id selectpos) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-cancel-latest-toroku (env) "Cancel the latest registered word." (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_YOSOKU_CANCEL_LATEST_TOROKU) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-reset-pre-yosoku (env) "Clear the connection information for the latest registered word." (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_YOSOKU_RESET_PRE_YOSOKU) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-ikkatsu-toroku (env torokustr) "Register the input prediction candidate with phrase analysis." (wnn7rpc-call-with-environment env () (comm-format (u u S) (wnn-const JS_YOSOKU_IKKATSU_TOROKU) env-id torokustr) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-save-datalist (env) "Save the input prediction data in data file." (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_YOSOKU_SAVE_DATALIST) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-init-time-keydata (env) "Initialize input efficiency data about inputed key." (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_YOSOKU_INIT_TIME_KEYDATA) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-init-inputinfo (env) "Initialize input efficiency data about input time." (wnn7rpc-call-with-environment env () (comm-format (u u) (wnn-const JS_YOSOKU_INIT_INPUTINFO) env-id) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-set-user-inputinfo (env allkey userkey yosokuselect) "Set user input information to the input efficiency data." (wnn7rpc-call-with-environment env () (comm-format (u u u u) (wnn-const JS_YOSOKU_SET_USER_INPUTINFO) env-id allkey (if yosokuselect (logior userkey #x8000) userkey)) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-set-timeinfo (env yosokuselect throughyosoku inputtime keylen) "Set input-time information to the input efficiency data." (wnn7rpc-call-with-environment env () (comm-format (u u u u u u) (wnn-const JS_YOSOKU_SET_TIMEINFO) env-id yosokuselect throughyosoku inputtime keylen) (wnn7rpc-get-result))) (defun wnn7rpc-yosoku-status (env) "Get input efficiency information." (wnn7rpc-call-with-environment env (totalrod totalallkey totaluserkey totalrot totalalltime totalusertime stmday sthour stmin ltmday lthour ltmin totalroykinput totalallykkey nowrod nowallkey nowuserkey nowrot nowalltime nowusertime timeperonekey) (comm-format (u u) (wnn-const JS_YOSOKU_STATUS) env-id) (comm-unpack (u) totalrod) (if (< totalrod 0) totalrod (comm-unpack (u u u u u u u u u u u u u u u u u u u u) totalallkey totaluserkey totalrot totalalltime totalusertime stmday sthour stmin ltmday lthour ltmin totalroykinput totalallykkey nowrod nowallkey nowuserkey nowrot nowalltime nowusertime timeperonekey) (vector totalrod totalallkey totaluserkey totalrot totalalltime totalusertime stmday sthour stmin ltmday lthour ltmin totalroykinput totalallykkey nowrod nowallkey nowuserkey nowrot nowalltime nowusertime timeperonekey)))) ;;; ;;; Wnn7 new function: ;;; association translation ;;; (defun wnn7rpc-assoc-with-data (env yomi hinsi fuzokugo v jilihin yomi_org jililen yomilen kanjilen real_kanjilen) "Convert YOMI string into Kanji with association." (wnn7rpc-call-with-environment env (kanji-length) (comm-format (u u S i S i i u S i i i i) (wnn-const JS_HENKAN_ASSOC) env-id yomi hinsi fuzokugo (or v (wnn-const WNN_VECT_KANZEN)) (if v (wnn-const WNN_VECT_KANZEN) (wnn-const WNN_VECT_NO)) jilihin yomi_org jililen yomilen kanjilen real_kanjilen) (wnn7rpc-get-result (comm-unpack (u) kanji-length) ; ignore kanji-length (mapcar (lambda (b) (wnn7-bunsetsu-set-dai-continue b (wnn7-bunsetsu-connect-next b)) (list b)) (wnn7rpc-receive-sho-bunsetsu-list env result))))) (defun wnn7rpc-set-henkan-hinshi (env mode nhinshi hlist) "" (wnn7rpc-call-with-environment env () (progn (comm-format (u u i i) (wnn-const JS_SET_HENKAN_HINSI) env-id mode nhinshi) (while hlist (comm-format (u) (car hlist)) (setq hlist (cdr hlist)))) (wnn7rpc-get-result))) (provide 'wnn7egg-rpcx21) ;;; wnn7egg-rpcx21.el ends here. wnn7egg-1.02.orig/elisp/xemacs21/wnn7egg.el0100644000764400003210000031457507474174160020621 0ustar ishikawaishikawa;; Wnn7Egg is Egg modified for Wnn7, and the current maintainer ;; is OMRON SOFTWARE Co., Ltd. ;; ;; This file is part of Wnn7Egg. (base code is egg.el (eggV3.09)) ;; ;;; ------------------------------------------------------------------ ;;; ;;; Wnn7Egg $B!J(BWnn "$B$J$J(B"$B$?$^$4!K(B--- Wnn7 Emacs Client ;;; ;;; Wnn7Egg $B$O!"!V$?$^$4Bh#3HG!W(Bv3.09 $B$r%Y!<%9$K(B $B!V$?$^$4Bh#4HG!W$NDL?.!"(B ;;; $B%i%$%V%i%jIt$rAH$_9~$s$@!"(BWnn7 $B$N0Y$N@lMQ%/%i%$%"%s%H$G$9!#(B ;;; ;;; $B$9$Y$F$N%=!<%9$,(B Emacs Lisp $B$G5-=R$5$l$F$$$k$N$G!"(BWnn SDK/Library $B$rI,MW(B ;;; $B$H$;$:!"(BGNU Emacs $B5Z$S(B XEmacs $B4D6-$G;HMQ$9$k$3$H$,$G$-$^$9!#;HMQ5vBz>r7o(B ;;; $B$O(B GPL $B$G$9!#(B ;;; ;;; GNU Emacs 20.3 $B0J9_!"(BXEmacs 21.x $B0J9_$GF0:n3NG'$7$F$$$^$9!#(B ;;; ;;; ;;; Wnn7Egg $B$O(B Wnn7 $B$N5!G=$G$"$k3Z!9F~NO!JF~NOM=B,!K!"O"A[JQ49$r%5%]!<%H(B ;;; $B$7$F$$$^$9!#(B ;;; ;;; $B!V$?$^$4!W$HFHN)!?6&B8$G$-$k$h$&$K!"1F6A$9$k$r(B ;;; "wnn7..." $B$H$$$&7A$KJQ99$7$F$$$^$9!#(B ;;; ;;; ------------------------------------------------------------------ ;; Japanese Character Input Package for Egg ;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) ;; This file is part of Egg on Mule (Multilingal Environment) ;; Egg is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; Egg is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to ;; the Free Software Foundation, 59 Temple Place - Suite 330, Boston, ;; MA 02111-1307, USA. ;;;================================================================== ;;; ;;; $BF|K\8l4D6-(B $B!V$?$^$4!W(B $BBh#3HG(B ;;; ;;;=================================================================== ;;; ;;;$B!V$?$^$4!W$O%M%C%H%o!<%/$+$J4A;zJQ49%5!<%P$rMxMQ$7!"(BMule $B$G$NF|K\(B ;;; $B8l4D6-$rDs6!$9$k%7%9%F%`$G$9!#!V$?$^$4!WBh#2HG$G$O(B Wnn V3 $B$*$h$S(B ;;; Wnn V4 $B$N$+$J4A;zJQ49%5!<%P$r;HMQ$7$F$$$^$9!#(B ;;; ;;; $BL>A0$O(B $B!VBt;3(B/$BBT$?$;$F(B/$B$4$a$s$J$5$$!W$N3FJ8@a$N@hF,#12;$G$"$k!V$?!W(B ;;; $B$H!V$^!W$H!V$4!W$r$K0M$k$b$N$G$9!#(Begg $B$O!V$?$^$4!W$N1QLu$G$9!#(B ;;; ;;; $B;HMQK!$O(B info/egg-jp $B$r8+$F2<$5$$!#(B ;;; ;;; ;;; $B!V$?$^$4!W$K4X$9$kDs0F!"Cn>pJs$O(B tomura@etl.go.jp $B$K$*Aw$j2<$5$$!#(B ;;; ;;; ;;; $B")(B 305 $B0q>k8)$D$/$P;TG_1`(B1-1-4 ;;; $BDL;:>J9)6H5;=Q1!EE;R5;=QAm9g8&5f=j(B ;;; $B>pJs%"!<%-%F%/%A%cIt8@8l%7%9%F%`8&5f<<(B ;;; ;;; $B8MB<(B $BE/(B ;;; ;;; ($BCm0U(B)$B$3$N%U%!%$%k$O4A;z%3!<%I$r4^$s$G$$$^$9!#(B ;;; ;;; $BBh#3HG(B $B#1#9#9#1G/#27n(B $B#4F|(B ;;; $BBh#2HG(B $B#1#9#8#9G/#67n(B $B#1F|(B ;;; $BBh#1HG(B $B#1#9#8#8G/#77n#1#4F|(B ;;; $B;CDjHG(B $B#1#9#8#8G/#67n#2#4F|(B ;;;=================================================================== ;;; ;;; (eval-when (load) (require 'wnn-client)) ;;; (defvar egg-version "3.11 wnn7" "Version number of this version of Egg. ") ;;; Last modified date: Sun Sep 30 00:00:00 2001 ;;;; $B=$@5MW5a%j%9%H(B ;;;; read-hiragana-string, read-kanji-string $B$G;HMQ$9$kJ?2>L>F~NO%^%C%W$r(B roma-kana $B$K8GDj$7$J$$$GM_$7$$!%(B ;;;; $B=$@5%a%b(B ;;; 01.9.30 modified by OMRON SOFTWARE Co.,Ltd. ;;; $B%X%k%W%b!<%I$H%j!<%8%g%s;XDj$N4X?tL>$N=$@5(B ;;; 01.5.30 modified by OMRON SOFTWARE Co., Ltd. ;;; Wnn7 $B@\B3$N0Y$N5!G=DI2C!JF~NOM=B,!uO"A[JQ49!K(B ;;; XEmacs $B;HMQ$*$h$S(B egg v3.10 $B$H$N6&B8$N$?$a$N0lIt=$@5(B ;;; 95.6.5 modified by S.Tomura ;;; $BJQ49D>8e$KO"B3$7$FJQ49$9$k>l9g$rG'<1$9$k$?$a$K!"(B"-in-cont" $B$K4XO"$7$?(B ;;; $BItJ,$rDI2C$7$?!#!J$3$NItJ,$O>-Mh:F=$@5$9$kM=Dj!#!K(B ;;; 93.6.19 modified by T.Shingu ;;; egg:*in-fence-mode* should be buffer local. ;;; 93.6.4 modified by T.Shingu ;;; In its-defrule**, length is called instead of chars-in-string. ;;; 93.3.15 modified by T.Enami ;;; egg-self-insert-command simulates the original more perfectly. ;;; 92.12.20 modified by S.Tomura ;;; In its:simulate-input, sref is called instead of aref. ;;; 92.12.20 modified by T.Enami ;;; egg-self-insert-command calls cancel-undo-boundary to simulate original. ;;; 92.11.4 modified by M.Higashida ;;; read-hiragana-string sets minibuffer-preprompt correctly. ;;; 92.10.26, 92.10.30 modified by T.Saneto sanewo@pdp.crl.sony.co.jp ;;; typo fixed. ;;; 92.10.18 modified by K. Handa ;;; special-symbol-input $BMQ$N%F!<%V%k$r(B autoload $B$K!#(B ;;; busyu.el $B$N(B autoload $B$N;XDj$r(B mule-init.el $B$+$i(B egg.el $B$K0\$9!#(B ;;; 92.9.20 modified by S. Tomura ;;;; hiragana-region $B$NCn$N=$@5(B ;;;; 92.9.19 modified by Y. Kawabe ;;;; some typos ;;;; 92.9.19 modified by Y. Kawabe ;;;; menu $B$NI=<(4X78$N(B lenght $B$r(B string-width $B$KCV$-49$($k!%(B ;;; 92.8.19 modified for Mule Ver.0.9.6 by K.Handa ;;;; menu:select-from-menu calls string-width instead of length. ;;;; 92.8.1 modified by S. Tomura ;;;; internal mode $B$rDI2C!%(Bits:*internal-mode-alist* $BDI2C!%(B ;;;; 92.7.31 modified by S. Tomura ;;;; its-mode-map $B$,(B super mode map $B$r;}$D$h$&$KJQ99$7$?!%$3$l$K$h$j(B ;;;; mode map $B$,6&M-$G$-$k!%(B its-define-mode, get-next-map $B$J$I$rJQ99!%(B ;;;; get-next-map-locally $B$rDI2C!%(Bits-defrule** $B$rJQ99!%(B ;;;; 92.7.31 modified by S. Tomura ;;;; its:make-kanji-buffer , its:*kanji* $B4XO"%3!<%I$r:o=|$7$?!%(B ;;;; 92.7.31 modified by S. Tomura ;;;; egg:select-window-hook $B$r=$@5$7!$(Bminibuffer $B$+$i(B exit $B$9$k$H$-$K!$(B ;;;; $B3F ;;; Attribute bold can be used. ;;; Unnecessary '*' in comments of variables deleted. ;;; 92.7.8 modified for Mule Ver.0.9.5 by Y.Kawabe ;;; special-symbol-input keeps the position selected last. ;;; 92.7.8 modified for Mule Ver.0.9.5 by T.Shingu ;;; busyu-input and kakusuu-input are added in *symbol-input-menu*. ;;; 92.7.7 modified for Mule Ver.0.9.5 by K.Handa ;;; In egg:quit-mode, overwrite-mode is supported correctly. ;;; egg:*overwrite-mode-deleted-chars* is not used now. ;;; 92.6.26 modified for Mule Ver.0.9.5 by K.Handa ;;; Funtion dump-its-mode-map gets obsolete. ;;; 92.6.26 modified for Mule Ver.0.9.5 by M.Shikida ;;; Backquote ` is registered in *hankaku-alist* and *zenkaku-alist*. ;;; 92.6.17 modified for Mule Ver.0.9.5 by T.Shingu ;;; Bug in make-jis-second-level-code-alist fixed. ;;; 92.6.14 modified for Mule Ver.0.9.5 by T.Enami ;;; menu:select-from-menu is replaced with new version. ;;; 92.5.18 modified for Mule Ver.0.9.4 by T.Shingu ;;; lisp/wnn-egg.el is devided into two parts: this file and wnn*-egg.el. ;;;; ;;;; Mule Ver.0.9.3 $B0JA0(B ;;;; ;;;; April-15-92 for Mule Ver.0.9.3 ;;;; by T.Enami and K.Handa ;;;; notify-internal calls 'message' with correct argument. ;;;; April-11-92 for Mule Ver.0.9.3 ;;;; by T.Enami and K.Handa ;;;; minibuffer $B$+$iH4$1$k;~(B egg:select-window-hook $B$G(B egg:*input-mode* $B$r(B ;;;; t $B$K$9$k!#(Bhook $B$N7A$rBgI}=$@5!#(B ;;;; April-3-92 for Mule Ver.0.9.2 by T.Enami ;;;; minibuffer $B$+$iH4$1$k;~(B egg:select-window-hook $B$,(B new-buffer $B$N(B ;;;; egg:*mode-on* $B$J$I$r(B nil $B$K$7$F$$$k$N$r=$@5!#(B ;;;; Mar-22-92 by K.Handa ;;;; etags $B$,:n$k(B TAGS $B$KITI,MW$J$b$N$rF~$l$J$$$h$&$K$9$k$?$a4X?tL>JQ99(B ;;;; define-its-mode -> its-define-mode, defrule -> its-defrule ;;;; Mar-16-92 by K.Handa ;;;; global-map $B$X$N(B define-key $B$r(B mule-keymap $B$KJQ99!#(B ;;;; Mar-13-92 by K.Handa ;;;; Language specific part $B$r(B japanese.el,... $B$K0\$7$?!#(B ;;;; Feb-*-92 by K. Handa ;;;; nemacs 4 $B$G$O(B minibuffer-window-selected $B$,GQ;_$K$J$j!$4XO"$9$k%3!<%I$r:o=|$7$?!%(B ;;;; Jan-13-92 by S. Tomura ;;;; mc-emacs or nemacs 4 $BBP1~:n6H3+;O!%(B ;;;; Aug-9-91 by S. Tomura ;;;; ?\^ $B$r(B ?^ $B$K=$@5!%(B ;;;; menu $B$r(B key map $B$r8+$k$h$&$K$9$k!%(B ;;;; Jul-6-91 by S. Tomura ;;;; setsysdict $B$N(B error $B%a%C%;!<%8$rJQ99!%(B ;;;; Jun-11-91 by S. Tomura ;;;; its:*defrule-verbose* $B$rDI2C!%(B ;;;; ;;;; Mar-25-91 by S. Tomura ;;;; reset-its-mode $B$rGQ;_(B ;;;; Mar-23-91 by S. Tomura ;;;; read-hiragana-string $B$r=$@5!$(B read-kanji-string $B$rDI2C!$(B ;;;; isearch:read-kanji-string $B$r@_Dj!%(B ;;;; Mar-22-91 by S. Tomura ;;;; defrule-conditional, defrule-select-mode-temporally $B$rDI2C!#(B ;;;; for-each $B$N4J0WHG$H$7$F(B dolist $B$rDI2C!#(B ;;;; enable-double-n-syntax $B$r3hMQ!%$[$+$K(B use-kuten-for-comma, use-touten-for-period $B$rDI2C(B ;;;; Mar-5-91 by S. Tomura ;;;; roma-kana-word, henkan-word, roma-kanji-word $B$rDI2C$7$?!%(B ;;;; Jan-14-91 by S. Tomura ;;;; $BF~NOJ8;zJQ497O(B ITS(Input character Translation System) $B$r2~B$$9$k!%(B ;;;; $BJQ49$O:G:8:GD9JQ49$r9T$J$$!$JQ49$N$J$$$b$N$O$b$H$N$^$^$H$J$k!%(B ;;;; $B2~B$$NF05!$ON)LZ!w7D1~$5$s$N%O%s%0%kJ8;z$NF~NOMW5a$G$"$k!%(B ;;;; its:* $B$rDI2C$7$?!%$^$?=>Mh(B fence-self-insert-command $B$H(B roma-kana-region ;;;; $BFs2U=j$K$o$+$l$F$$$?%3!<%I$r(B its:translate-region $B$K$h$C$F0lK\2=$7$?!%(B ;;;; July-30-90 by S. Tomura ;;;; henkan-region $B$r(Boverwrite-mode $B$KBP1~$5$;$k!%JQ?t(B ;;;; egg:*henkan-fence-mode*, egg:*overwrite-mode-deleted-chars* ;;;; $B$rDI2C$7!$(Bhenkan-fence-region, henkan-region-internal, ;;;; quit-egg-mode $B$rJQ99$9$k!%(B ;;;; Mar-4-90 by K.Handa ;;;; New variable alphabet-mode-indicator, transparent-mode-indicator, ;;;; and henkan-mode-indicator. ;;;; Feb-27-90 by enami@ptgd.sony.co.jp ;;;; menu:select-from-menu $B$G#22U=j$"$k(B ((and (<= ?0 ch) (<= ch ?9)... ;;;; $B$N0lJ}$r(B ((and (<= ?0 ch) (<= ch ?9)... $B$K=$@5(B ;;;; Feb-07-89 ;;;; bunsetu-length-henko $B$NCf$N(B egg:*attribute-off $B$N0LCV$r(B KKCP $B$r8F$VA0$K(B ;;;; $BJQ99$9$k!#(B wnn-client $B$G$O(B KKCP $B$r8F$V$HJ8@a>pJs$,JQ2=$9$k!#(B ;;;; Feb-01-89 ;;;; henkan-goto-kouho $B$N(B egg:set-bunsetu-attribute $B$N0z?t(B ;;;; $B$N=gHV$,4V0c$C$F$$$?$N$r=$@5$7$?!#!J(Btoshi@isvax.isl.melco.co.jp ;;;; (Toshiyuki Ito)$B$N;XE&$K$h$k!#!K(B ;;;; Dec-25-89 ;;;; meta-flag t $B$N>l9g$NBP1~$r:F=$@5$9$k!#(B ;;;; overwrite-mode $B$G$N(B undo $B$r2~A1$9$k!#(B ;;;; Dec-21-89 ;;;; bug fixed by enami@ptdg.sony.co.jp ;;;; (fboundp 'minibuffer-window-selected ) ;;;; -->(boundp 'minibuffer-window-selected ) ;;;; self-insert-after-hook $B$r(B buffer local $B$K$7$FDj5A$r(B kanji.el $B$X0\F0!#(B ;;;; Dec-15-89 ;;;; kill-all-local-variables $B$NDj5A$r(B kanji.el $B$X0\F0$9$k!#(B ;;;; Dec-14-89 ;;;; meta-flag t $B$N>l9g$N=hM}$r=$@5$9$k(B ;;;; overwrite-mode $B$KBP1~$9$k!#(B ;;;; Dec-12-89 ;;;; egg:*henkan-open*, egg:*henkan-close* $B$rDI2C!#(B ;;;; egg:*henkan-attribute* $B$rDI2C(B ;;;; set-egg-fence-mode-format, set-egg-henkan-mode-format $B$rDI2C(B ;;;; Dec-12-89 ;;;; *bunpo-code* $B$K(B 1000: "$B$=$NB>(B" $B$rDI2C(B ;;;; Dec-11-89 ;;;; egg:*fence-attribute* $B$r?7@_(B ;;;; egg:*bunsetu-attribute* $B$r?7@_(B ;;;; Dec-11-89 ;;;; attribute-*-region $B$rMxMQ$9$k$h$&$KJQ99$9$k!#(B ;;;; menu:make-selection-list $B$O(B width $B$,>.$5$$;~$K(Bloop $B$9$k!#$3$l$r=$@5$7$?!#(B ;;;; Dec-10-89 ;;;; set-marker-type $B$rMxMQ$9$kJ}<0$KJQ99!#(B ;;;; Dec-07-89 ;;;; egg:search-path $B$rDI2C!#(B ;;;; egg-default-startup-file $B$rDI2C$9$k!#(B ;;;; Nov-22-89 ;;;; egg-startup-file $B$rDI2C$9$k!#(B ;;;; eggrc-search-path $B$r(B egg-startup-file-search-path $B$KL>A0JQ99!#(B ;;;; Nov-21-89 ;;;; Nemacs 3.2 $B$KBP1~$9$k!#(Bkanji-load* $B$rGQ;_$9$k!#(B ;;;; wnnfns.c $B$KBP1~$7$?=$@5$r2C$($k!#(B ;;;; *Notification* buffer $B$r8+$($J$/$9$k!#(B ;;;; Oct-2-89 ;;;; *zenkaku-alist* $B$N(B $BJ8;zDj?t$N=q$-J}$,4V0c$C$F$$$?!#(B ;;;; Sep-19-89 ;;;; toggle-egg-mode $B$N=$@5!J(Bkanji-flag$B!K(B ;;;; egg-self-insert-command $B$N=$@5(B $B!J(Bkanji-flag$B!K(B ;;;; Sep-18-89 ;;;; self-insert-after-hook $B$NDI2C(B ;;;; Sep-15-89 ;;;; EGG:open-wnn bug fix ;;;; provide wnn-egg feature ;;;; Sep-13-89 ;;;; henkan-kakutei-before-point $B$r=$@5$7$?!#(B ;;;; enter-fence-mode $B$NDI2C!#(B ;;;; egg-exit-hook $B$NDI2C!#(B ;;;; henkan-region-internal $B$NDI2C!#(Bhenkan-region$B$O(B point $B$r(Bmark $B$9$k!#(B ;;;; eggrc-search-path $B$NDI2C!#(B ;;;; Aug-30-89 ;;;; kanji-kanji-1st $B$rD{@5$7$?!#(B ;;;; May-30-89 ;;;; EGG:open-wnn $B$O(B get-wnn-host-name $B$,(B nil $B$N>l9g!"(B(system-name) $B$r;HMQ$9$k!#(B ;;;; May-9-89 ;;;; KKCP:make-directory added. ;;;; KKCP:file-access bug fixed. ;;;; set-default-usr-dic-directory modified. ;;;; Mar-16-89 ;;;; minibuffer-window-selected $B$r;H$C$F(B minibuffer $B$N(B egg-mode$BI=<(5!G=DI2C(B ;;;; Mar-13-89 ;;;; mode-line-format changed. ;;;; Feb-27-89 ;;;; henkan-saishou-bunsetu added ;;;; henkan-saichou-bunsetu added ;;;; M-< henkan-saishou-bunsetu ;;;; M-> henkan-saichou-bunsetu ;;;; Feb-14-89 ;;;; C-h in henkan mode: help-command added ;;;; Feb-7-89 ;;;; egg-insert-after-hook is added. ;;;; M-h fence-hiragana ;;;; M-k fence-katakana ;;;; M-> fence-zenkaku ;;;; M-< fence-hankaku ;;;; Dec-19-88 henkan-hiragana, henkan-katakara$B$rDI2C!'(B ;;;; M-h henkan-hiragana ;;;; M-k henkan-katakana ;;;; Ver. 2.00 kana2kanji.c $B$r;H$o$:(B wnn-client.el $B$r;HMQ$9$k$h$&$KJQ99!#(B ;;;; $B4XO"$7$F0lIt4X?t$rJQ99(B ;;;; Dec-2-88 special-symbol-input $B$rDI2C!((B ;;;; C-^ special-symbol-input ;;;; Nov-18-88 henkan-mode-map $B0lItJQ99!((B ;;;; M-i henkan-inspect-bunsetu ;;;; M-s henkan-select-kouho ;;;; C-g henkan-quit ;;;; Nov-18-88 jserver-henkan-kakutei $B$N;EMMJQ99$KH<$$!"(Bkakutei $B$N%3!<(B ;;;; $B%I$rJQ99$7$?!#(B ;;;; Nov-17-88 kakutei-before-point $B$G(B point $B0J9_$N4V0c$C$?ItJ,$NJQ49(B ;;;; $B$,IQEY>pJs$KEPO?$5$l$J$$$h$&$K=$@5$7$?!#$3$l$K$O(BKKCC:henkan-end ;;;; $B$N0lIt;EMM$HBP1~$9$k(Bkana2kanji.c$B$bJQ99$7$?!#(B ;;;; Nov-17-88 henkan-inspect-bunsetu $B$rDI2C$7$?!#(B ;;;; Nov-17-88 $B?7$7$$(B kana2kanji.c $B$KJQ99$9$k!#(B ;;;; Sep-28-88 defrule$B$,CM$H$7$F(Bnil$B$rJV$9$h$&$KJQ99$7$?!#(B ;;;; Aug-25-88 $BJQ493X=,$r@5$7$/9T$J$&$h$&$KJQ99$7$?!#(B ;;;; KKCP:henkan-kakutei$B$O(BKKCP:jikouho-list$B$r8F$s$@J8@a$KBP$7$F$N$_E,(B ;;;; $BMQ$G$-!"$=$l0J30$N>l9g$N7k2L$OJ]>Z$5$l$J$$!#$3$N>r7o$rK~$?$9$h$&(B ;;;; $B$K(BKKCP:jikouho-list$B$r8F$s$G$$$J$$J8@a$KBP$7$F$O(B ;;;; KKCP:henkan-kakutei$B$r8F$P$J$$$h$&$K$7$?!#(B ;;;; Aug-25-88 egg:do-auto-fill $B$r=$@5$7!"J#?t9T$K$o$?$k(Bauto-fill$B$r@5(B ;;;; $B$7$/9T$J$&$h$&$K=$@5$7$?!#(B ;;;; Aug-25-88 menu command$B$K(B\C-l: redraw $B$rDI2C$7$?!#(B ;;;; Aug-25-88 toroku-region$B$GEPO?$9$kJ8;zNs$+$i(Bno graphic character$B$r(B ;;;; $B<+F0E*$K=|$/$3$H$K$7$?!#(B (eval-when-compile (require 'wnn7egg-jsymbol)) ;;;---------------------------------------------------------------------- ;;; ;;; Utilities ;;; ;;;---------------------------------------------------------------------- ;;; ;;;; (if (and (featurep 'xemacs) (not (fboundp 'overlayp))) (require 'overlay)) (if (not (featurep 'xemacs)) (defun characterp (form) (numberp form)) ;; 97.2.4 Created by J.Hein to simulate Mule-2.3 (defun egg-read-event () "FSFmacs event emulator that shoves non key events into unread-command-events to facilitate translation from Mule-2.3" (let ((event (make-event)) ch key) (next-command-event event) (setq key (event-key event)) (if (and (key-press-event-p event) (not (event-matches-key-specifier-p event 'backspace))) (if (eq 0 (event-modifier-bits event)) (setq ch (or (event-to-character event) key)) (if (eq 1 (event-modifier-bits event)) (setq ch (if (characterp key) (or (int-to-char (- (char-to-int key) 96)) (int-to-char (- (char-to-int key) 64))) (event-to-character event))) (setq unread-command-events (list event)))) (setq unread-command-events (list event))) ch))) (defun coerce-string (form) (cond((stringp form) form) ((characterp form) (char-to-string form)))) (defun coerce-internal-string (form) (cond((stringp form) (if (= (length form) 1) (string-to-char form) form)) ((characterp form) form))) ;;; kill-all-local-variables $B$+$iJ]8n$9$k(B local variables $B$r;XDj$G$-$k(B ;;; $B$h$&$KJQ99$9$k!#(B (put 'egg:*input-mode* 'permanent-local t) (put 'egg:*mode-on* 'permanent-local t) (put 'its:*current-map* 'permanent-local t) (put 'mode-line-egg-mode 'permanent-local t) ;; undo functions. (make-variable-buffer-local (defvar egg-buffer-undo-list nil)) (make-variable-buffer-local (defvar egg-buffer-modified-flag nil)) (defun suspend-undo () (setq egg-buffer-undo-list buffer-undo-list egg-buffer-modified-flag (buffer-modified-p))) (defun resume-undo-list () (setq buffer-undo-list egg-buffer-undo-list) (if (not egg-buffer-modified-flag) (let ((time (visited-file-modtime))) (if (eq time 0) (setq time '(0 . 0))) (set 'buffer-undo-list (cons (cons t time) buffer-undo-list))))) ;;;---------------------------------------------------------------------- ;;; ;;; 16$B?JI=8=$N(BJIS $B4A;z%3!<%I$r(B minibuffer $B$+$iFI$_9~$`(B ;;; ;;;---------------------------------------------------------------------- ;;; ;;; User entry: jis-code-input ;;; (defun jis-code-input () (interactive) (insert-jis-code-from-minibuffer "JIS $B4A;z%3!<%I(B(16$B?J?tI=8=(B): ")) (defun insert-jis-code-from-minibuffer (prompt) (let ((str (read-from-minibuffer prompt)) val) (while (null (setq val (read-jis-code-from-string str))) (beep) (setq str (read-from-minibuffer prompt str))) (if (featurep 'xemacs) (insert (make-char (find-charset 'japanese-jisx0208) (car val) (cdr val))) (insert (make-char 'japanese-jisx0208 (car val) (cdr val)))))) (defun hexadigit-value (ch) (cond((and (<= ?0 ch) (<= ch ?9)) (- ch ?0)) ((and (<= ?a ch) (<= ch ?f)) (+ (- ch ?a) 10)) ((and (<= ?A ch) (<= ch ?F)) (+ (- ch ?A) 10)))) (defun read-jis-code-from-string (str) (if (and (= (length str) 4) (<= 2 (hexadigit-value (aref str 0))) (hexadigit-value (aref str 1)) (<= 2 (hexadigit-value (aref str 2))) (hexadigit-value (aref str 3))) (cons (+ (* 16 (hexadigit-value (aref str 0))) (hexadigit-value (aref str 1))) (+ (* 16 (hexadigit-value (aref str 2))) (hexadigit-value (aref str 3)))))) ;;;---------------------------------------------------------------------- ;;; ;;; $B!V$?$^$4!W(B Notification System ;;; ;;;---------------------------------------------------------------------- (defconst *notification-window* " *Notification* ") ;;;(defmacro notify (str &rest args) ;;; (list 'notify-internal ;;; (cons 'format (cons str args)))) (defun notify (str &rest args) (notify-internal (apply 'format (cons str args)))) (defun notify-internal (message &optional noerase) (save-excursion (set-buffer (get-buffer-create *notification-window*)) (goto-char (point-max)) (setq buffer-read-only nil) (insert (substring (current-time-string) 4 19) ":: " message ?\n ) (setq buffer-read-only t) (save-window-excursion (bury-buffer (current-buffer)))) (message "%s" message) ; 92.4.15 by T.Enami (if noerase nil (let ((focus-follows-mouse t)) (sleep-for 1)) (message ""))) ;;;(defmacro notify-yes-or-no-p (str &rest args) ;;; (list 'notify-yes-or-no-p-internal ;;; (cons 'format (cons str args)))) (defun notify-yes-or-no-p (str &rest args) (notify-yes-or-no-p-internal (apply 'format (cons str args)))) (defun notify-yes-or-no-p-internal (message) (save-window-excursion (pop-to-buffer *notification-window*) (goto-char (point-max)) (setq buffer-read-only nil) (insert (substring (current-time-string) 4 19) ":: " message ?\n ) (setq buffer-read-only t) (yes-or-no-p "$B$$$$$G$9$+!)(B"))) (defun notify-y-or-n-p (str &rest args) (notify-y-or-n-p-internal (apply 'format (cons str args)))) (defun notify-y-or-n-p-internal (message) (save-window-excursion (pop-to-buffer *notification-window*) (goto-char (point-max)) (setq buffer-read-only nil) (insert (substring (current-time-string) 4 19) ":: " message ?\n ) (setq buffer-read-only t) (y-or-n-p "$B$$$$$G$9$+!)(B"))) (defun select-notification () (interactive) (pop-to-buffer *notification-window*) (setq buffer-read-only t)) ;;;---------------------------------------------------------------------- ;;; ;;; Minibuffer Menu System ;;; ;;;---------------------------------------------------------------------- ;;; user-customizable variables (defvar menu:*display-item-value* nil "*Non-nil means values of items are displayed in minibuffer menu") ;;; The following will be localized, added only to pacify the compiler. (defvar menu:*cur-menu*) (defvar menu:*cur-selection*) (defvar menu:*cur-selections*) (defvar menu:*cur-element-no*) (defvar menu:*cur-selection-no*) (defvar menu:*cur-element-points*) (defvar menu:*menu-stack*) (defvar minibuffer-local-menu-map (make-sparse-keymap)) (if (featurep 'xemacs) (set-keymap-default-binding minibuffer-local-menu-map 'undefined)) (mapcar (lambda (elem) (define-key minibuffer-local-menu-map (car elem) (intern (format "menu:%s" (cdr elem))))) '( (" " . next-element) ("\C-a" . beginning-of-selection) ("\C-b" . previous-element) ("\C-d" . previous-element) ("\C-e" . end-of-selection) ("\C-f" . next-element) ("\C-g" . quit) ("\C-h" . previous-element) ("\C-i" . next-element) ("\C-j" . select) ("\C-l" . refresh) ("\C-m" . select) ("\C-n" . next-selection) ("\C-p" . previous-selection) ([backspace] . previous-element) ([clear] . quit) ([delete] . previous-element) ([down] . next-selection) ([kp-down] . next-selection) ([kp-enter] . select) ([kp-left] . previous-element) ([kp-right] . next-element) ([kp-tab] . next-element) ([kp-up] . previous-selection) ([left] . previous-element) ([next] . next-selection) ([prior] . previous-selection) ([return] . select) ([right] . next-element) ([tab] . next-element) ([up] . previous-selection) )) ;;; 0 .. 9 A .. Z a .. z and kp (if (featurep 'xemacs) (progn (mapcar (lambda (char) (define-key minibuffer-local-menu-map (char-to-string char) 'menu:goto-nth-element)) "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") ;; kp-0 .. kp-9 (mapcar (lambda (key) (define-key minibuffer-local-menu-map key 'menu:goto-nth-element)) (list [kp-0] [kp-1] [kp-2] [kp-3] [kp-4] [kp-5] [kp-6] [kp-7] [kp-8] [kp-9]))) (mapcar (lambda (char) (define-key minibuffer-local-menu-map (vector char) 'menu:goto-nth-element)) "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")) ;;; ;;; predicates and selectors for menu ;;; ;; ::= ( menu ) ;; ::= ( ... ) ;; ::= ( . ) | ;; | ( . ) | ;; :: = | ;; (defun menu:menup (value) (and (listp value) (eq (car value) 'menu))) (defun menu:menu-prompt (&optional menu) (car (cdr (or menu menu:*cur-menu*)))) (defun menu:menu-items (&optional menu) (car (cdr (cdr (or menu menu:*cur-menu*))))) (defun menu:menu-nth-item (n &optional menu) (nth n (menu:menu-items menu))) (defun menu:item-string (item) (cond ((stringp item) item) ((characterp item) (char-to-string item)) ((consp item) (let ((str (cond ((stringp (car item)) (car item)) ((characterp (car item)) (char-to-string (car item))) (t "")))) (if menu:*display-item-value* (format "%s [%s]" str (cdr item)) str))) (t ""))) (defun menu:item-value (item) (cond ((stringp item) item) ((characterp item) (char-to-string item)) ((consp item) (cdr item)) (t ""))) (defun menu:select-submenu (submenu) "Save the current selection state, and select a new menu." (setq menu:*menu-stack* (cons (list menu:*cur-selection* menu:*cur-selections* menu:*cur-element-no* menu:*cur-selection-no* menu:*cur-menu* menu:*cur-element-points*) menu:*menu-stack*)) (setq menu:*cur-menu* submenu)) (defun menu:select-saved-menu () "Restore the most recently stored selection state." (let ((save (car menu:*menu-stack*))) (setq menu:*menu-stack* (cdr menu:*menu-stack*)) (setq menu:*cur-selection* (nth 0 save);92.10.26 by T.Saneto menu:*cur-selections* (nth 1 save) menu:*cur-element-no* (nth 2 save) menu:*cur-selection-no* (nth 3 save) menu:*cur-menu* (nth 4 save) menu:*cur-element-points* (nth 5 save)))) ;;; ;;; constructors and selector for selection ;;; ;; ::= ( . ) ;; ... integer that means the absolute position in menu items ;; ::= ( ... ) ;; (defsubst menu:make-selection (pos elements) (cons pos elements)) (defsubst menu:selection-pos (&optional selection) (car (or selection menu:*cur-selection*))) (defsubst menu:selection-elements (&optional selection) (cdr (or selection menu:*cur-selection*))) (defsubst menu:selection-nth-element (&optional n selection) (nth (or n menu:*cur-element-no*) (menu:selection-elements selection))) (defsubst menu:selection-element-length (&optional selection) (length (menu:selection-elements selection))) (defun menu:make-selections (items width) "Make selection list from ITEMS so that each selection can fit with WIDTH." (let ((headpos 0) (pos 0) (size 0) revselections revelems item-string item-width) (while items (setq item-string (menu:item-string (car items))) (setq item-width (string-width item-string)) ;;; 92.9.19 by Y. Kawabe (cond ((and revelems (<= width (+ size 4 item-width))) (setq revselections (cons (menu:make-selection headpos (nreverse revelems)) revselections)) (setq revelems nil) (setq size 0) (setq headpos pos)) ((or (null (cdr items)) (<= width (+ size 4 item-width))) (setq revselections (cons (menu:make-selection headpos (nreverse (cons item-string revelems))) revselections)) (setq size 0) (setq headpos pos) (setq items (cdr items)) (setq pos (1+ pos))) (t ;;; 92.9.19 by Y. Kawabe (setq revelems (cons item-string revelems)) (setq size (+ size 4 item-width)) (setq items (cdr items)) (setq pos (1+ pos))))) (nreverse revselections))) (defun menu:setup-selections (window-width initpos) (setq menu:*cur-selections* (menu:make-selections (menu:menu-items) (- window-width ;;; 92.8.19 by K.Handa (string-width (menu:menu-prompt))))) (if initpos (let ((selections menu:*cur-selections*)) (setq menu:*cur-selection-no* 0) (while (and (cdr selections) (< (menu:selection-pos (car (cdr selections))) initpos)) (setq menu:*cur-selection-no* (1+ menu:*cur-selection-no*)) (setq selections (cdr selections))) (setq menu:*cur-element-no* (- initpos (menu:selection-pos (car selections))))))) ;;; utility (defun menu:check-number-range (i min max) (cond ((eq i 'max) max) ((eq i 'min) min) ((< i min) max) ((< max i) min) (t i))) ;;; ;;; main part of menu ;;; (defun menu:select-from-menu (menu &optional initial position) "Display menu in minibuffer and return the selected value. If INITIAL is non-nil integer list, it behaves as menu is selected using the path specified by INITIAL in advance. If POSITION is non-nil value, return value is a pair of the selected value and the chosen path (represented by an integer list)." (let ((menu:*cur-menu* menu) (menu:*window-width* (window-width (minibuffer-window))) menu:*cur-selection* menu:*cur-selections* menu:*cur-element-no* menu:*cur-selection-no* menu:*cur-element-points* menu:*menu-stack* menu:*select-positions* (pos 0) value finished) (if initial (progn (if (numberp initial) (setq initial (list initial))) (while (cdr initial) (setq value (menu:item-value (menu:menu-nth-item (car initial)))) (if (menu:menup value) (progn (menu:setup-selections menu:*window-width* (car initial)) (menu:select-submenu value))) (setq menu:*select-positions* (cons (car initial) menu:*select-positions*)) (setq initial (cdr initial))) (setq pos (car initial)))) (while (not finished) (menu:setup-selections menu:*window-width* pos) (add-hook 'minibuffer-setup-hook 'menu:minibuffer-setup) (unwind-protect (setq pos (read-from-minibuffer "" nil minibuffer-local-menu-map t 'menu:*select-positions*)) (remove-hook 'minibuffer-setup-hook 'menu:minibuffer-setup) (if quit-flag (setq pos nil quit-flag nil))) (cond (pos ; element selected (setcar menu:*select-positions* pos) (setq value (menu:item-value (menu:menu-nth-item pos))) (if (menu:menup value) (progn (menu:select-submenu value) (setq pos 0)) (setq finished t))) (menu:*menu-stack* ; quit (restore menu) (if (not (car menu:*select-positions*)) (setq menu:*select-positions* (cdr menu:*select-positions*))) (setq menu:*select-positions* (cdr menu:*select-positions*)) (menu:select-saved-menu)) (t ; really quit (setq quit-flag t) (setq menu:*select-positions* nil) (setq finished t)))) (if position (cons value (nreverse menu:*select-positions*)) value))) (defalias 'menu:minibuffer-setup 'menu:goto-selection) (defun menu:goto-selection (&optional sel-no elem-no) (setq menu:*cur-selection-no* (menu:check-number-range (or sel-no menu:*cur-selection-no*) 0 (1- (length menu:*cur-selections*)))) (setq menu:*cur-selection* (nth menu:*cur-selection-no* menu:*cur-selections*)) (erase-buffer) (insert (menu:menu-prompt)) (let ((elements (menu:selection-elements)) (i 0) revpoints) (while elements (setq revpoints (cons (+ (point) 2) revpoints)) (insert (if (<= i 9) (format " %d." i) (format " %c." (+ (- i 10) ?a))) (car elements)) (setq elements (cdr elements) i (1+ i))) (setq menu:*cur-element-points* (nreverse revpoints))) (menu:goto-element elem-no)) (defun menu:goto-element (&optional elem-no) (setq menu:*cur-element-no* (menu:check-number-range (or elem-no menu:*cur-element-no*) 0 (1- (menu:selection-element-length)))) (goto-char (nth menu:*cur-element-no* menu:*cur-element-points*))) (defun menu:beginning-of-selection () (interactive) (menu:goto-element 0)) (defun menu:end-of-selection () (interactive) (menu:goto-element (1- (menu:selection-element-length)))) (defun menu:next-selection () (interactive) (menu:goto-selection (1+ menu:*cur-selection-no*))) (defun menu:previous-selection () (interactive) (menu:goto-selection (1- menu:*cur-selection-no*))) (defun menu:next-element () (interactive) (if (< menu:*cur-element-no* (1- (menu:selection-element-length))) (menu:goto-element (1+ menu:*cur-element-no*)) (menu:goto-selection (1+ menu:*cur-selection-no*) 0))) (defun menu:previous-element () (interactive) (if (< 0 menu:*cur-element-no*) (menu:goto-element (1- menu:*cur-element-no*)) (menu:goto-selection (1- menu:*cur-selection-no*) 'max))) (defun menu:goto-nth-element () (interactive) (let ((ch (if (featurep 'xemacs) (event-to-character last-command-event) (if (integerp last-command-event) last-command-event (get last-command-event 'ascii-character)))) (elem-no-max (1- (menu:selection-element-length)))) (if ch (cond ((and (<= ?0 ch) (<= ch ?9) (<= ch (+ ?0 elem-no-max))) (menu:goto-element (- ch ?0))) ((and (<= ?a ch) (<= ch ?z) (<= (+ 10 ch) (+ ?a elem-no-max))) (menu:goto-element (+ 10 (- ch ?a)))) ((and (<= ?A ch) (<= ch ?Z) (<= (+ 10 ch) (+ ?A elem-no-max))) (menu:goto-element (+ 10 (- ch ?A)))))))) (defun menu:refresh () (interactive) (menu:goto-selection)) (defun menu:select () (interactive) (erase-buffer) (prin1 (+ (menu:selection-pos) menu:*cur-element-no*) (current-buffer)) (exit-minibuffer)) (defun menu:quit () (interactive) (erase-buffer) (prin1 nil (current-buffer)) (exit-minibuffer)) ;;;---------------------------------------------------------------------- ;;; ;;; $B0l3g7?JQ495!G=(B ;;; ;;;---------------------------------------------------------------------- ;;; ;;; $B$R$i$,$JJQ49(B ;;; (defun hiragana-paragraph () "hiragana paragraph at or after point." (interactive ) (save-excursion (forward-paragraph) (let ((end (point))) (backward-paragraph) (japanese-hiragana-region (point) end)))) (defun hiragana-sentence () "hiragana sentence at or after point." (interactive ) (save-excursion (forward-sentence) (let ((end (point))) (backward-sentence) (japanese-hiragana-region (point) end)))) ;;; ;;; $B%+%?%+%JJQ49(B ;;; (defun katakana-paragraph () "katakana paragraph at or after point." (interactive ) (save-excursion (forward-paragraph) (let ((end (point))) (backward-paragraph) (japanese-katakana-region (point) end)))) (defun katakana-sentence () "katakana sentence at or after point." (interactive ) (save-excursion (forward-sentence) (let ((end (point))) (backward-sentence) (japanese-katakana-region (point) end)))) ;;; ;;; $BH>3QJQ49(B ;;; (defun hankaku-paragraph () "hankaku paragraph at or after point." (interactive ) (save-excursion (forward-paragraph) (let ((end (point))) (backward-paragraph) (japanese-hankaku-region (point) end 'ascii-only)))) (defun hankaku-sentence () "hankaku sentence at or after point." (interactive ) (save-excursion (forward-sentence) (let ((end (point))) (backward-sentence) (japanese-hankaku-region (point) end 'ascii-only)))) (defun hankaku-word (arg) (interactive "p") (let ((start (point))) (forward-word arg) (japanese-hankaku-region start (point) 'ascii-only))) ;;; ;;; $BA43QJQ49(B ;;; (defun zenkaku-paragraph () "zenkaku paragraph at or after point." (interactive ) (save-excursion (forward-paragraph) (let ((end (point))) (backward-paragraph) (japanese-zenkaku-region (point) end)))) (defun zenkaku-sentence () "zenkaku sentence at or after point." (interactive ) (save-excursion (forward-sentence) (let ((end (point))) (backward-sentence) (japanese-zenkaku-region (point) end)))) (defun zenkaku-word (arg) (interactive "p") (let ((start (point))) (forward-word arg) (japanese-zenkaku-region start (point)))) ;;; ;;; $B%m!<%^;z$+$JJQ49(B ;;; (defun roma-kana-region (start end ) (interactive "r") (its:translate-region start end nil (its:get-mode-map "roma-kana"))) (defun roma-kana-paragraph () "roma-kana paragraph at or after point." (interactive ) (save-excursion (forward-paragraph) (let ((end (point))) (backward-paragraph) (roma-kana-region (point) end )))) (defun roma-kana-sentence () "roma-kana sentence at or after point." (interactive ) (save-excursion (forward-sentence) (let ((end (point))) (backward-sentence) (roma-kana-region (point) end )))) (defun roma-kana-word () "roma-kana word at or after point." (interactive) (save-excursion (re-search-backward "\\b\\w" nil t) (let ((start (point))) (re-search-forward "\\w\\b" nil t) (roma-kana-region start (point))))) ;;; ;;; $B%m!<%^;z4A;zJQ49(B ;;; (defun roma-kanji-region (start end) (interactive "r") (roma-kana-region start end) (save-restriction (narrow-to-region start (point)) (goto-char (point-min)) (replace-regexp "\\($B!!(B\\| \\)" "") (goto-char (point-max))) (if (wnn7-p) (wnn7-henkan-region-internal start (point)) (henkan-region-internal start (point)))) (defun roma-kanji-paragraph () "roma-kanji paragraph at or after point." (interactive ) (save-excursion (forward-paragraph) (let ((end (point))) (backward-paragraph) (roma-kanji-region (point) end )))) (defun roma-kanji-sentence () "roma-kanji sentence at or after point." (interactive ) (save-excursion (forward-sentence) (let ((end (point))) (backward-sentence) (roma-kanji-region (point) end )))) (defun roma-kanji-word () "roma-kanji word at or after point." (interactive) (save-excursion (re-search-backward "\\b\\w" nil t) (let ((start (point))) (re-search-forward "\\w\\b" nil t) (roma-kanji-region start (point))))) ;;;---------------------------------------------------------------------- ;;; ;;; $B!V$?$^$4!WF~NOJ8;zJQ497O(B ITS ;;; ;;;---------------------------------------------------------------------- (defun egg:member (elt list) (while (not (or (null list) (equal elt (car list)))) (setq list (cdr list))) list) ;;; ;;; Mode name --> map ;;; ;;; ITS mode name: string (defvar its:*mode-alist* nil) (defvar its:*internal-mode-alist* nil) (defun its:get-mode-map (name) (let ((map-pair (or (assoc name its:*mode-alist*) (assoc name its:*internal-mode-alist*)))) (cond ((null (cdr map-pair)) nil) ((stringp (cdr map-pair)) (let ((file (cdr map-pair)) (map its:*mode-alist*)) (while map (if (and (stringp (cdar map)) (string= (cdar map) file)) (setcdr (car map) nil)) (setq map (cdr map))) (load file) (cdr (assoc name its:*mode-alist*)))) (t (cdr map-pair))))) (defun its:set-mode-map (name map &optional internalp) (let ((place (assoc name (if internalp its:*internal-mode-alist* its:*mode-alist*)))) (if place (let ((mapplace (cdr place))) (if mapplace (progn (setcar mapplace (car map)) (setcdr mapplace (cdr map))) ;; map $B$rJ,2r$7$F(B cons $B$9$kI,MW$,$"$k$N$+$I$&$+(B ;; $BJ,$+$i$J$$$,>e$HF1$8$h$&$K$7$F$$$k!%(Bkatsuya (setcdr place (cons (car map) (cdr map))))) (setq place (cons name map)) (if internalp (setq its:*internal-mode-alist* (append its:*internal-mode-alist* (list place))) (setq its:*mode-alist* (append its:*mode-alist* (list place))))))) ;;; ;;; ITS mode indicators ;;; Mode name --> indicator ;;; (defun its:get-mode-indicator (name) (let ((map (its:get-mode-map name))) (if map (map-indicator map) name))) (defun its:set-mode-indicator (name indicator) (let ((map (its:get-mode-map name))) (if map (map-set-indicator map indicator) (its-define-mode name indicator)))) ;;; ;;; ITS mode declaration ;;; (defvar its:*processing-map* nil) (defun its-define-mode (name &optional indicator reset supers internalp) "its-mode NAME $B$rDj5AA*Br$9$k!%B>$N(B its-mode $B$,A*Br$5$l$k$^$G$O(B its-defrule $B$J$I$O(B NAME $B$KBP$7$F5,B'$rDI2C$9$k!%(BINDICATOR $B$,(B non-nil $B$N;~$K$O(B its-mode NAME $B$rA*Br$9$k$H(B mode-line $B$KI=<($5$l$k!%(BRESET $B$,(B non-nil $B$N;~$K$O(B its-mode $B$NDj5A$,6u$K$J$k!%(BSUPERS $B$O>e0L$N(B its-mode $BL>$r%j%9%H$G;XDj$9$k!%(BINTERNALP $B$O(B mode name $B$rFbItL>$H$9$k!%(B its-defrule, its-defrule-conditional, defule-select-mode-temporally $B$r(B $B;2>H(B" (if (null(its:get-mode-map name)) (progn (setq its:*processing-map* (make-map nil (or indicator name) nil (mapcar 'its:get-mode-map supers))) (its:set-mode-map name its:*processing-map* internalp) ) (progn (setq its:*processing-map* (its:get-mode-map name)) (if indicator (map-set-indicator its:*processing-map* indicator)) (if reset (progn (map-set-state its:*processing-map* nil) (map-set-alist its:*processing-map* nil) )) (if supers (progn (map-set-supers its:*processing-map* (mapcar 'its:get-mode-map supers)))))) nil) (defun its-autoload-mode-map (name file) (setq its:*mode-alist* (append its:*mode-alist* (list (cons name file))))) ;;; ;;; defrule related utilities ;;; (put 'for-each 'lisp-indent-hook 1) (defmacro for-each (vars &rest body) "(for-each ((VAR1 LIST1) ... (VARn LISTn)) . BODY) $B$OJQ?t(B VAR1 $B$NCM(B $B$r%j%9%H(B LIST1 $B$NMWAG$KB+G{$7!$!%!%!%JQ?t(B VARn $B$NCM$r%j%9%H(B LISTn $B$NMW(B $BAG$KB+G{$7$F(B BODY $B$ruBV$G$NI=<($r:n@.$9$k4X?t$r;XDj$9$k(B. $B4X?t$O(B map input action state $B$r0z?t$H$7$F8F$P$l!$>uBVI=<($NJ8;zNs$rJV$9!%(B") (defun its:default-make-terminal-state (map input action state) (cond(state state) (t input))) (defun its:make-terminal-state-hangul (map input action state) (cond((its:standard-actionp action) (action-output action)) (t nil))) (defvar its:make-non-terminal-state 'its:default-make-standard-non-terminal-state "$BHs=*C<$N>uBV$G$NI=<($r:n@.$9$k4X?t$r;XDj$9$k!%4X?t$O(B map input $B$r(B $B0z?t$H$7$F8F$P$l!$>uBVI=<($NJ8;zNs$rJV$9(B" ) (defun its:default-make-standard-non-terminal-state (map input) " ****" (concat (map-state-string map) (char-to-string (aref input (1- (length input)))))) (defun its-defrule (input output &optional next state map) "INPUT $B$,F~NO$5$l$k$H(B OUTPUT $B$KJQ49$9$k!%(BNEXT $B$,(B nil $B$G$J$$$H$-$OJQ(B $B49$7$?8e$K(B NEXT $B$,F~NO$5$l$?$h$&$KJQ49$rB3$1$k!%(BINPUT$B$,F~NO$5$l$?;~E@(B $B$GJQ49$,3NDj$7$F$$$J$$;~$O(B STATE $B$r%U%'%s%9>e$KI=<($9$k!%JQ49$,3NDj$7(B $B$F$$$J$$;~$KI=<($9$kJ8;zNs$OJQ?t(B its:make-terminal-state $B$*$h$S(B $BJQ?t(B its:make-non-terminal-state $B$K;X<($5$l$?4X?t$K$h$C$F@8@.$5$l$k!%JQ495,(B $BB'$O(B MAP $B$G;XDj$5$l$?JQ49I=$KEPO?$5$l$k!%(BMAP $B$,(B nil $B$N>l9g$O$b$C$H$b:G(B $B6a$K(B its-define-mode $B$5$l$?JQ49I=$KEPO?$5$l$k!%$J$*(B OUTPUT $B$,(B nil $B$N>l(B $B9g$O(B INPUT $B$KBP$9$kJQ495,B'$,:o=|$5$l$k!%(B" (its-defrule* input (its:make-standard-action output next) state (if (stringp map) map its:*processing-map*))) (defmacro its-defrule-conditional (input &rest conds) "(its-defrule-conditional INPUT ((COND1 OUTPUT1) ... (CONDn OUTPUTn)))$B$O(B INPUT $B$,F~NO$5$l$?;~$K>r7o(B CONDi $B$r=guBV(B STATE $B$rI=<($7!$>r7o(B CONDi $B$r(B $B=gl9g(B, its-defrule $B$N7Y9p$rM^@)$9$k(B") (defun its-defrule** (i input action state map) (cond((= (length input) i) ;93.6.4 by T.Shingu (map-set-state map (coerce-internal-string (funcall its:make-terminal-state map input action state))) (if (and its:*defrule-verbose* (map-action map)) (if action (notify "(its-defrule \"%s\" \"%s\" ) $B$r:FDj5A$7$^$7$?!%(B" input action) (notify "(its-defrule \"%s\" \"%s\" )$B$r:o=|$7$^$7$?!%(B" input (map-action map)))) (if (and (null action) (map-terminalp map)) nil (progn (map-set-action map action) map))) (t (if (featurep 'xemacs) (let((newmap (or (get-next-map-locally map (aref input i)) (make-map (funcall its:make-non-terminal-state map (substring input 0 (+ i (char-bytes (aref input i))))))))) (set-next-map map (aref input i) (its-defrule** (+ i (char-bytes (aref input i))) input action state newmap))) (let((newmap (or (get-next-map-locally map (aref input i)) (make-map (funcall its:make-non-terminal-state map (substring input 0 (1+ i))))))) (set-next-map map (aref input i) (its-defrule** (1+ i) input action state newmap)))) (if (and (null (map-action map)) (map-terminalp map)) nil map)))) ;;; ;;; map: ;;; ;;; ::= ( ( . ) ... ) ;;; ::= ( nil ) ;;; ::= ( .... ) ;;; ::= ( ) ;;; ::= | ( ) .... (defun make-map (&optional state action alist supers) (list state action alist supers)) (defun map-topmap-p (map) (null (map-state map))) (defun map-supers (map) (nth 3 map)) (defun map-set-supers (map val) (setcar (nthcdr 3 map) val)) (defun map-terminalp (map) (null (map-alist map))) (defun map-state (map) (nth 0 map)) (defun map-state-string (map) (coerce-string (map-state map))) (defun map-set-state (map val) (setcar (nthcdr 0 map) val)) (defun map-indicator (map) (map-action map)) (defun map-set-indicator (map indicator) (map-set-action map indicator)) (defun map-action (map) (nth 1 map)) (defun map-set-action (map val) (setcar (nthcdr 1 map) val)) (defun map-alist (map) (nth 2 map)) (defun map-set-alist (map alist) (setcar (nthcdr 2 map) alist)) (defun get-action (map) (if (null map) nil (let ((action (map-action map))) (cond((its:standard-actionp action) action) ((symbolp action) (condition-case nil (funcall action) (error nil))) (t (condition-case nil (eval action) (error nil))))))) (defun action-output (action) (cond((stringp action) action) (t (car action)))) (defun action-next (action) (cond((stringp action) nil) (t (car (cdr action))))) (defun get-next-map (map ch) (or (cdr (assq ch (map-alist map))) (if (map-topmap-p map) (let ((supers (map-supers map)) (result nil)) (while supers (setq result (get-next-map (car supers) ch)) (if result (setq supers nil) (setq supers (cdr supers)))) result)))) (defun get-next-map-locally (map ch) (cdr (assq ch (map-alist map)))) (defun set-next-map (map ch val) (let ((place (assq ch (map-alist map)))) (if place (if val (setcdr place val) (map-set-alist map (delq place (map-alist map)))) (if val (map-set-alist map (cons (cons ch val) (map-alist map))) val)))) (defun its:simple-actionp (action) (stringp action)) (defun collect-simple-action (map) (if (map-terminalp map) (if (its:simple-actionp (map-action map)) (list (map-action map)) nil) (let ((alist (map-alist map)) (result nil)) (while alist (setq result ;;; 92.9.19 by Y. Kawabe (append (collect-simple-action (cdr (car alist))) result)) (setq alist (cdr alist))) result))) ;;;---------------------------------------------------------------------- ;;; ;;; Runtime translators ;;; ;;;---------------------------------------------------------------------- (defun its:simulate-input (i j input map) (if (featurep 'xemacs) (while (<= i j) (setq map (get-next-map map (aref input i))) ;92.12.26 by S.Tomura (setq i (+ i (char-bytes (aref input i))))) ;92.12.26 by S.Tomura (while (<= i j) (setq map (get-next-map map (aref input i))) ;92.12.26 by S.Tomura (setq i (1+ i)))) ;92.12.26 by S.Tomura map) ;;; meta-flag $B$,(B on $B$N;~$K$O!"F~NO%3!<%I$K(B \200 $B$r(B or $B$7$?$b$N$,F~NO$5(B ;;; $B$l$k!#$3$NItJ,$N;XE&$OEl9)Bg$NCf@n(B $B5.G7$5$s$K$h$k!#(B ;;; pointted by nakagawa@titisa.is.titech.ac.jp Dec-11-89 ;;; ;;; emacs $B$G$O(B $BJ8;z%3!<%I$O(B 0-127 $B$G07$&!#(B ;;; (defvar its:*buff-s* (make-marker)) (defvar its:*buff-e* (make-marker)) (set-marker-insertion-type its:*buff-e* t) ;;; STATE unread ;;; |<-s p->|<- e ->| ;;; s : ch0 state0 map0 ;;; +1: ch1 state1 map1 ;;; .... ;;; (point): ;;; longest matching region : [s m] ;;; suspending region: [m point] ;;; unread region : [point e] (defvar its:*maxlevel* 10) (defvar its:*maps* (make-vector its:*maxlevel* nil)) (defvar its:*actions* (make-vector its:*maxlevel* nil)) (defvar its:*inputs* (make-vector its:*maxlevel* 0)) (defvar its:*level* 0) (defun its:resize (size) (if (<= its:*maxlevel* size) (setq its:*maxlevel* size its:*maps* (make-vector size nil) its:*actions* (make-vector size nil) its:*inputs* (make-vector size 0)))) (defun its:reset-maps (&optional init) (setq its:*level* 0) (if init (aset its:*maps* its:*level* init))) (defun its:current-map () (aref its:*maps* its:*level*)) (defun its:previous-map () (aref its:*maps* (max 0 (1- its:*level*)))) (defun its:level () its:*level*) (defun its:enter-newlevel (map ch output) (setq its:*level* (1+ its:*level*)) (aset its:*maps* its:*level* map) (aset its:*inputs* its:*level* ch) (aset its:*actions* its:*level* output)) (defvar its:*char-from-buff* nil) (defvar its:*interactive* t) (defun its:reset-input () (setq its:*char-from-buff* nil)) (defun its:flush-input-before-point (from) (save-excursion (while (<= from its:*level*) (its:insert-char (aref its:*inputs* from)) (setq from (1+ from))))) (if (featurep 'xemacs) (progn (defun its:peek-char () (if (= (point) its:*buff-e*) (if its:*interactive* (let ((ch (egg-read-event))) (if ch (progn (setq unread-command-events (list (character-to-event ch))) ch) nil)) nil) (char-after (point)))) (defun its:read-char () (if (= (point) its:*buff-e*) (progn (setq its:*char-from-buff* nil) (if its:*interactive* (egg-read-event) nil)) (let ((ch (char-after (point)))) (setq its:*char-from-buff* t) (delete-char 1) ch))) (defun its:push-char (ch) (if its:*char-from-buff* (save-excursion (its:insert-char ch)) (if ch (setq unread-command-events (list (character-to-event ch)))))) (defun its:insert-char (ch) (insert ch)) (defun its:ordinal-charp (ch) (and (characterp ch) (<= ch 127) (eq (lookup-key fence-mode-map (char-to-string ch)) 'fence-self-insert-command))) (defun its:delete-charp (ch) (and (characterp ch) (<= ch 127) (eq (lookup-key fence-mode-map (char-to-string ch)) 'fence-backward-delete-char))) (defun its:tabp (ch) (and (characterp ch) (<= ch 127) (eq (lookup-key fence-mode-map (char-to-string ch)) 'egg-predict-start-parttime))) (defvar egg:fence-buffer nil "Buffer fence is active in") (defun fence-self-insert-command () (interactive) (if (not (eq (current-buffer) egg:fence-buffer)) nil ;; #### This is to bandaid a deep event-handling bug (let ((ch (event-to-character last-command-event))) (cond((or (not egg:*input-mode*) (null (get-next-map its:*current-map* ch))) (insert ch)) (t (insert ch) (its:translate-region (1- (point)) (point) t)))))) ) (defun its:peek-char () (if (= (point) its:*buff-e*) (if its:*interactive* (setq unread-command-events (list (read-event))) nil) (following-char))) (defun its:read-char () (if (= (point) its:*buff-e*) (progn (setq its:*char-from-buff* nil) (if its:*interactive* (read-char-exclusive) nil)) (let ((ch (following-char))) (setq its:*char-from-buff* t) (delete-char 1) ch))) (defun its:push-char (ch) (if its:*char-from-buff* (save-excursion (its:insert-char ch)) (if ch (setq unread-command-events (list ch))))) (defun its:insert-char (ch) (insert ch)) (defun its:ordinal-charp (ch) (and (numberp ch) (<= 0 ch) (<= ch 127) (eq (lookup-key fence-mode-map (char-to-string ch)) 'fence-self-insert-command))) (defun its:delete-charp (ch) (and (numberp ch) (<= 0 ch) (<= ch 127) (eq (lookup-key fence-mode-map (char-to-string ch)) 'fence-backward-delete-char))) (defun its:tabp (ch) (and (numberp ch) (<= 0 ch) (<= ch 127) (eq (lookup-key fence-mode-map (char-to-string ch)) 'egg-predict-start-parttime))) (defun fence-self-insert-command () (interactive) (cond((or (not egg:*input-mode*) (null (get-next-map its:*current-map* last-command-event))) (insert last-command-event)(beep)) (t (insert last-command-event) (its:translate-region (1- (point)) (point) t)))) ) ;;; ;;; its: completing-read system ;;; (defun its:all-completions (string alist &optional pred) "A variation of all-completions.\n\ Arguments are STRING, ALIST and optional PRED. ALIST must be no obarray." (let ((tail alist) (allmatches nil)) (while tail (let* ((elt (car tail)) (eltstring (car elt))) (setq tail (cdr tail)) (if (and (stringp eltstring) (<= (length string) (length eltstring)) ;;;(not (= (aref eltstring 0) ? )) (string-equal string (substring eltstring 0 (length string)))) (if (or (and pred (if (if (eq pred 'commandp) (commandp elt) (funcall pred elt)))) (null pred)) (setq allmatches (cons elt allmatches)))))) (nreverse allmatches))) (defun its:temp-echo-area-contents (message) (let ((inhibit-quit inhibit-quit) (point-max (point-max))) (goto-char point-max) (insert message) (goto-char point-max) (setq inhibit-quit t) (sit-for 2 nil) ;;; 92.9.19 by Y. Kawabe, 92.10.30 by T.Saneto (delete-region (point) (point-max)) (if quit-flag (progn (setq quit-flag nil) (if (featurep 'xemacs) (setq unread-command-events (list (character-to-event ?\^G))) (setq unread-command-events (list ?\^G))))))) (defun car-string-lessp (item1 item2) (string-lessp (car item1) (car item2))) (defun its:minibuffer-completion-help () "Display a list of possible completions of the current minibuffer contents." (interactive) (let ((completions)) (message "Making completion list...") (setq completions (its:all-completions (buffer-string) minibuffer-completion-table minibuffer-completion-predicate)) (if (null completions) (progn ;;; 92.9.19 by Y. Kawabe (beep) (its:temp-echo-area-contents " [No completions]")) (with-output-to-temp-buffer "*Completions*" (display-completion-list (sort completions 'car-string-lessp)))) nil)) (defconst its:minibuffer-local-completion-map (copy-keymap minibuffer-local-completion-map)) (define-key its:minibuffer-local-completion-map "?" 'its:minibuffer-completion-help) (define-key its:minibuffer-local-completion-map " " 'its:minibuffer-completion-help) (defconst its:minibuffer-local-must-match-map (copy-keymap minibuffer-local-must-match-map)) (define-key its:minibuffer-local-must-match-map "?" 'its:minibuffer-completion-help) (define-key its:minibuffer-local-must-match-map " " 'its:minibuffer-completion-help) (fset 'si:all-completions (symbol-function 'all-completions)) (fset 'si:minibuffer-completion-help (symbol-function 'minibuffer-completion-help)) (defun its:completing-read (prompt table &optional predicate require-match initial-input) "See completing-read" (let ((minibuffer-local-completion-map its:minibuffer-local-completion-map) (minibuffer-local-must-match-map its:minibuffer-local-must-match-map) (completion-auto-help nil)) (completing-read prompt table predicate t initial-input))) (defvar its:*completing-input-menu* '(menu "Which?" nil)) ;92.10.26 by T.Saneto (defun its:completing-input (map) ;;; (let ((action (get-action map))) (cond((and (null action) (= (length (map-alist map)) 1)) (its:completing-input (cdr (nth 0 (map-alist map))))) (t (setcar (nthcdr 2 its:*completing-input-menu*) (map-alist map)) (let ((values (menu:select-from-menu its:*completing-input-menu* 0 t))) (cond((consp values) ;;; get input char from menu ) (t (its:completing-input map)))))))) (defvar its:*make-menu-from-map-result* nil) (defun its:make-menu-from-map (map) (let ((its:*make-menu-from-map-result* nil)) (its:make-menu-from-map* map "") (list 'menu "Which?" (reverse its:*make-menu-from-map-result*) ))) (defun its:make-menu-from-map* (map string) (let ((action (get-action map))) (if action (setq its:*make-menu-from-map-result* (cons (format "%s[%s]" string (action-output action)) its:*make-menu-from-map-result*))) (let ((alist (map-alist map))) (while alist (its:make-menu-from-map* (cdr (car alist)) (concat string (char-to-string (car (car alist))))) (setq alist (cdr alist)))))) (defvar its:*make-alist-from-map-result* nil) (defun its:make-alist-from-map (map &optional string) (let ((its:*make-alist-from-map-result* nil)) (its:make-alist-from-map* map (or string "")) (reverse its:*make-alist-from-map-result*))) (defun its:make-alist-from-map* (map string) (let ((action (get-action map))) (if action (setq its:*make-alist-from-map-result* (cons (list string (let ((action-output (action-output action))) (cond((and (consp action-output) (characterp (car action-output))) (format "%s..." (nth (car action-output) (cdr action-output)))) ((stringp action-output) action-output) (t (format "%s" action-output))))) its:*make-alist-from-map-result*))) (let ((alist (map-alist map))) (while alist (its:make-alist-from-map* (cdr (car alist)) (concat string (char-to-string (car (car alist))))) (setq alist (cdr alist)))))) (defvar its:*select-alternative-output-menu* '(menu "Which?" nil)) (defun its:select-alternative-output (action-output) ;;;; action-output : (pos item1 item2 item3 ....) (let ((point (point)) (output (cdr action-output)) (ch 0)) (while (not (eq ch ?\^L)) (insert "<" (nth (car action-output)output) ">") (setq ch (if (featurep 'xemacs) (egg-read-event) (read-event))) (cond ((eq ch ?\^N) (setcar action-output (mod (1+ (car action-output)) (length output)))) ((eq ch ?\^P) (setcar action-output (if (= 0 (car action-output)) (1- (length output)) (1- (car action-output))))) ((eq ch ?\^M) (setcar (nthcdr 2 its:*select-alternative-output-menu* ) output) (let ((values (menu:select-from-menu its:*select-alternative-output-menu* (car action-output) t))) (cond((consp values) (setcar action-output (nth 1 values)) (setq ch ?\^L))))) ((eq ch ?\^L) ) (t (beep) )) (delete-region point (point))) (if its:*insert-output-string* (funcall its:*insert-output-string* (nth (car action-output) output)) (insert (nth (car action-output) output))))) ;;; translate until ;;; interactive --> not ordinal-charp ;;; or ;;; not interactive --> end of input (defvar its:*insert-output-string* nil) (defvar its:*display-status-string* nil) (defun its:translate-region (start end its:*interactive* &optional topmap) (set-marker its:*buff-s* start) (set-marker its:*buff-e* end) (its:reset-input) (goto-char its:*buff-s*) (let ((topmap (or topmap its:*current-map*)) (map nil) (ch nil) (action nil) (newmap nil) (inhibit-quit t) (its-quit-flag nil) (echo-keystrokes 0)) (setq map topmap) (its:reset-maps topmap) (while (not its-quit-flag) (setq ch (its:read-char)) (when (wnn7-p) ; input efficiency (egg-predict-inc-input-length)) ; key input count (setq newmap (get-next-map map ch)) (setq action (get-action newmap)) (cond ((and its:*interactive* (not its:*char-from-buff*) (characterp ch) (= ch ?\^@)) (delete-region its:*buff-s* (point)) (let ((i 1)) (while (<= i its:*level*) (insert (aref its:*inputs* i)) (setq i (1+ i)))) (let ((inputs (its:completing-read "ITS:>" (its:make-alist-from-map topmap) nil t (buffer-substring its:*buff-s* (point))))) (delete-region its:*buff-s* (point)) (save-excursion (insert inputs)) (its:reset-maps) (setq map topmap) )) ((or (null newmap) (and (map-terminalp newmap) (null action))) (cond((and its:*interactive* (its:delete-charp ch)) (delete-region its:*buff-s* (point)) (cond((= its:*level* 0) (setq its-quit-flag t)) ((= its:*level* 1) (its:insert-char (aref its:*inputs* 1)) (setq its-quit-flag t)) (t (its:flush-input-before-point (1+ its:*level*)) (setq its:*level* (1- its:*level*)) (setq map (its:current-map)) (if (and its:*interactive* its:*display-status-string*) (funcall its:*display-status-string* (map-state map)) (insert (map-state map))) ))) ((and its:*interactive* (its:tabp ch)) ; (setq its-quit-flag t)) ; (t (let ((output nil)) (let ((i its:*level*) (newlevel (1+ its:*level*))) (aset its:*inputs* newlevel ch) (while (and (< 0 i) (null output)) (if (and (aref its:*actions* i) (its:simulate-input (1+ i) newlevel its:*inputs* topmap)) (setq output i)) (setq i (1- i))) (if (null output) (let ((i its:*level*)) (while (and (< 0 i) (null output)) (if (aref its:*actions* i) (setq output i)) (setq i (1- i))))) (cond(output (delete-region its:*buff-s* (point)) (cond((its:standard-actionp (aref its:*actions* output)) (let ((action-output (action-output (aref its:*actions* output)))) (if (and (not its:*interactive*) (consp action-output)) (setq action-output (nth (car action-output) (cdr action-output)))) (cond((stringp action-output) (if (and its:*interactive* its:*insert-output-string*) (funcall its:*insert-output-string* action-output) (insert action-output))) ((consp action-output) (its:select-alternative-output action-output) ) (t (beep) (beep) ))) (set-marker its:*buff-s* (point)) (its:push-char ch) (its:flush-input-before-point (1+ output)) (if (action-next (aref its:*actions* output)) (save-excursion (insert (action-next (aref its:*actions* output))))) ) ((symbolp (aref its:*actions* output)) (its:push-char ch) (funcall (aref its:*actions* output)) (its:reset-maps its:*current-map*) (setq topmap its:*current-map*) (set-marker its:*buff-s* (point))) (t (its:push-char ch) ;92.10.26 by T.Saneto (eval (aref its:*actions* output)) (its:reset-maps its:*current-map*) (setq topmap its:*current-map*) (set-marker its:*buff-s* (point)) )) ) ((= 0 its:*level*) (cond ((or (its:ordinal-charp ch) its:*char-from-buff*) (its:insert-char ch)) (t (setq its-quit-flag t)))) ((< 0 its:*level*) (delete-region its:*buff-s* (point)) (its:insert-char (aref its:*inputs* 1)) (set-marker its:*buff-s* (point)) (its:push-char ch) (its:flush-input-before-point 2))))) (cond((null ch) (setq its-quit-flag t)) ((not its-quit-flag) (its:reset-maps) (set-marker its:*buff-s* (point)) (setq map topmap)))))) ((map-terminalp newmap) (its:enter-newlevel (setq map newmap) ch action) (delete-region its:*buff-s* (point)) (let ((output nil) (m nil) (i (1- its:*level*))) (while (and (< 0 i) (null output)) (if (and (aref its:*actions* i) (setq m (its:simulate-input (1+ i) its:*level* its:*inputs* topmap)) (not (map-terminalp m))) (setq output i)) (setq i (1- i))) (cond((null output) (cond ((its:standard-actionp action) (let ((action-output (action-output action))) (if (and (not its:*interactive*) (consp action-output)) (setq action-output (nth (car action-output) (cdr action-output)))) (cond((stringp action-output) (if (and its:*interactive* its:*insert-output-string*) (funcall its:*insert-output-string* action-output) (insert action-output)) ; (if (and (wnn7-p) (egg-predict-realtime-p)) ; (egg-predict-start-realtime))) ; ((consp action-output) (its:select-alternative-output action-output) ) (t (beep) (beep) ))) (cond((null (action-next action)) (cond ((and (= (point) its:*buff-e*) its:*interactive* (its:delete-charp (its:peek-char))) nil) (t (set-marker its:*buff-s* (point)) (its:reset-maps) (setq map topmap) ))) (t (save-excursion (insert (action-next action))) (set-marker its:*buff-s* (point)) (its:reset-maps) (setq map topmap)))) ((symbolp action) (funcall action) (its:reset-maps its:*current-map*) (setq topmap its:*current-map*) (setq map topmap) (set-marker its:*buff-s* (point))) (t (eval action) (its:reset-maps its:*current-map*) (setq topmap its:*current-map*) (setq map topmap) (set-marker its:*buff-s* (point))))) (t (if (and its:*interactive* its:*display-status-string*) (funcall its:*display-status-string* (map-state map)) (insert (map-state map))))))) ((null action) (delete-region its:*buff-s* (point)) (if (and its:*interactive* its:*display-status-string*) (funcall its:*display-status-string* (map-state newmap)) (insert (map-state newmap))) ; (if (and (wnn7-p) (egg-predict-realtime-p)) ; (egg-predict-start-realtime)) ; (its:enter-newlevel (setq map newmap) ch action)) (t (its:enter-newlevel (setq map newmap) ch action) (delete-region its:*buff-s* (point)) (if (and its:*interactive* its:*display-status-string*) (funcall its:*display-status-string* (map-state map)) (insert (map-state map))) (if (and (wnn7-p) (egg-predict-realtime-p)) ; (egg-predict-start-realtime)) ; ))) (set-marker its:*buff-s* nil) (set-marker its:*buff-e* nil) (if (featurep 'xemacs) (if (and its:*interactive* ch) (setq unread-command-events (list (character-to-event ch)))) (if (and its:*interactive* ch) (setq unread-command-events (list ch)))) )) ;;;---------------------------------------------------------------------- ;;; ;;; ITS-map dump routine: ;;; ;;;---------------------------------------------------------------------- ;;;;; ;;;;; User entry: dump-its-mode-map ;;;;; ;; 92.6.26 by K.Handa (defun dump-its-mode-map (name filename) "Obsolete." (interactive) (message "This function is obsolete in the current version of Mule.")) ;;; ;;; EGG mode variables ;;; (defvar egg:*mode-on* nil "T if egg mode is on.") (make-variable-buffer-local 'egg:*mode-on*) (set-default 'egg:*mode-on* nil) (defvar egg:*input-mode* t "T if egg map is active.") (make-variable-buffer-local 'egg:*input-mode*) (set-default 'egg:*input-mode* t) (defvar egg:*in-fence-mode* nil "T if in fence mode.") (make-variable-buffer-local 'egg:*in-fence-mode*) (set-default 'egg:*in-fence-mode* nil) (defvar its:*current-map* nil) ;;(setq-default its:*current-map* (its:get-mode-map "roma-kana")) (make-variable-buffer-local 'its:*current-map*) (defvar its:*previous-map* nil) (make-variable-buffer-local 'its:*previous-map*) (setq-default its:*previous-map* nil) ;;;---------------------------------------------------------------------- ;;; ;;; Mode line control functions; ;;; ;;;---------------------------------------------------------------------- (defconst mode-line-egg-mode "--") (make-variable-buffer-local 'mode-line-egg-mode) (defvar mode-line-egg-mode-in-minibuffer "--" "global variable") (defun egg:find-symbol-in-tree (item tree) (if (consp tree) (or (egg:find-symbol-in-tree item (car tree)) (egg:find-symbol-in-tree item (cdr tree))) (equal item tree))) ;;; ;;; nemacs Ver. 3.0 $B$G$O(B Fselect_window $B$,JQ99$K$J$j!"(Bminibuffer-window ;;; $BB>$N(B window $B$H$N4V$G=PF~$j$,$"$k$H!"(Bmode-line $B$N99?7$r9T$J$$!"JQ?t(B ;;; minibuffer-window-selected $B$NCM$,99?7$5$l$k(B ;;; ;;; nemacs Ver. 4 $B$G$O(B Fselect_window $B$,JQ99$K$J$j!$(Bselect-window-hook ;;; $B$,Dj5A$5$l$?!%$3$l$K$H$b$J$$=>Mh!$:FDj5A$7$F$$$?(B select-window, ;;; other-window, keyborad-quit, abort-recursive-edit, exit-minibuffer ;;; $B$r:o=|$7$?!%(B (defconst display-minibuffer-mode-in-minibuffer t) (defconst display-minibuffer-mode nil) (defvar minibuffer-preprompt nil) (defvar minibuffer-window-selected nil) (defun egg:select-window-hook (old new) (if (and (eq old (minibuffer-window)) (not (eq new (minibuffer-window)))) (save-excursion (set-buffer (window-buffer (minibuffer-window))) (if (featurep 'xemacs) (set-minibuffer-preprompt nil) (setq minibuffer-preprompt nil)) (setq egg:*mode-on* (default-value 'egg:*mode-on*) egg:*input-mode* (default-value 'egg:*input-mode*) egg:*in-fence-mode* (default-value 'egg:*in-fence-mode*)))) (if (eq new (minibuffer-window)) (setq minibuffer-window-selected t) (setq minibuffer-window-selected nil))) (defun egg:minibuffer-entry-hook () (setq minibuffer-window-selected t)) (defun egg:minibuffer-exit-hook () "Call upon exit from minibuffer" (if (featurep 'xemacs) (set-minibuffer-preprompt nil) (setq minibuffer-preprompt nil)) (setq minibuffer-window-selected nil) (save-excursion (set-buffer (window-buffer (minibuffer-window))) (setq egg:*mode-on* (default-value 'egg:*mode-on*) egg:*input-mode* (default-value 'egg:*input-mode*) egg:*in-fence-mode* (default-value 'egg:*in-fence-mode*)))) ;;; ;;; ;;; (defvar its:*reset-modeline-format* nil) ;;; ;;; minibuffer $B$G$N%b!<%II=<($r$9$k$?$a$K(B nemacs 4 $B$GDj5A$5$l$?(B ;;; minibuffer-preprompt $B$rMxMQ$9$k!%(B ;;; (defconst egg:minibuffer-preprompt '("[" nil "]")) (defvar egg-yosoku-mode nil "$BF~NOM=B,%b!<%I(B") (defun mode-line-egg-mode-update (str) (if (and (wnn7-p) egg-yosoku-mode egg:*mode-on* egg:*input-mode*) (setq str (concat str "$BM=(B"))) (if (eq (current-buffer) (window-buffer (minibuffer-window))) (if display-minibuffer-mode-in-minibuffer (progn (aset (nth 0 egg:minibuffer-preprompt) 0 (if its:*previous-map* ?\< ?\[)) (setcar (nthcdr 1 egg:minibuffer-preprompt) str) (aset (nth 2 egg:minibuffer-preprompt) 0 (if its:*previous-map* ?\> ?\])) (if (featurep 'xemacs) (set-minibuffer-preprompt (concat (car egg:minibuffer-preprompt) (car (nthcdr 1 egg:minibuffer-preprompt)) (car (nthcdr 2 egg:minibuffer-preprompt)))) (setq minibuffer-preprompt egg:minibuffer-preprompt))) (setq display-minibuffer-mode t mode-line-egg-mode-in-minibuffer str)) (setq display-minibuffer-mode nil mode-line-egg-mode str)) (if (featurep 'xemacs) (redraw-modeline t) ;; nemacs 4 only(update-mode-lines) (set-buffer-modified-p (buffer-modified-p)))) ;;(mode-line-egg-mode-update mode-line-egg-mode) ;;; ;;; egg mode line display ;;; (defvar alphabet-mode-indicator "aA") (defvar transparent-mode-indicator "--") (defun egg:mode-line-display () (mode-line-egg-mode-update (cond((and egg:*in-fence-mode* (not egg:*input-mode*)) alphabet-mode-indicator) ((and egg:*mode-on* egg:*input-mode*) (map-indicator its:*current-map*)) (t transparent-mode-indicator)))) (defun egg:toggle-egg-mode-on-off () (interactive) (setq egg:*mode-on* (not egg:*mode-on*)) (egg:mode-line-display)) (defun its:select-mode (name) (interactive (list (completing-read "ITS mode: " its:*mode-alist*))) (if (its:get-mode-map name) (progn (setq its:*current-map* (its:get-mode-map name)) (egg:mode-line-display)) (beep))) (defvar its:*select-mode-menu* '(menu "Mode:" nil)) (defun its:select-mode-from-menu () (interactive) (setcar (nthcdr 2 its:*select-mode-menu*) its:*mode-alist*) (setq its:*current-map* (menu:select-from-menu its:*select-mode-menu*)) (egg:mode-line-display)) (defvar its:*standard-modes* nil) ;; (list (its:get-mode-map "roma-kana") ;; (its:get-mode-map "roma-kata") ;; (its:get-mode-map "downcase") ;; (its:get-mode-map "upcase") ;; (its:get-mode-map "zenkaku-downcase") ;; (its:get-mode-map "zenkaku-upcase")) ;; "List of standard mode-map of EGG.") (defun its:find (map list) (let ((n 0)) (while (and list (not (eq map (car list)))) (setq list (cdr list) n (1+ n))) (if list n nil))) (defun its:next-mode () (interactive) (let ((pos (its:find its:*current-map* its:*standard-modes*))) (setq its:*current-map* (nth (% (1+ pos) (length its:*standard-modes*)) its:*standard-modes*)) (egg:mode-line-display))) (defun its:previous-mode () (interactive) (let ((pos (its:find its:*current-map* its:*standard-modes*))) (setq its:*current-map* (nth (1- (if (= pos 0) (length its:*standard-modes*) pos)) its:*standard-modes*)) (egg:mode-line-display))) (defun its:select-hiragana () (interactive) (its:select-mode "roma-kana")) (defun its:select-katakana () (interactive) (its:select-mode "roma-kata")) (defun its:select-downcase () (interactive) (its:select-mode "downcase")) (defun its:select-upcase () (interactive) (its:select-mode "upcase")) (defun its:select-zenkaku-downcase () (interactive) (its:select-mode "zenkaku-downcase")) (defun its:select-zenkaku-upcase () (interactive) (its:select-mode "zenkaku-upcase")) (defun its:select-mode-temporally (name) (interactive (list (completing-read "ITS mode: " its:*mode-alist*))) (let ((map (its:get-mode-map name))) (if map (progn (if (null its:*previous-map*) (setq its:*previous-map* its:*current-map*)) (setq its:*current-map* map) (egg:mode-line-display)) (beep)))) (defun its:select-previous-mode () (interactive) (if (null its:*previous-map*) (beep) (setq its:*current-map* its:*previous-map* its:*previous-map* nil) (egg:mode-line-display))) (defun toggle-egg-mode () (interactive) (if egg:*mode-on* (fence-toggle-egg-mode) (progn (setq egg:*mode-on* t) (egg:mode-line-display)))) (defun fence-toggle-egg-mode () (interactive) (if its:*current-map* (progn (setq egg:*input-mode* (not egg:*input-mode*)) (egg:mode-line-display)) (beep))) ;;; ;;; Changes on Global map ;;; (defvar si:*global-map* (copy-keymap global-map)) (substitute-key-definition 'self-insert-command 'egg-self-insert-command global-map) ;; $BF~NOM=B,D>A0EPO?:o=|MQ$NBP1~(B (substitute-key-definition 'delete-backward-char 'egg-delete-backward-char global-map) (substitute-key-definition 'backward-delete-char-untabify 'egg-backward-delete-char-untabify global-map) (if (featurep 'xemacs) ;; wire us into pending-delete (put 'egg-self-insert-command 'pending-delete t)) ;;; ;;; Currently entries C-\ and C-^ at global-map are undefined. ;;; ;; Make this no-op if LEIM interface is used. (cond ((featurep 'wnn7egg-leim) t) (t (define-key global-map "\C-\\" 'toggle-egg-mode)) ) ;; #### Should hide bindings like this, too? However, `convert-region' ;; probably isn't going to be a LEIM feature, it's really pretty ;; Japanese and Korean specific. (define-key global-map "\C-x " 'wnn7-henkan-region) ;; 92.3.16 by K.Handa ;; global-map => mule-keymap (define-key mule-keymap "m" 'its:select-mode-from-menu) (define-key mule-keymap ">" 'its:next-mode) (define-key mule-keymap "<" 'its:previous-mode) (define-key mule-keymap "h" 'its:select-hiragana) (define-key mule-keymap "k" 'its:select-katakana) (define-key mule-keymap "q" 'its:select-downcase) (define-key mule-keymap "Q" 'its:select-upcase) (define-key mule-keymap "z" 'its:select-zenkaku-downcase) (define-key mule-keymap "Z" 'its:select-zenkaku-upcase) ;;; ;;; auto fill controll ;;; (defun egg:do-auto-fill () (if (and auto-fill-function (not buffer-read-only) (> (current-column) fill-column)) (let ((ocolumn (current-column))) (funcall auto-fill-function) (while (and (< fill-column (current-column)) (< (current-column) ocolumn)) (setq ocolumn (current-column)) (funcall auto-fill-function))))) ;;;---------------------------------------------------------------------- ;;; ;;; Egg fence mode ;;; ;;;---------------------------------------------------------------------- (defvar egg:*fence-open* "|" "*$B%U%'%s%9$N;OE@$r<($9J8;zNs(B") (defvar egg:*fence-close* "|" "*$B%U%'%s%9$N=*E@$r<($9J8;zNs(B") (defvar egg:*fence-face* nil "*$B%U%'%s%9I=<($KMQ$$$k(B face $B$^$?$O(B nil") (if (featurep 'xemacs) (make-variable-buffer-local (defvar egg:*fence-extent* nil "$B%U%'%s%9I=<(MQ(B extent")) (make-variable-buffer-local (defvar egg:*fence-overlay* nil "$B%U%'%s%9I=<(MQ(B overlay"))) (defvar egg:*face-alist* '(("nil" . nil) ("highlight" . highlight) ("modeline" . modeline) ("inverse" . modeline) ("underline" . underline) ("bold" . bold) ("region" . region))) (defun set-egg-fence-mode-format (open close &optional face) "fence mode $B$NI=<(J}K!$r@_Dj$9$k!#(BOPEN $B$O%U%'%s%9$N;OE@$r<($9J8;zNs$^$?$O(B nil$B!#(B\n\ CLOSE$B$O%U%'%s%9$N=*E@$r<($9J8;zNs$^$?$O(B nil$B!#(B\n\ $BBh(B3$B0z?t(B FACE $B$,;XDj$5$l$F(B nil $B$G$J$1$l$P!"%U%'%s%96h4V$NI=<($K$=$l$r;H$&!#(B" (interactive (list (read-string "$B%U%'%s%93+;OJ8;zNs(B: ") (read-string "$B%U%'%s%9=*N;J8;zNs(B: ") (cdr (assoc (completing-read "$B%U%'%s%9I=<(B0@-(B: " egg:*face-alist*) egg:*face-alist*)))) (if (and (or (stringp open) (null open)) (or (stringp close) (null close)) (or (null face) (memq face (face-list)))) (progn (setq egg:*fence-open* (or open "") egg:*fence-close* (or close "") egg:*fence-face* face) (if (featurep 'xemacs) (if (extentp egg:*fence-extent*) (set-extent-property egg:*fence-extent* 'face egg:*fence-face*)) (if (overlayp egg:*fence-overlay*) (overlay-put egg:*fence-overlay* 'face egg:*fence-face*))) t) (error "Wrong type of argument: %s %s %s" open close face))) (defvar egg:*region-start* nil) (make-variable-buffer-local 'egg:*region-start*) (set-default 'egg:*region-start* nil) (defvar egg:*region-end* nil) (make-variable-buffer-local 'egg:*region-end*) (set-default 'egg:*region-end* nil) ;;(defvar egg:*global-map-backup* nil) ;;(defvar egg:*local-map-backup* nil) ;;; Moved to kanji.el ;;; (defvar self-insert-after-hook nil ;;; "Hook to run when extended self insertion command exits. Should take ;;; two arguments START and END correspoding to character position.") (defvar self-insert-after-hook nil "Hook to run when extended self insertion command exits. Should take two arguments START and END correspoding to character position.") (defvar egg:*self-insert-non-undo-count* 0 "counter to hold repetition of egg-self-insert-command.") (defvar egg-insert-after-hook nil) (make-variable-buffer-local 'egg-insert-after-hook) (defun egg:cancel-undo-boundary () "Cancel undo boundary for egg-self-insert-command" (if (eq last-command 'egg-self-insert-command) (if (and (consp buffer-undo-list) ;; if car is nil. (null (car buffer-undo-list)) (< egg:*self-insert-non-undo-count* 20)) ;; treat consecutive 20 self-insert commands as a single undo chunk. ;; `20' is a magic number copied from keyboard.c (setq buffer-undo-list (cdr buffer-undo-list) egg:*self-insert-non-undo-count* (1+ egg:*self-insert-non-undo-count*)) (setq egg:*self-insert-non-undo-count* 1)))) (if (featurep 'xemacs) (defun egg-self-insert-command (arg) (interactive "p") (if (and (not buffer-read-only) egg:*mode-on* egg:*input-mode* (not egg:*in-fence-mode*) ;;; inhibit recursive fence mode (not (= (event-to-character last-command-event) ? ))) (progn (if (wnn7-p); $BM=B,D>A0EPO?:o=|(B & $BM=B,A08e>pJs%/%j%"(B (egg-predict-check-reset-connective)) (egg:enter-fence-mode-and-self-insert)) (progn ;; treat continuous 20 self insert as a single undo chunk. ;; `20' is a magic number copied from keyboard.c (if (or ;92.12.20 by T.Enami (not (eq last-command 'egg-self-insert-command)) (>= egg:*self-insert-non-undo-count* 20)) (setq egg:*self-insert-non-undo-count* 1) (cancel-undo-boundary) (setq egg:*self-insert-non-undo-count* (1+ egg:*self-insert-non-undo-count*))) (self-insert-command arg) (if egg-insert-after-hook (run-hooks 'egg-insert-after-hook)) (if self-insert-after-hook (if (<= 1 arg) (funcall self-insert-after-hook (- (point) arg) (point))) (if (= (event-to-character last-command-event) ? ) (egg:do-auto-fill)))))) (defun egg-self-insert-command (arg) (interactive "p") (if (and (not buffer-read-only) egg:*mode-on* egg:*input-mode* (not egg:*in-fence-mode*) ;;; inhibit recursive fence mode (not (= last-command-event ? ))) (progn (if (wnn7-p); $BM=B,D>A0EPO?:o=|(B & $BM=B,A08e>pJs%/%j%"(B (egg-predict-check-reset-connective)) (egg:enter-fence-mode-and-self-insert)) (progn (if (and (eq last-command 'egg-self-insert-command) (> last-command-char ? )) (egg:cancel-undo-boundary)) (self-insert-command arg) (if egg-insert-after-hook (run-hooks 'egg-insert-after-hook)) (if self-insert-after-hook (if (<= 1 arg) (funcall self-insert-after-hook (- (point) arg) (point))) (if (= last-command-event ? ) (egg:do-auto-fill))))))) ;; ;; $BA03NDjJQ49=hM}4X?t(B ;; (defvar egg:*fence-open-backup* nil) (defvar egg:*fence-close-backup* nil) (defvar egg:*fence-face-backup* nil) (defconst egg:*fence-open-in-cont* "+" "*$BA03NDj>uBV$G$N(B *fence-open*") (defconst egg:*fence-close-in-cont* t "*$BA03NDj>uBV$G$N(B *fence-close*") (defconst egg:*fence-face-in-cont* t "*$BA03NDj>uBV$G$N(B *fence-face*") (defun set-egg-fence-mode-format-in-cont (open close face) "$BA03NDj>uBV$G$N(B fence mode $B$NI=<(J}K!$r@_Dj$9$k!#(BOPEN $B$O%U%'%s%9$N;OE@$r<($9J8(B $B;zNs!"(Bt $B$^$?$O(B nil$B!#(B\n\ CLOSE$B$O%U%'%s%9$N=*E@$r<($9J8;zNs!"(Bt $B$^$?$O(B nil$B!#(B\n\ FACE $B$O(B nil $B$G$J$1$l$P!"%U%'%s%96h4V$NI=<($K$=$l$r;H$&!#(B\n\ $B$=$l$>$l$NCM$,(B t $B$N>l9g!"DL>o$N(B egg:*fence-open* $BEy$NCM$r0z$-7Q$0!#(B" (interactive (list (read-string "$B%U%'%s%93+;OJ8;zNs(B: ") (read-string "$B%U%'%s%9=*N;J8;zNs(B: ") (cdr (assoc (completing-read "$B%U%'%s%9I=<(B0@-(B: " egg:*face -alist*) egg:*face-alist*)))) (if (and (or (stringp open) (eq open t) (null open)) (or (stringp close) (eq close t) (null close)) (or (null face) (eq face t) (memq face (face-list)))) (progn (setq egg:*fence-open-in-cont* (or open "") egg:*fence-close-in-cont* (or close "") egg:*fence-face-in-cont* face) (if (featurep 'xemacs) (if (extentp egg:*fence-extent*) (set-extent-property egg:*fence-extent* 'face egg:*fence-face*)) (if (overlayp egg:*fence-overlay*) (overlay-put egg:*fence-overlay* 'face egg:*fence-face*))) t) (error "Wrong type of argument: %s %s %s" open close face))) (defvar *in-cont-flag* nil "$BD>A0$KJQ49$7$?D>8e$NF~NO$+$I$&$+$r<($9!#(B") (defvar *in-cont-backup-flag* nil) (defun egg:check-fence-in-cont () (if *in-cont-flag* (progn (setq *in-cont-backup-flag* t) (setq egg:*fence-open-backup* egg:*fence-open*) (setq egg:*fence-close-backup* egg:*fence-close*) (setq egg:*fence-face-backup* egg:*fence-face*) (or (eq egg:*fence-open-in-cont* t) (setq egg:*fence-open* egg:*fence-open-in-cont*)) (or (eq egg:*fence-close-in-cont* t) (setq egg:*fence-close* egg:*fence-close-in-cont*)) (or (eq egg:*fence-face-in-cont* t) (setq egg:*fence-face* egg:*fence-face-in-cont*))))) (defun egg:restore-fence-in-cont () "Restore egg:*fence-open* and egg:*fence-close*" (if *in-cont-backup-flag* (progn (setq egg:*fence-open* egg:*fence-open-backup*) (setq egg:*fence-close* egg:*fence-close-backup*) (setq egg:*fence-face* egg:*fence-face-backup*))) (setq *in-cont-backup-flag* nil) ) (defun egg:enter-fence-mode-and-self-insert () (if (wnn7-p) (setq *in-cont-flag* (memq last-command '(wnn7-henkan-kakutei wnn7-henkan-kakutei-and-self-insert))) (setq *in-cont-flag* (memq last-command '(henkan-kakutei henkan-kakutei-and-self-insert)))) (enter-fence-mode) (setq unread-command-events (list last-command-event))) (defun egg:fence-face-on () (if egg:*fence-face* (if (featurep 'xemacs) (progn (if (extentp egg:*fence-extent*) (set-extent-endpoints egg:*fence-extent* egg:*region-start* egg:*region-end*) (setq egg:*fence-extent* (make-extent egg:*region-start* egg:*region-end*)) (set-extent-property egg:*fence-extent* 'start-open nil) (set-extent-property egg:*fence-extent* 'end-open nil) (set-extent-property egg:*fence-extent* 'detachable nil)) (set-extent-face egg:*fence-extent* egg:*fence-face*)) (progn (or (overlayp egg:*fence-overlay*) (setq egg:*fence-overlay* (make-overlay 1 1 nil nil t))) (if egg:*fence-face* (or (eq egg:*fence-face* (overlay-get egg:*fence-overlay* 'face)) (overlay-put egg:*fence-overlay* 'face egg:*fence-face*))) (move-overlay egg:*fence-overlay* egg:*region-start* egg:*region-end*))))) (defun egg:fence-face-off () (if (featurep 'xemacs) (and egg:*fence-face* (extentp egg:*fence-extent*) (detach-extent egg:*fence-extent*)) (and egg:*fence-face* (overlayp egg:*fence-overlay*) (delete-overlay egg:*fence-overlay*)))) (defun enter-fence-mode () ;;;(buffer-flush-undo (current-buffer)) (suspend-undo) ;;;(and (boundp 'disable-undo) (setq disable-undo t)) (if (featurep 'xemacs) (setq egg:*in-fence-mode* t egg:fence-buffer (current-buffer)) (setq egg:*in-fence-mode* t)) (when (wnn7-p) ; input efficiency (egg-predict-check-start-time) (egg-predict-check-start-input)) (egg:mode-line-display) (egg:check-fence-in-cont) ; for Wnn6 (insert egg:*fence-open*) (or (markerp egg:*region-start*) (setq egg:*region-start* (make-marker))) (set-marker egg:*region-start* (point)) (insert egg:*fence-close*) (or (markerp egg:*region-end*) (set-marker-insertion-type (setq egg:*region-end* (make-marker)) t)) (set-marker egg:*region-end* egg:*region-start*) (egg:fence-face-on) (goto-char egg:*region-start*) ) (defun henkan-fence-region-or-single-space () (interactive) (if egg:*input-mode* (henkan-fence-region) (insert ? ))) (defvar egg:*henkan-fence-mode* nil) (defun henkan-fence-region () (interactive) (setq egg:*henkan-fence-mode* t) (egg:fence-face-off) (if (wnn7-p) (progn (when egg-predict-status (egg-predict-clear)) (wnn7-henkan-region-internal egg:*region-start* egg:*region-end* )) (henkan-region-internal egg:*region-start* egg:*region-end* ))) (defun fence-katakana () (interactive) (japanese-katakana-region egg:*region-start* egg:*region-end*)) (defun fence-hiragana () (interactive) (japanese-hiragana-region egg:*region-start* egg:*region-end*)) (defun fence-hankaku () (interactive) (japanese-hankaku-region egg:*region-start* egg:*region-end* 'ascii-only)) (defun fence-zenkaku () (interactive) (japanese-zenkaku-region egg:*region-start* egg:*region-end*)) (defun fence-backward-char () (interactive) (if (< egg:*region-start* (point)) (backward-char) (beep))) (defun fence-forward-char () (interactive) (if (< (point) egg:*region-end*) (forward-char) (beep))) (defun fence-beginning-of-line () (interactive) (goto-char egg:*region-start*)) (defun fence-end-of-line () (interactive) (goto-char egg:*region-end*)) (defun fence-transpose-chars (arg) (interactive "P") (if (and (< egg:*region-start* (point)) (< (point) egg:*region-end*)) (transpose-chars arg) (beep))) (defun egg:exit-if-empty-region () (if (= egg:*region-start* egg:*region-end*) (fence-exit-mode))) (defun fence-delete-char () (interactive) (if (< (point) egg:*region-end*) (progn (delete-char 1) (egg:exit-if-empty-region)) (beep))) (defun fence-backward-delete-char () (interactive) (if (< egg:*region-start* (point)) (progn (delete-char -1) (if (and (wnn7-p) (egg-predict-realtime-p)) (egg-predict-start-realtime)) (egg:exit-if-empty-region)) (beep))) (defun fence-kill-line () (interactive) (delete-region (point) egg:*region-end*) (egg:exit-if-empty-region)) (defun fence-exit-mode () (interactive) ;; "aA" $B$N>uBV$+$i(B "--" $B$N>uBV$KLa$k$H!J(Bfence-toggle-egg-mode $B$,9T$o$l$F(B ;; transparent-mode $B$KLa$k$H!K(Binput-method $B$N(B status $B$HL7=b$7$F$7$^$&!#(B ;; $B$=$3$G!"(Balphabet-mode $B$N8e$O!"(Btransparent-mode $B$KLa$i$J$$$h$&$K(B ;; input-mode $B%U%i%0$rLa$9(B (if (equal mode-line-egg-mode "aA") (setq egg:*input-mode* t)) (egg:fence-face-off) (setq egg:*in-fence-mode* nil) (let ((kakutei-string (buffer-substring egg:*region-start* egg:*region-end*))) (delete-region (- egg:*region-start* (length egg:*fence-open*)) egg:*region-start*) (delete-region egg:*region-start* egg:*region-end*) (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*fence-close*))) (goto-char egg:*region-start*) (when (wnn7-p) (egg-predict-clear)) (resume-undo-list) (insert kakutei-string) (when (wnn7-p) (if (> (length kakutei-string) 0) (progn (egg-predict-inc-kakutei-length) ;;; (egg-predict-toroku kakutei-string))))) (if its:*previous-map* (setq its:*current-map* its:*previous-map* its:*previous-map* nil)) (egg:quit-egg-mode)) (if (not (featurep 'xemacs)) (defun delete-text-in-column (from to) "Delete the text between column FROM and TO (exclusive) of the current line. Nil of FORM or TO means the current column. If there's a charcter across the borders, the character is replaced with the same width of spaces before deleting." (save-excursion (let (p1 p2) (if from (progn (setq p1 (move-to-column from)) (if (> p1 from) (progn (delete-char -1) (insert-char ? (- p1 (current-column))) (forward-char (- from p1)))))) (setq p1 (point)) (if to (progn (setq p2 (move-to-column to)) (if (> p2 to) (progn (delete-char -1) (insert-char ? (- p2 (current-column))) (forward-char (- to p2)))))) (setq p2 (point)) (delete-region p1 p2))))) (defvar egg-exit-hook nil "Hook to run when egg exits. Should take two arguments START and END correspoding to character position.") (defun egg:quit-egg-mode () (egg:mode-line-display) (if overwrite-mode (let ((str (buffer-substring egg:*region-end* egg:*region-start*))) (delete-text-in-column nil (+ (current-column) (string-width str))))) (egg:restore-fence-in-cont) ; for Wnn6 (setq egg:*henkan-fence-mode* nil) (if self-insert-after-hook (funcall self-insert-after-hook egg:*region-start* egg:*region-end*) (if egg-exit-hook (funcall egg-exit-hook egg:*region-start* egg:*region-end*) (if (not (= egg:*region-start* egg:*region-end*)) (egg:do-auto-fill)))) (set-marker egg:*region-start* nil) (set-marker egg:*region-end* nil) (when (wnn7-p) (egg-predict-check-end)) (if egg-insert-after-hook (run-hooks 'egg-insert-after-hook)) ) (defun fence-cancel-input () (interactive) (delete-region egg:*region-start* egg:*region-end*) (fence-exit-mode)) (defun egg-lang-switch-callback () "Do whatever processing is necessary when the language-environment changes." (if egg:*in-fence-mode* (progn (its:reset-input) (fence-kill-operation))) ;; (let ((func (get current-language-environment 'set-egg-environ))) ;; (if (not (null func)) ;; (funcall func))) (egg:mode-line-display)) (if (featurep 'xemacs) (defun fence-mode-help-command () "Display fence mode help" (interactive "_") (let ((w (selected-window))) (describe-function 'wnn7-egg-mode) (ding) (select-window w))) (defun fence-mode-help-command () "Display fence mode help" (interactive) (let ((w (selected-window))) (describe-function 'wnn7-egg-mode) (ding) (select-window w)))) (if (featurep 'xemacs) (defvar fence-mode-map (make-sparse-keymap)) (defvar fence-mode-map (append '(keymap (t . undefined) (?\C-x keymap (t . undefined))) function-key-map)) (defvar fence-mode-esc-map nil) (define-prefix-command 'fence-mode-esc-map) (define-key fence-mode-map "\e" fence-mode-esc-map) (define-key fence-mode-map [escape] fence-mode-esc-map) (define-key fence-mode-esc-map [t] 'undefined)) (substitute-key-definition 'egg-self-insert-command 'fence-self-insert-command fence-mode-map global-map) (if (featurep 'xemacs) (set-keymap-default-binding fence-mode-map 'undefined)) (define-key fence-mode-map "\eh" 'fence-hiragana) (define-key fence-mode-map "\ek" 'fence-katakana) (define-key fence-mode-map "\e<" 'fence-hankaku) (define-key fence-mode-map "\e>" 'fence-zenkaku) (define-key fence-mode-map "\e\C-h" 'its:select-hiragana) (define-key fence-mode-map "\e\C-k" 'its:select-katakana) (define-key fence-mode-map "\eq" 'its:select-downcase) (define-key fence-mode-map "\eQ" 'its:select-upcase) (define-key fence-mode-map "\ez" 'its:select-zenkaku-downcase) (define-key fence-mode-map "\eZ" 'its:select-zenkaku-upcase) (define-key fence-mode-map " " 'henkan-fence-region-or-single-space) (define-key fence-mode-map "\C-@" 'henkan-fence-region) ;;(define-key fence-mode-map [(control \ )] 'henkan-fence-region) (define-key fence-mode-map "\C-\ " 'henkan-fence-region) (define-key fence-mode-map "\C-a" 'fence-beginning-of-line) (define-key fence-mode-map "\C-b" 'fence-backward-char) (define-key fence-mode-map "\C-c" 'fence-cancel-input) (define-key fence-mode-map "\C-d" 'fence-delete-char) (define-key fence-mode-map "\C-e" 'fence-end-of-line) (define-key fence-mode-map "\C-f" 'fence-forward-char) (define-key fence-mode-map "\C-g" 'fence-cancel-input) (define-key fence-mode-map "\C-h" 'fence-mode-help-command) (define-key fence-mode-map "\C-i" 'egg-predict-start-parttime); for wnn7 (define-key fence-mode-map "\C-k" 'fence-kill-line) (define-key fence-mode-map "\C-l" 'fence-exit-mode) (define-key fence-mode-map "\C-m" 'fence-exit-mode) ;;; RET (define-key fence-mode-map "\C-q" 'its:select-previous-mode) (define-key fence-mode-map "\C-t" 'fence-transpose-chars) (define-key fence-mode-map "\C-w" 'henkan-fence-region) (define-key fence-mode-map "\C-z" 'eval-expression) (define-key fence-mode-map "\C-\\" 'fence-toggle-egg-mode) (define-key fence-mode-map "\C-_" 'jis-code-input) (define-key fence-mode-map "\177" 'fence-backward-delete-char) (define-key fence-mode-map [backspace] 'fence-backward-delete-char) (define-key fence-mode-map [clear] 'fence-cancel-input) (define-key fence-mode-map [delete] 'fence-backward-delete-char) (define-key fence-mode-map [help] 'fence-mode-help-command) (when (featurep 'xemacs) (define-key fence-mode-map [kp-enter] 'fence-exit-mode) (define-key fence-mode-map [kp-left] 'fence-backward-char) (define-key fence-mode-map [kp-right] 'fence-forward-char)) (define-key fence-mode-map [left] 'fence-backward-char) (define-key fence-mode-map [return] 'fence-exit-mode) (define-key fence-mode-map [right] 'fence-forward-char) (unless (assq 'egg:*in-fence-mode* minor-mode-map-alist) (setq minor-mode-map-alist (cons (cons 'egg:*in-fence-mode* fence-mode-map) minor-mode-map-alist))) ;;;---------------------------------------------------------------------- ;;; ;;; Read hiragana from minibuffer ;;; ;;;---------------------------------------------------------------------- (defvar egg:*minibuffer-local-hiragana-map* (copy-keymap minibuffer-local-map)) (substitute-key-definition 'egg-self-insert-command 'fence-self-insert-command egg:*minibuffer-local-hiragana-map* global-map) (defun read-hiragana-string (prompt &optional initial-input) (save-excursion (let ((minibuff (window-buffer (minibuffer-window)))) (set-buffer minibuff) (setq egg:*input-mode* t egg:*mode-on* t its:*current-map* (its:get-mode-map "roma-kana")) (mode-line-egg-mode-update (its:get-mode-indicator its:*current-map*)))) (read-from-minibuffer prompt initial-input egg:*minibuffer-local-hiragana-map*)) (defun read-kanji-string (prompt &optional initial-input) (save-excursion (let ((minibuff (window-buffer (minibuffer-window)))) (set-buffer minibuff) (setq egg:*input-mode* t egg:*mode-on* t its:*current-map* (its:get-mode-map "roma-kana")) (mode-line-egg-mode-update (its:get-mode-indicator "roma-kana")))) (read-from-minibuffer prompt initial-input)) (defconst isearch:read-kanji-string 'read-kanji-string) ;;; $B5-9fF~NO(B (defvar special-symbol-input-point nil) (defun special-symbol-input () (interactive) (require 'wnn7egg-jsymbol) ;; 92.7.8 by Y.Kawabe (let ((item (menu:select-from-menu *symbol-input-menu* special-symbol-input-point t)) (code t)) (and (listp item) (setq code (car item) special-symbol-input-point (cdr item))) ;; end of patch (cond((stringp code) (insert code)) ((consp code) (eval code)) ))) ;;(autoload 'busyu-input "busyu" nil t) ;92.10.18 by K.Handa ;;(autoload 'kakusuu-input "busyu" nil t) ;92.10.18 by K.Handa (its-autoload-mode-map "roma-kana" "its-v309/hira.el") (its-autoload-mode-map "roma-kata" "its-v309/kata.el") (its-autoload-mode-map "downcase" "its-v309/hankaku.el") (its-autoload-mode-map "upcase" "its-v309/hankaku.el") (its-autoload-mode-map "zenkaku-downcase" "its-v309/zenkaku.el") (its-autoload-mode-map "zenkaku-upcase" "its-v309/zenkaku.el") (setq-default its:*current-map* (its:get-mode-map "roma-kana")) (setq its:*standard-modes* (append (list (its:get-mode-map "roma-kana") (its:get-mode-map "roma-kata") (its:get-mode-map "downcase") (its:get-mode-map "upcase") (its:get-mode-map "zenkaku-downcase") (its:get-mode-map "zenkaku-upcase")) its:*standard-modes*)) (defun wnn7-egg-mode () "Install and start the egg input method. The keys that are defined for the fence mode (which is the translation part of egg) are:\\{fence-mode-map}" (interactive) (define-key global-map "\C-^" 'special-symbol-input) (let ((newmodeline (list 'display-minibuffer-mode-in-minibuffer ;; minibuffer mode in minibuffer (list (list 'its:*previous-map* "<" "[") 'mode-line-egg-mode (list 'its:*previous-map* ">" "]") ) ;; minibuffer mode in mode line (list (list 'minibuffer-window-selected (list 'display-minibuffer-mode "m" " ") " ") (list 'its:*previous-map* "<" "[") (list 'minibuffer-window-selected (list 'display-minibuffer-mode 'mode-line-egg-mode-in-minibuffer 'mode-line-egg-mode) 'mode-line-egg-mode) (list 'its:*previous-map* ">" "]") )))) (if (featurep 'xemacs) (if (not (egg:find-symbol-in-tree 'mode-line-egg-mode modeline-format)) (setq-default modeline-format (cons newmodeline modeline-format))) (if (not (egg:find-symbol-in-tree 'mode-line-egg-mode mode-line-format)) (setq-default mode-line-format (cons newmodeline mode-line-format)))) (if (featurep 'xemacs) (progn ;; put us into the modeline of all existing buffers (mapc (lambda (buf) (save-excursion (set-buffer buf) (if (not (egg:find-symbol-in-tree 'mode-line-egg-mode modeline-format)) (setq modeline-format (cons newmodeline modeline-format))))) (buffer-list))))) (if (boundp 'select-window-hook) (add-hook 'select-window-hook 'egg:select-window-hook) (add-hook 'minibuffer-exit-hook 'egg:minibuffer-exit-hook) (add-hook 'minibuffer-entry-hook 'egg:minibuffer-entry-hook)) (mode-line-egg-mode-update mode-line-egg-mode) (if its:*reset-modeline-format* (if (featurep 'xemacs) (setq-default modeline-format (cdr modeline-format)) (setq-default mode-line-format (cdr mode-line-format)))) ;; if set-lang-environment has already been called, ;; call egg-lang-switch-callback (if (not (null current-language-environment)) (egg-lang-switch-callback)) ) ;;(defun wnn7-p () ;; (if current-input-method ;; (string-match "japanese-egg-wnn7" current-input-method))) (provide 'wnn7egg) ;;; wnn7egg.el ends here wnn7egg-1.02.orig/elisp/xemacs21/wnn7egg-comx214.el0100644000764400003210000003071707474174160022005 0ustar ishikawaishikawa;; Wnn7Egg is Egg modified for Wnn7, and the current maintainer ;; is OMRON SOFTWARE Co., Ltd. ;; ;; This file is part of Wnn7Egg. (base code is egg-com.el (eggV4)) ;; ;;; ------------------------------------------------------------------ ;;; ;;; Wnn7Egg (Wnn "なな"たまご)--- Wnn7 Emacs Client ;;; ;;; Wnn7Egg は、「たまご第3版」v3.09 をベースに 「たまご第4版」の通信、 ;;; ライブラリ部を組み込んだ、Wnn7 の為の専用クライアントです。 ;;; ;;; すべてのソースが Emacs Lisp で記述されているので、Wnn SDK/Library を必要 ;;; とせず、GNU Emacs 及び XEmacs 環境で使用することができます。使用許諾条件 ;;; は GPL です。 ;;; ;;; GNU Emacs 20.3 以降、XEmacs 21.x 以降で動作確認しています。 ;;; ;;; ;;; Wnn7Egg は Wnn7 の機能である楽々入力(入力予測)、連想変換をサポート ;;; しています。 ;;; ;;; 「たまご」と独立/共存できるように、影響する主要な関数/変数名を ;;; "wnn7..." という形に変更しています。 ;;; ;;; ------------------------------------------------------------------ ;;; egg-com.el --- Communication Routines in Egg Input Method Architecture ;; Copyright (C) 1999, 2000 Free Software Foundation, Inc ;; Author: Hisashi Miyashita ;; NIIBE Yutaka ;; KATAYAMA Yoshio ; Korean, Chinese support. ;; Maintainer: TOMURA Satoru ;; Keywords: mule, multilingual, input method ;; This file is part of EGG. ;; EGG is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; EGG is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;;; 2002/5/16 XEmacsにおいてユーザ辞書のクライアント転送ができない問題の対応 ;;; Code: (require 'wnn7egg-edep) ;;(require 'wnn7egg-cnv) (defvar egg-fixed-euc '(fixed-euc-jp)) (make-variable-buffer-local 'egg-fixed-euc) (put 'egg-fixed-euc 'permanent-local t) (defvar egg-mb-euc 'euc-japan) (make-variable-buffer-local 'egg-mb-euc) (put 'egg-mb-euc 'permanent-local t) ;; Japanese (eval-and-compile (define-ccl-program ccl-decode-fixed-euc-jp `(2 ((r2 = ,(charset-id 'japanese-jisx0208)) (r3 = ,(charset-id 'japanese-jisx0212)) (r4 = ,(charset-id 'katakana-jisx0201)) (read r0) (loop (read r1) (if (r0 < #x80) ((r0 = r1) (if (r1 < #x80) (write-read-repeat r0)) (write-multibyte-character r4 r0) (read r0) (repeat)) ((if (r1 > #x80) ((r0 &= #x7f) (r0 <<= 7) (r0 |= (r1 & #x7f)) (write-multibyte-character r2 r0) (read r0) (repeat)) ((r0 &= #x7f) (r0 <<= 7) (r0 |= r1) (write-multibyte-character r3 r0) (read r0) (repeat))))))))) (define-ccl-program ccl-encode-fixed-euc-jp `(2 ((read r0) (loop (if (r0 == ,(charset-id 'latin-jisx0201)) ; Unify ((read r0) (r0 &= #x7f))) (if (r0 < #x80) ;G0 ((write 0) (write-read-repeat r0))) (r6 = (r0 == ,(charset-id 'japanese-jisx0208))) (r6 |= (r0 == ,(charset-id 'japanese-jisx0208-1978))) (if r6 ;G1 ((read r0) (write r0) (read r0) (write-read-repeat r0))) (if (r0 == ,(charset-id 'katakana-jisx0201)) ;G2 ((read r0) (write 0) (write-read-repeat r0))) (if (r0 == ,(charset-id 'japanese-jisx0212)) ;G3 ((read r0) (write r0) (read r0) (r0 &= #x7f) (write-read-repeat r0))) (read r0) (repeat))))) ) (if (not (coding-system-p 'fixed-euc-jp)) (make-coding-system 'fixed-euc-jp 'ccl "Coding System for fixed EUC Japanese" `(decode ,ccl-decode-fixed-euc-jp encode ,ccl-encode-fixed-euc-jp mnemonic "WNN"))) (defun comm-format-u32c (uint32c) (insert-char (logand (lsh (car uint32c) -8) 255) 1) (insert-char (logand (car uint32c) 255) 1) (insert-char (logand (lsh (nth 1 uint32c) -8) 255) 1) (insert-char (logand (nth 1 uint32c) 255) 1)) (defun comm-format-u32 (uint32) (insert-char (logand (lsh uint32 -24) 255) 1) (insert-char (logand (lsh uint32 -16) 255) 1) (insert-char (logand (lsh uint32 -8) 255) 1) (insert-char (logand uint32 255) 1)) (defun comm-format-i32 (int32) (insert-char (logand (ash int32 -24) 255) 1) (insert-char (logand (ash int32 -16) 255) 1) (insert-char (logand (ash int32 -8) 255) 1) (insert-char (logand int32 255) 1)) (defun comm-format-u16 (uint16) (insert-char (logand (lsh uint16 -8) 255) 1) (insert-char (logand uint16 255) 1)) (defun comm-format-u8 (uint8) (insert-char (logand uint8 255) 1)) (defun comm-format-truncate-after-null (s) (if (string-match "\0" s) (substring s 0 (match-beginning 0)) s)) (defun comm-format-u16-string (s) (insert (encode-coding-string (comm-format-truncate-after-null s) egg-fixed-euc)) (insert-char 0 2)) (defun comm-format-mb-string (s) (insert (encode-coding-string (comm-format-truncate-after-null s) egg-mb-euc)) (insert-char 0 1)) (defun comm-format-u8-string (s) (insert (comm-format-truncate-after-null s)) (insert-char 0 1)) (defun comm-format-binary-data (s) (insert (encode-coding-string s 'binary)) (save-excursion (goto-char (point-min)) (wnn-perform-replace "\377" "\377\0")) (insert-char ?\377 2)) (defun comm-format-fixlen-string (s len) (setq s (comm-format-truncate-after-null s)) (insert (if (< (length s) len) s (substring s 0 (1- len)))) (insert-char 0 (max (- len (length s)) 1))) (defun comm-format-vector (s len) (setq s (concat s)) (insert (if (<= (length s) len) s (substring s 0 len))) (insert-char 0 (- len (length s)))) (defmacro comm-format (format &rest args) "Format a string out of a control-list and arguments into the buffer. The formated datas are network byte oder (i.e. big endian).. U: 32-bit integer. The argument is 2 element 16-bit unsigned integer list. u: 32-bit integer. The argument is treat as unsigned integer. (Note: Elisp's integer may be less than 32 bits) i: 32-bit integer. w: 16-bit integer. b: 8-bit integer. S: 16-bit wide-character EUC string (0x0000 terminated). E: Multibyte EUC string (0x00 terminated). s: 8-bit string (0x00 terminated). B: Binary data (0xff terminated). v: 8-bit vector (no terminator). This takes 2 args (data length). V: Fixed length string (0x00 terminated). This takes 2 args (data length)." (let ((p args) (form format) (result (list 'progn)) f arg) (while (and form p) (setq f (car form) arg (car p)) (nconc result (list (cond ((eq f 'U) (list 'comm-format-u32c arg)) ((eq f 'u) (list 'comm-format-u32 arg)) ((eq f 'i) (list 'comm-format-i32 arg)) ((eq f 'w) (list 'comm-format-u16 arg)) ((eq f 'b) (list 'comm-format-u8 arg)) ((eq f 'S) (list 'comm-format-u16-string arg)) ((eq f 'E) (list 'comm-format-mb-string arg)) ((eq f 's) (list 'comm-format-u8-string arg)) ((eq f 'B) (list 'comm-format-binary-data arg)) ((eq f 'V) (setq p (cdr p)) (list 'comm-format-fixlen-string arg (car p))) ((eq f 'v) (setq p (cdr p)) (list 'comm-format-vector arg (car p)))))) (setq form (cdr form) p (cdr p))) (if (or form p) (error "comm-format %s: arguments mismatch" format)) result)) (defvar comm-accept-timeout nil) ;; Assume PROC is bound to the process of current buffer ;; Do not move the point, leave it where it was. (defmacro comm-accept-process-output () `(let ((p (point))) (if (null (accept-process-output proc comm-accept-timeout)) (error "backend timeout")) (goto-char p))) (defmacro comm-require-process-output (n) `(if (< (point-max) (+ (point) ,n)) (comm-wait-for-space proc ,n))) (defun comm-wait-for-space (proc n) (let ((p (point)) (r (+ (point) n))) (while (< (point-max) r) (if (null (accept-process-output proc comm-accept-timeout)) (error "backend timeout")) (goto-char p)))) (defmacro comm-following+forward-char () `(prog1 (following-char) (forward-char 1))) (defun comm-unpack-u32c () (progn (comm-require-process-output 4) (list (+ (lsh (comm-following+forward-char) 8) (comm-following+forward-char)) (+ (lsh (comm-following+forward-char) 8) (comm-following+forward-char))))) (defun comm-unpack-u32 () (progn (comm-require-process-output 4) (+ (lsh (comm-following+forward-char) 24) (lsh (comm-following+forward-char) 16) (lsh (comm-following+forward-char) 8) (comm-following+forward-char)))) (defun comm-unpack-u16 () (progn (comm-require-process-output 2) (+ (lsh (comm-following+forward-char) 8) (comm-following+forward-char)))) (defun comm-unpack-u8 () (progn (comm-require-process-output 1) (comm-following+forward-char))) (defun comm-unpack-u16-string () (let ((start (point))) (while (not (search-forward "\0\0" nil t)) (comm-accept-process-output)) (decode-coding-string (buffer-substring start (- (point) 2)) egg-fixed-euc))) (defun comm-unpack-mb-string () (let ((start (point))) (while (not (search-forward "\0" nil t)) (comm-accept-process-output)) (decode-coding-string (buffer-substring start (1- (point))) egg-mb-euc))) (defun comm-unpack-u8-string () (let ((start (point))) (while (not (search-forward "\0" nil 1)) (comm-accept-process-output)) (buffer-substring start (1- (point))))) (defun comm-unpack-binary-data () (let ((start (point))) (while (not (search-forward "\377\377" nil 1)) (comm-accept-process-output)) (string-as-unibyte (decode-coding-string (buffer-substring start (- (point) 2)) 'binary)))) (defun comm-unpack-fixlen-string (len) (let (s) (comm-require-process-output len) (goto-char (+ (point) len)) (setq s (buffer-substring (- (point) len) (point))) (if (string-match "\0" s) (setq s (substring s 0 (match-beginning 0)))) s)) (defun comm-unpack-vector (len) (progn (comm-require-process-output len) (goto-char (+ (point) len)) (buffer-substring (- (point) len) (point)))) (defmacro comm-unpack (format &rest args) "Unpack a string out of a control-string and set arguments. See `comm-format' for FORMAT." (let ((p args) (form format) (result (list 'progn)) arg f) (while (and form p) (setq f (car form) arg (car p)) (nconc result (list (cond ((eq f 'U) `(setq ,arg (comm-unpack-u32c))) ((eq f 'u) `(setq ,arg (comm-unpack-u32))) ((eq f 'i) `(setq ,arg (comm-unpack-u32))) ((eq f 'w) `(setq ,arg (comm-unpack-u16))) ((eq f 'b) `(setq ,arg (comm-unpack-u8))) ((eq f 'S) `(setq ,arg (comm-unpack-u16-string))) ((eq f 'E) `(setq ,arg (comm-unpack-mb-string))) ((eq f 's) `(setq ,arg (comm-unpack-u8-string))) ((eq f 'B) `(setq ,arg (comm-unpack-binary-data))) ((eq f 'V) (setq p (cdr p)) `(setq ,arg (comm-unpack-fixlen-string ,(car p)))) ((eq f 'v) (setq p (cdr p)) `(setq ,arg (comm-unpack-vector ,(car p))))))) (setq form (cdr form) p (cdr p))) (if (or form p) (error "comm-unpack %s: arguments mismatch" format)) result)) (defmacro comm-call-with-proc (proc vlist send-expr &rest receive-exprs) (let ((euc-select (and (eq (car-safe (car vlist)) 'zhuyin) '((egg-fixed-euc (nth (if zhuyin 1 0) egg-fixed-euc)))))) `(let* ((proc ,proc) (buffer (process-buffer proc)) ,@vlist) (if (and (eq (process-status proc) 'open) (buffer-live-p buffer)) (save-excursion (set-buffer buffer) (let ,euc-select (erase-buffer) ,send-expr (goto-char (point-max)) (process-send-region proc (point-min) (point-max)) ,@receive-exprs)) (error "process %s was killed" proc))))) (defmacro comm-call-with-proc-1 (proc vlist send-expr &rest receive-exprs) `(let ,vlist (erase-buffer) ,send-expr (goto-char (point-max)) (process-send-region proc (point-min) (point-max)) ,@receive-exprs)) (provide 'wnn7egg-comx214) ;;; wnn7egg-comx214.el ends here. wnn7egg-1.02.orig/elisp/README0100644000764400003210000010362707474174160016152 0ustar ishikawaishikawa********************************************************************** * * * Wnn7 対応 Emacs 用日本語入力クライアント * * wnn7egg 「wnnななたまご」v1.02 * * * * ご利用ガイド * * * ********************************************************************** 0. はじめに 1. 特徴 2. 動作環境 3. 使用方法 4. 新しい機能を使う 4.1 入力予測機能 4.2 連想変換 4.3 日本語校正/入力補正 5. 設定ファイル eggrc-wnn7 6. eggV3 と異なる点 7. v1.00 から v1.01 への変更点 8. v1.01 から v1.02 への変更点 0. はじめに wnn7egg「wnnななたまご」は、「たまご第3版」v3.09 をベースに 「たまご 第4版」の通信、ライブラリ部を組み込んだ、Wnn7 の為の専用クライアント です。 すべて Emacs Lisp で記述されていますので、お手持ちの GNU Emacs 及び XEmacs 環境でそのまま使用することができます。使用許諾条件は GPL です。 以降「たまご第3版」を eggV3 と、「たまご第4版」を eggV4 と記述します。 1. 特徴 I. eggV3 のボディに、eggV4 の通信部を載せた構成 Wnn SDK を用いて emacs を再構築する必要はありません。また、内部処 理は eggV3 のものを用いていますので、xemacs でも動作可能です。 構造的には eggV3 のユーザインターフェース部に、eggV4 の通信ライブ ラリを合わせて、両者の接点となる上位ライブラリ部分を新規に作成した 形になっています。 leim ベースのため他のIMEとの切替も可能です。 ※一部制限事項があります。詳しくは「6. eggV3 と異なる点」をご覧下 さい。 +-------------------------------+ | eggV3 UserInterface部 | <-- eggV3 より流用/改造 | | +-------------------------------+ | wnn7egg ProgramInterface 部 | <-- 新規作成 +-------------------------------+ | eggV4 socket通信部 | <-- eggV4 より流用/改造 | | +-------------------------------+ 図1 wnn7egg 構造図 II. いろんな形で使える入力予測機能 Wnn7 の新機能のひとつである入力予測機能が使用できます。 入力予測機能の ON/OFFのほか、インライン候補表示/候補ウィンドウ表示の 切替、リアルタイム予測候補表示/ユーザ指定予測候補表示の切替など、 多彩な使い方が可能です。 III. 日本語校正、補正もできる 間違った入力のまま変換しても、正しい読みに直して変換します。 2. 動作環境 動作確認済 emacs 以下の emacs または xemacs で動作確認済です。 GNU Emacs 20.6 20.7 XEmacs 21.1 ※1 XEmacs は sumo パッケージが必要です。 ※2 Mule2.3 など、GNU Emacs 19.x 以下のバージョンのものでは動作しません。 構成ファイル 「wnnななたまご」は以下のファイルによって構成されています。 /usr/share/wnn7/elisp/README .......... 本書 /usr/share/wnn7/elisp/Setup_wnn7egg ... 自動セットアップスクリプト GNU Emacs 用 elisp ファイル /usr/share/wnn7/elisp/emacs20/ wnn7egg-cnv.el[c] .......... 「wnnななたまご」内部処理 wnn7egg-com.el[c] .......... 通信部 wnn7egg-edep.el ............ emacs バージョン依存部 wnn7egg-jsymbol.el[c] ...... 記号定義 wnn7egg-leim.el[c] ......... leim 設定 wnn7egg-lib.el[c] .......... wnn7 上位ライブラリ wnn7egg-rpc.el[c] .......... wnn7 下位ライブラリ wnn7egg.el[c] .............. 「wnnななたまご」本体 xemacs 用 elisp ファイル /usr/share/wnn7/elisp/xemacs21/ wnn7egg-cnv.el[c] .......... 「wnnななたまご」内部処理 wnn7egg-comx21.el[c] ....... 通信部 wnn7egg-edep.el ............ emacs バージョン依存部 wnn7egg-jsymbol.el[c] ...... 記号定義 wnn7egg-leim.el[c] ......... leim 設定 wnn7egg-lib.el[c] .......... wnn7 上位ライブラリ wnn7egg-rpcx21.el[c] ....... wnn7 下位ライブラリ wnn7egg.el[c] .............. 「wnnななたまご」本体 3. 使用方法 準備1)~/.emacs に (if (featurep 'xemacs) (setq load-path (append '("/usr/share/wnn7/elisp/xemacs21") load-path)) (setq load-path (append '("/usr/share/wnn7/elisp/emacs20") load-path))) (global-set-key "\C-\\" 'toggle-input-method) (load "wnn7egg-leim") (if (featurep 'xemacs) (select-input-method "japanese-egg-wnn7") (set-input-method "japanese-egg-wnn7")) (set-language-info "Japanese" 'input-method "japanese-egg-wnn7") と記述します。 /usr/share/wnn7/elisp/Setup_wnn7egg をお使いになると、自動で ~/.emacs の末尾に上記設定を記述することができます。 ターミナルエミュレータ上で、以下のように実行してください。 # /usr/share/wnn7/elisp/Setup_wnn7egg 準備2) サーバが localhost の default port 以外で動作しているのであれば、 接続先のサーバが分かるように指定しておきます。 例えば、hogehoge という名前のマシンで相対ポート2で動作している jserver に接続したい場合は、 (setq wnn7-server-name "hogehoge:2") と記述します。 起動) emacs または xemacs を起動します。 基本的な使用方法は、eggV3 と同じです。 注)一部、機能や関数名、変数名が異なる部分があります。 詳しくは「6. eggV3 と異なる点」をご覧下さい。 4. 新しい機能を使う 4.1 入力予測機能 最初の1〜数文字だけ入力し、そこから予測される入力結果を選択することで、 少ない入力で文章入力が行えます。 入力予測機能を使用するには以下のコマンドを実行します。 M-x egg-use-input-predict サーバに接続でき、入力予測使用可能になったら、モード行のステータス表示 が、[あ]から[あ予]になります。 では試しに「おはようございます。」と入力してみましょう。 「お」と入力すると、入力位置の下に、 --------------------------------------------------------------------- [お。。。。][お。。。。][お。。。。][お。。。。][お。。。。] --------------------------------------------------------------------- と出ました。これが「お」から始まる予測候補です。 続いて「h」「a」と入力すると予測候補が絞られていきます。 --------------------------------------------------------------------- [おはようございます。] --------------------------------------------------------------------- この状態で tab を入力します。 するとカーソルが予測候補に移動します。 「おはようございます。」の文字列上にカーソルが移動したら、return を 入力します。すると、入力位置の「お」の位置に「おはようございます。」が 入力されます。 予測候補を無視して入力すれば、今までの入力と変わりありません。 予測候補に目的の言葉がなければ、そのまま入力・確定しますと、その言葉は 入力予測候補として学習され、次回の予測時に登場します。 詳しくは wnn7 の取扱説明書をご覧下さい。 入力予測機能使用中は以下のようキーバインドが追加されます。 (文字入力中) tab ............ 予測候補選択モードに移行する。 ユーザ指定予測モードであれば、予測候補の表示+ 予測候補選択モードに移行となる。 (予測候補選択モード) space, tab, n, f, C-n, C-f ... 次候補へ移動 b, p, C-b, C-p ............... 前候補へ移動 return ....................... 候補確定 q, C-g ....................... 予測候補を選択せずに入力位置に戻る C-d .......................... 予測候補削除 入力予測機能を切り替えるためのコマンドとして、以下のものが用意されて います。いろいろお試し下さい。 egg-use-input-predict 入力予測機能を使用開始します。 egg-unuse-input-predict 入力予測機能を終了します。 egg-predict-toggle-realtime-mode リアルタイム予測モードと、ユーザ指定予測モードの切替を行います。 リアルタイム予測モードでは、入力1キー毎に予測候補を表示します。 ユーザ指定予測モードでは、普段は予測候補は表示されませんが、候補 を表示したい時に tab を入力すると、その時点の予測候補が表示され ます。 egg-predict-toggle-candidate-mode ウィンドウ予測候補表示とインライン予測候補表示の切替を行います。 ウィンドウ予測候補表示の場合は、ウィンドウ下部に予測候補用の ウィンドウを生成し、そこに予測候補を表示します。 インライン予測候補表示の場合は、入力バッファの入力位置直下に、 予測候補を横ならびに表示します。 初期状態では、リアルタイム予測&インライン予測候補表示で動作します。 4.2 連想変換 変換した語句に対する類義語、同義語の候補を得ることが出来ます。 漢字変換後([漢]の状態)で、M-r (ESC-r) を入力すると、ミニバッファに 連想変換候補が表示されます。 例) 「さいだい」→変換→「最大」 ↓ M-r (ESC-r) ↓ 「切っての」「最も」「最高」「最上」・・・ 4.3 日本語校正/入力補正 以下のような誤入力のまま漢字変換された場合も、そのまま変換するのではなく、 正しい読みに直して変換します。 ・母音の過不足 「おおおさか」 -----------------> 「大阪」 「にゅりょく」 -----------------> 「入力」 ・子音の超過 「きっっぷ」 -----------------> 「切符」 ・ n の超過 「かんんじ」 -----------------> 「漢字」 ・日本語校正 「あきがたなうお」 -----------------> 「秋刀魚」 「わたぬき」 -----------------> 「四月一日」 5. 設定ファイル eggrc-wnn7 wnn7 という名前がついている以外は、従来の「たまご第3版」とほぼ同じ構成 です。以下の新しい関数が用意されています。 (wnn7-set-yosoku-learn t) 予測候補を学習する。nil であれば学習しない。 (wnn7-set-yosoku-max-disp 10) 予測候補の最大表示数。 1〜10 までの間で設定。 (wnn7-set-yosoku-last-is-first t) 最後に選択した予測候補を候補先頭に表示する。nil であれば頻度順に 表示される。 (wnn7-set-boin-kabusoku t) 母音過不足の補正。nil であれば補正しない。 (wnn7-set-shiin-choka t) 子音超過の補正。nil であれば補正しない。 (wnn7-set-n-choka t) n 超過の補正。nil であれば補正しない。 (wnn7-set-nihongo-kosei t) 日本語校正機能の使用。nil であれば使用しない。 デフォルトの設定ファイルは /usr/share/wnn7/elisp/xemacs21/eggrc-wnn7 または /usr/share/wnn7/elisp/emacs20/eggrc-wnn7 ですが、 ホームディレクトリに .eggrc-wnn7 という名前でコピーすることによって、 自分専用の設定を行うことができます。 6. eggV3 と異なる点 以下の点が、eggV3 と異なっています。 o "wnn" という文字が含まれた一部関数、変数が "wnn7" に置き換わっています。 既に emacs/xemacs に含有されている eggV3 を破壊せず独立した形をとる 必要があったため、影響を受けそうな関数、変数を "wnn7" という別関数、 別変数にしてあります。 特に、以下の利用頻度の高そうな関数、変数についてはご注意ください。 変数: wnn-server-name -> wnn7-server-name 関数: set-wnn-host-name -> set-wnn7-host-name toroku-region -> wnn7-toroku-region その他、直接呼び出すことの少ない以下のような関数においても別関数に 分けられているものがあります。 open-wnn -> open-wnn7 disconnect-wnn -> disconnect-wnn7 close-wnn -> close-wnn7 wnn-henkan-region -> wnn7-henkan-region ... etc. ※ eggV4 通信部においても、互いの影響を少なくするため関数名などを 変更しております。ご了承下さい。(ex. wnnrpc-* -> wnn7rpc) o diced モードは実装されていません。 o busyu-input は実装されていません。 7. v1.00 から v1.01 への変更点 「wnnななたまご」v1.01 は、v1.00 より以下の点が変更されています。 ・console 端末での入力予測候補表示(tab)と 確定(return)のキー設定 を追加しました。 ・入力予測機能使用中に jserver が終了すると、 入力できなくなる問題に 対応しました。 ・XEmacs の場合、color-mate で leim-cursor を使うと、 かな漢字変換が 出来なくなるという問題に対応しました。 ・ヘルプ表示の関数内のモードとリージョン指定変換の関数が、 eggV3 の 関数名のままでしたので、wnn7 用に変更しました。 ・入力予測において、jserver 再起動の必要がないエラーのときに、 「入力 予測エラー jserver を再起動してください」という エラーメッセージを 出力していました。そのため、 エラー番号が分かる形の簡単なエラーメッ セージに変更しました。 ・「2りゅう」というような文字列を変換した後、 文節長の変更ができなく なる問題に対応しました。 8. v1.01 から v1.02 への変更点 「wnnななたまご」v1.02 は、v1.01 より以下の点が変更されています。 ・小文字ひらがな(ぁぃぅ等)の変換後、M-k, M-h の動作が正しく処理 されない問題に対応しました。 ・XEmacs でユーザ辞書の格納場所を変更する設定が正しく動作しない問題に 対応しました。 ・予測モード時に逆変換動作が正しく行なえない問題に対応しました。 ・設定ファイル eggrc-wnn7 の読み込みルールを変更し、既に接続使用中の 変換環境がある場合、環境設定の重複が行なわれないようにしました。 ・eggrc-wnn7 の設定に関する以下の処理を修正しました。 - 接頭語パラメータ prefix-flag の設定値の修正 - 無変換辞書、文節切り辞書の追加処理の修正 ------------------------------------------------------------------------------               GNU一般公有使用許諾書               ============               1991 年6 月,バージョン2         Copyright (C) 1989,1991 Free Software Foundation, Inc.            675 Mass Ave, Cambridge, MA 02139, USA * ---------------------------------------------------------------------- * 【注意】 現在、このバージョン2の発行者(FSF)住所は、正式に新 しい住所の 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA に変わっている。 ---------------------------------------------------------------------- 何人も、以下の内容を変更しないでそのまま複写する場合に限り、本使用許諾 書を複製したり頒布することができます。 はじめに --------  ほとんどのソフトウェアの使用許諾は、ソフトウェアを共有し、変更するユー ザの自由を奪うことを意図しています。それに対して、我々のGNU一般公有使 用許諾は、フリー・ソフトウェアを共有したり変更する自由をユーザに保証す るためのもの、即ちフリー・ソフトウェアがそのユーザ全てにとってフリーで あることを保証するためのものです。本使用許諾は、Free Software Foundation のほとんど全てのソフトウェアに適用されるだけでなく、プログ ラムの作成者が本使用許諾に依るとした場合のそのプログラムにも適用するこ とができます。(その他の Free Software Foundation のソフトウェアのいく つかは、本許諾書ではなく、GNUライブラリ一般公有使用許諾で保護されます。) あなたは自分のプログラムにもこれを適用できます。我々がフリー・ソフトウェ アについて言う場合は自由のことに言及しているのであって、価格のことでは ありません。我々の一般公有使用許諾の各条項は、次の事柄を確実に実現する ことを目的として立案されています。    ・ フリー・ソフトウェアの複製物を自由に頒布できること(そして、      望むならあなたのこのサービスに対して対価を請求できること)。    ・ ソース・コードを実際に受け取るか、あるいは、希望しさえすれば      それを入手することが可能であること。    ・ 入手したソフトウェアを変更したり、新しいフリー・プログラムの      一部として使用できること。    ・ 以上の各内容を行なうことができるということをユーザ自身が知っ      ていること。  このようなユーザの権利を守るために、我々は、何人もこれらの権利を否定 したり、あるいは放棄するようにユーザに求めることはできないという制限条 項を設ける必要があります。これらの制限条項は、ユーザが、フリー・ソフト ウェアの複製物を頒布したり変更しようとする場合には、そのユーザ自身が守 るべき義務ともなります。例えば、あなたがフリー・ソフトウェアの複製物を 頒布する場合、有償か無償かにかかわらず、あなたは自分の持っている権利を 全て相手に与えなければなりません。あなたは、相手もまたソース・コードを 受け取ったり入手できるということを認めなければなりません。さらにあなた は、彼らが自分たちの権利を知るように、これらの条項を知らしめなければな りません。  我々は次の2つの方法でユーザの権利を守ります。(1)ソフトウェアに著 作権を主張し、(2)本使用許諾の条項の下でソフトウェアを複製・頒布・変 更する権利をユーザに与えます。  また、各作成者や我々自身を守るために、本フリー・ソフトウェアが無保証 であることを全ての人々が了解している必要があります。さらに、他の誰かに よって変更されたソフトウェアが頒布された場合、受領者はそのソフトウェア がオリジナル・バージョンではないということを知らされる必要があります。 それは、他人の関与によって原開発者に対する評価が影響されないようにする ためです。  最後に、どのフリー・プログラムもソフトウェア特許に絶えず脅かされてい ます。我々は、フリー・プログラムの再頒布者が個人的に特許権を取得し、事 実上そのプログラムを自分の財産にしてしまうという危険を避けたいと願って います。これを防ぐために我々は、いずれの特許も、誰でも自由に使用できる ように使用許諾されるべきか、あるいは何人に対しても全く使用させないかの、 いずれかにすべきであることを明らかにしてきました。  複写・頒布・変更に対する正確な条項と条件を次に示します。 GNU一般公有使用許諾の下での複製、頒布、変更に関する条項と条件 ================================  1. 本使用許諾は、本一般公有使用許諾の各条項に従って頒布されるとい     う著作権者からの告知文が表示されているプログラムやその他の作成     物に適用されます。以下において「プログラム」とは、そのようなプ     ログラムや作成物を指すものとし、また、「プログラム生成物」とは、     上述した「プログラム」自身、または、著作権法下における全ての派     生物;すなわち、その「プログラム」の全部又は一部を、そのまま又     は変更して、且つ/又は他の言語に変換して、内部に組み込んだ作成     物を意味します。(以下、言語変換は「変更」という用語の中に無条     件に含まれるものとします。)本使用許諾によって許諾を受ける者を     「あなた」と呼びます。      複製、頒布、変更以外の行為は本使用許諾の対象としません。それら     は本使用許諾の範囲外です。「プログラム」を実行させる行為に関し     て制約はありません。「プログラム」の出力は、( 「プログラム」     を実行させて作成させたかどうかとは無関係に) その内容が「プロ     グラム生成物」である場合に限り本使用許諾の対象となります。これ     が当てはまるかどうかは、「プログラム」が何をするものかに依りま     す。  2. あなたは、どのような媒体上へ複製しようとする場合であっても、入     手した「プログラム」のソース・コードをそのままの内容で複写した     上で適正な著作権表示と保証の放棄を明確、且つ適正に付記する場合     に限り、複製又は頒布することができます。その場合、本使用許諾及     び無保証に関する記載部分は、全て元のままの形で表示してください。     また、「プログラム」の頒布先に対しては、「プログラム」と共に本     使用許諾書の写しを渡してください。複製物の引き渡しに要する実費     は請求することができます。また、あなた独自の保証を行なう場合は     それを有償とすることができます。  3. 次の各条件を全て満たしている限り、あなたは、「プログラム」又は     その一部分を変更して「プログラム生成物」とすることができ、さら     に、変更版や右作成物を上記第2項に従って複製又は頒布することも     できます。     (a)ファイルを変更した旨とその変更日とを、変更したファイル上        に明確に表示すること。     (b)変更したか否かを問わず、凡そ「プログラム」又はその一部分        を内部に組み込んでいるか又はそれから派生した生成物を頒布        する場合には、その全体を本使用許諾の条項に従って第三者へ        無償で使用許諾すること。     (c)変更したプログラムが実行時に通常の対話的な方法でコマンド        を読むようになっているとすれば、最も普通の方法で対話的に        そのプログラムを実行する時に、次の内容を示す文言がプリン        タへ印字されるか、或いは画面に表示されること。        ・適切な著作権表示。        ・無保証であること(あなたが独自に保証する場合は、その旨)。        ・頒布を受ける者も、本使用許諾と同一の条項に従って「プロ         グラム」を再頒布できること。        ・頒布を受ける者が本使用許諾書の写しを参照する方法。        (例外として、「プログラム」自体は対話的であっても起動時        の文言を通常は印字しないのならば、あなたの「プログラム生        成物」はこのような文言を印字する必要はありません。)     これらの要件は変更された作成物にも全て適用されます。その変更版     の或る部分が「プログラム」の派生物ではなく、しかもそれ自体独立     で異なる作成物だと合理的に考えられる場合、あなたがそれらを別の     作成物として頒布した時は、本使用許諾とその条項はそれらの部分に     は適用されません。しかし、それらを「プログラム生成物」の一部と     して頒布する場合は、全体が本使用許諾の条項に従って頒布されなけ     ればならず、使用許諾を受ける他の全ての者に対する許諾もプログラ     ム全体にわたって与えられなければならず、結果として、誰が書いた     かにかかわらず、全ての部分に本使用許諾が適用されなければなりま     せん。     このように、本条項の意図するところは、完全にあなたによって書か     れた作成物について、権利を要求したり、あなたと権利関係を争うこ     とではありません。むしろその目的は、作成物が「プログラム生成物」     である場合にその派生物や集合物の頒布を規制することにあります。     さらに、「プログラム」(又は「プログラム生成物」) と「プログ     ラム生成物」とはならない他のプログラムとを、単に保管や頒布のた     めに同一の媒体上にまとめて記録したとしても、本使用許諾は他のプ     ログラムには適用されません。  4. あなたは、以下のうちいずれか1つを満たす限り、上記第2項及び第     3項に従って「プログラム」(又は、上記第3項で言及している「プ     ログラム生成物」)をオブジェクト・コード又は実行可能な形式で複     製及び頒布することができます。     (a)対応する機械読み取り可能なソース・コード一式を一緒に引き        渡すこと。その場合、そのソース・コードの引き渡しは上記第        2項及び第3項に従って、通常ソフトウェアの交換に用いられ        る媒体で行なわれること。     (b)少なくとも3年間の有効期間を定め、且つその期間内であれば        対応する機械読み取り可能なソース・コード一式の複製を、ソー        ス頒布に関わる実費以上の対価を要求せずに提供する旨、及び        その場合には上記第2項及び第3項に従って、通常ソフトウェ        アの交換に用いられる媒体で提供される旨を記載した書面を、        第三者に一緒に引き渡すこと。     (c)対応するソース・コード頒布の申し出に際して、あなたが得た        情報を一緒に引き渡すこと。(この選択肢は、営利を目的とし        ない頒布であって、且つあなたが上記の(b)項に基づいて、        オブジェクト・コード或いは実行可能形式のプログラムしか入        手していない場合に限り適用される選択項目です。)     なお、ソース・コードとは、変更作業に適した記述形式を指します。     また、実行可能形式のファイルに対応するソース・コード一式とは、     それに含まれる全モジュールに対応する全てのソース・コード、及び     あらゆる関連のインタフェース定義ファイル、及び実行を可能にする     コンパイルとインストールの制御に関する記述を指します。特別な例     外として、実行可能なファイルが動作するオペレーティング・システ     ムの主要な構成要素(コンパイラ、カーネルなど) と共に(ソース・     コード又はバイナリのどちらかで) 頒布されているものについては、     その構成要素自体が実行形式に付随していない場合に限り、頒布され     るソース・コードに含める必要はありません。     実行可能形式またはオブジェクト・コードの頒布が、指示された場所     からの複製のためのアクセス権の賦与である場合、同じ場所からのソー     ス・コードの複製のための同等なアクセス権を賦与すれば、たとえ第     三者にオブジェクト・コードと共にソースの複製を強いなくとも、ソー     ス・コードを頒布したものとみなします。  5. 本使用許諾が明示的に許諾している場合を除き、あなたは、「プログ     ラム」を複製、変更、サブライセンス、頒布することができません。     本使用許諾に従わずに「プログラム」を複製、変更、サブライセンス、     頒布しようとする行為は、それ自体が無効であり、且つ、本使用許諾     があなたに許諾している「プログラム」の権利を自動的に消滅させま     す。その場合、本使用許諾に従ってあなたから複製物やその権利を得     ている第三者は、本使用許諾に完全に従っている場合に限り、引続き     有効な使用権限を持つものとします。  6. あなたはまだ同意の印として署名していないので、本使用許諾を受け     入れる必要はありません。しかし、あなたに「プログラム」又はその     派生物を変更又は再頒布する許可を与えるものは本使用許諾以外には     ありません。これらの行為は、あなたがもし本使用許諾を受け入れな     いのであれば、法律によって禁じられます。従って、あなたが「プロ     グラム」(又は「プログラム生成物」)の変更又は頒布を行えば、そ     れ自体であなたは本使用許諾を受け入れ、且つ、「プログラム」又は     その「プログラム生成物」の複製、頒布、変更に関するこれらの条項     と条件の全てを受け入れたことを示します。  7. あなたが「プログラム」(又はその「プログラム生成物」)を再頒布     すると自動的に、その受領者は、元の使用許諾者から、本使用許諾の     条項に従って「プログラム」を複製、頒布、変更することを内容とす     る使用許諾を受けたものとします。あなたは、受領者に許諾された権     利の行使について、さらに制約を加えることはできません。あなたに     は、第三者に本使用許諾の受け入れを強いる責任はありません。  8. 裁判所の判決、又は特許侵害の申し立て、又は(特許問題に限らない)     何らかの理由の結果として、あなたに課せられた条件が本使用許諾と     相入れないものであったとしても(裁判所の命令、契約、その他によ     るものであれ)、本使用許諾の条件が免除されるものではありません。     本使用許諾による責務と、その他の何らかの関連責務を同時に満たす     態様で頒布することができないならば、あなたは「プログラム」を全     く頒布してはいけません。例えば、特許権の内容が、あなたから直接     又は間接に複製を受け取った全ての人に使用料のないプログラムの再     頒布を許さないものであれば、あなたがかかる特許上の要請と本使用     許諾の両方を満足させる方法は、「プログラム」の頒布を完全に断念     することだけです。     本条項の或る部分が何らかの特別な状況下で無効または適用不可能に     なった場合、本条項のその他の残りの部分が適用されるように意図さ     れており、また、本条項は全体としてその他の状況に当てはまるよう     に意図されています。     本条項の目的は、特許やその他の財産権を侵害したり、そのような権     利に基づく主張の妥当性を争うようにあなたに勧めることではありま     せん。本条項の唯一の目的は、フリー・ソフトウェアの頒布システム     の完全性を守ることで、それは公有使用許諾の実践によって履行され     ます。多くの人々が、このシステムの一貫した適用を信頼して、この     システムを通じて頒布されている幅広い範囲のソフトウェアに惜しみ     ない貢献をしてくれました。作成者や寄贈者が他の何らかのシステム     を通じてソフトウェアを頒布したいと決めることは彼らの自由意志で     あり、使用許諾を受ける者はその選択を強いることはできません。     本条項は、本使用許諾の他の条項の意味内容が何であるかを完全に明     らかにすることを意図しています。  9. 「プログラム」の頒布・使用が、ある国において特許又は著作権で保     護されたインタフェースのどちらかで制限される場合、「プログラム」     を本使用許諾下においた原著作権保持者は、その国を除外する旨の明     示的な頒布地域制限を加え、それ以外の(除外されない) 国に限定     して頒布が許されるようにすることができます。そのような場合、そ     の制限を本使用許諾の本文にあたかも書かれているかのように本使用     許諾の中に組み入れられるものとします。 10. Free Software Foundation は随時、本一般公有使用許諾の改訂版、     又は新版を公表することがあります。そのような新しいバージョンは、     現行のバージョンと基本的に変わるところはありませんが、新しい問     題や懸案事項に対応するために細部では異なるかもしれません。     各バージョンは、バージョン番号によって区別します。「プログラム」     中に本使用許諾のバージョン番号の指定がある場合は、その指定され     たバージョンか、又はその後に Free Software Foundation から公表     されているいずれかのバージョンから1つを選択して、その条項と条     件に従ってください。「プログラム」中に本使用許諾のバージョン番     号の指定がない場合は、Free Software Foundation が公表したどの     バージョンでも選択することができます。 11. 「プログラム」の一部を頒布条件の異なる他のフリー・プログラムに     組み込みたい場合は、その開発者に書面で許可を求めてください。     Free Software Foundation が著作権を持っているソフトウェアにつ     いては、 Free Software Foundation へ書面を提出してください。こ     のような場合に対応するために我々は例外的処理をすることもありま     すが、その判断基準となるのは、次の2つの目標の実現に合致するか     否かという点です。即ち、1つは我々のフリー・ソフトウェアの全て     の派生物をフリーな状態に保つことであり、もう1つはソフトウェア     の共有と再利用とを広く促進させることです。 無保証 ------ 12. 「プログラム」は無償で使用許諾されますので、適用法令の範囲内で、     「プログラム」の保証は一切ありません。著作権者やその他の第三者     は全く無保証で「そのまま」の状態で、且つ、明示か暗黙であるかを     問わず一切の保証をつけないで提供するものとします。ここでいう保     証とは、市場性や特定目的適合性についての暗黙の保証も含まれます     が、それに限定されるものではありません。「プログラム」の品質や     性能に関する全てのリスクはあなたが負うものとします。「プログラ     ム」に欠陥があるとわかった場合、それに伴う一切の派生費用や修理・     訂正に要する費用は全てあなたの負担とします。 13. 適用法令の定め、又は書面による合意がある場合を除き、著作権者や     上記許諾を受けて「プログラム」の変更・再頒布を為し得る第三者は、     「プログラム」を使用したこと、または使用できないことに起因する     一切の損害について何らの責任も負いません。著作権者や前記の第三     者が、そのような損害の発生する可能性について知らされていた場合     でも同様です。なお、ここでいう損害には通常損害、特別損害、偶発     損害、間接損害が含まれます(データの消失、又はその正確さの喪失、     あなたや第三者が被った損失、他のプログラムとのインタフェースの     不適合化、等も含まれますが、これに限定されるものではありません)。     以上 注意 **  英文文書 (GNU General Public License) を正式文書とする。この和文文書 は弁護士の意見を採り入れて、できるだけ正確に英文文書を翻訳したものであ るが、法律的に有効な契約書ではない。 和文文書自体の再配布に関して **************  いかなる媒体でも次の条件がすべて満たされている場合に限り、本和文文書 をそのまま複写し配布することを許可する。また、あなたは第三者に対して本 許可告知と同一の許可を与える場合に限り、再配布することが許可されていま す。    ・受領、配布されたコピーに著作権表示および本許諾告知が前もって載     せられていること。     ・コピーの受領者がさらに再配布する場合、その配布者が本告知と同じ     許可を与えていること。    ・和文文書の本文を改変しないこと。 ------------------------------------------------------------------------------ あなたの新しいプログラムにこれらの条項を適用する方法 ==========================  あなたが新しくプログラムを作成し、それを公用に供したい場合は、プログ ラムをフリー・ソフトウェアにして、全ての人々が以上の各条項に従ってこれ を再頒布や変更をすることができるようにするのが最良の方法です。  そうするためには、プログラムに以下の表示をしてください。その場合、無 保証であるということを最も効果的に伝えるために、ソース・ファイルの冒頭 にその全文を表示すれば最も安全ですが、その他の方法で表示する場合でも、 「著作権表示」と全文を読み出す為のアドレスへのポインタだけはファイル上 に表示しておいてください。   <プログラム名とどんな動作をするものかについての簡単な説明の行>    Copyright(C) 19○○年、<著作権者名>    本プログラムはフリー・ソフトウェアです。あなたは、Free Software    Foundation が公表したGNU 一般公有使用許諾の「バージョン2」或い    はそれ以降の各バージョンの中からいずれかを選択し、そのバージョン    が定める条項に従って本プログラムを再頒布または変更することができ    ます。    本プログラムは有用とは思いますが、頒布にあたっては、市場性及び特    定目的適合性についての暗黙の保証を含めて、いかなる保証も行ないま    せん。詳細についてはGNU 一般公有使用許諾書をお読みください。    あなたは、本プログラムと一緒にGNU 一般公有使用許諾の写しを受け取っ    ているはずです。そうでない場合は、Free Software Foundation, Inc.,    675 Mass Ave, Cambridge, MA 02139, USA * へ手紙を書いてください。 ---------------------------------------------------------------------- * 【注意】 現在、このバージョン2の発行者(FSF)住所は、正式に新 しい住所の 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA に変わっている。 ----------------------------------------------------------------------      また、ユーザが電子メイルや書信であなたと連絡をとる方法についての情報 も書き添えてください。  プログラムが対話的に動作する場合は、対話モードで起動した時に次のよう な短い告知文が表示されるようにしてください。    Gnomovision バージョン69、Copyright(C)19○○年 <著作権者名>    Gnomovision は完全に無保証です。詳細は show w とタイプしてくださ    い。これはフリー・ソフトウェアなので、特定の条件の下でこれを再頒    布することができます。詳細は show c とタイプしてください。  上記のshow w やshow c は各々、本一般公有使用許諾の関連する部分を表示 するコマンドを指します。もちろん、あなたが使うこれらのコマンドはshow w やshow c といった呼び名でなくても構いません。さらに、それらのコマンド はあなたのプログラムに合わせる為に、マウスでクリックしたりメニュー形式 にすることもできます。  また、必要と認めた場合には、あなたの雇い主(あなたがプログラマとして 働いている場合) や在籍する学校から、そのプログラムに対する「著作権放棄」 を認めた署名入りの書面を入手してください。ここにその文例を載せます。名 前は変えてください。    Yoyodyne, Inc. は、James Hacker が開発したプログラム    `Gnomovision' (コンパイラにつなげるプログラム) についての著作権    法上の全ての権利を放棄する。    <Ty Coon の署名>, 1 April 1989    Ty Coon, 副社長  本一般公有使用許諾は、あなたのプログラムを財産権の対象となっている他 のプログラムに組み込むことは認めていません。あなたのプログラムがサブルー チン・ライブラリであって、あなたがそのライブラリを財産権の対象となって いる他のアプリケーションとリンクさせることによって、さらに有用なものに しようとする場合には、本使用許諾書の代わりに、GNU ライブラリ一般公有使 用許諾書に従ってください。 ------------------------------------------------------------------------------ wnn7egg-1.02.orig/elisp/Setup_wnn7egg0100755000764400003210000000314507474174160017746 0ustar ishikawaishikawa#! /bin/sh ### wnn7egg Setup Script ### (c) Copyright OMRON SOFTWARE Co., Ltd. 2001 ### LINE1="(if (featurep 'xemacs)" LINE2=" (setq load-path (append '(\"/usr/share/wnn7/elisp/xemacs21\") load-path))" LINE3=" (setq load-path (append '(\"/usr/share/wnn7/elisp/emacs20\") load-path)))" LINE4="(global-set-key \"\C-\\\\\" 'toggle-input-method)" LINE5="(load \"wnn7egg-leim\")" LINE6="(if (featurep 'xemacs)" LINE7=" (select-input-method \"japanese-egg-wnn7\")" LINE8=" (set-input-method \"japanese-egg-wnn7\"))" LINE9="(set-language-info \"Japanese\" 'input-method \"japanese-egg-wnn7\")" FILE1="$HOME/.emacs.el" FILE2="$HOME/.emacs" if [ -f $FILE1 ]; then FILE=$FILE1 else FILE=$FILE2 fi echo echo "$FILE に wnn7egg の起動設定を自動追加します。" echo "書き込まれる内容は以下の通りです。" echo "-----------------------------------------------------------------------------" echo $LINE1 echo $LINE2 echo $LINE3 echo $LINE4 echo $LINE5 echo $LINE6 echo $LINE7 echo $LINE8 echo $LINE9 echo "-----------------------------------------------------------------------------" #echo "よろしいですか? (y/n)" #read ans #if [ "$ans" = "y" -o "$ans" = "Y" ]; then echo ";;; auto defined with Setup_wnn7egg script ------------------" >> $FILE echo $LINE1 >> $FILE echo $LINE2 >> $FILE echo $LINE3 >> $FILE echo $LINE4 >> $FILE echo $LINE5 >> $FILE echo $LINE6 >> $FILE echo $LINE7 >> $FILE echo $LINE8 >> $FILE echo $LINE9 >> $FILE echo echo "完了しました。" echo "wnn7egg の使用方法、解説につきましては、/usr/share/wnn7/elisp/README " echo "をお読み下さい。" #fi