From 73cfac9422c79ee1a8577f2ed21ff83ac98ced3e Mon Sep 17 00:00:00 2001 From: morioka Date: Fri, 20 Feb 1998 12:11:30 +0000 Subject: [PATCH] Merge egg-980220. --- ChangeLog | 184 ++++++++++++++++ egg.el | 48 ++++- egg/sj3.el | 26 +-- egg/sj3rpc.el | 6 +- egg/wnn.el | 440 +++++++++++++++++++++++++++----------- egg/wnnrpc.el | 617 +++++++++++++++++++++++++++++++++++++++++++----------- leim-list-egg.el | 33 ++- menudiag.el | 52 ++++- 8 files changed, 1129 insertions(+), 277 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5cdd3ae..9989248 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,187 @@ +1998-02-20 KATAYAMA Yoshio + + * its.el (its-restart): New function. + (its-insert-fence-open, its-insert-fence-close): New function. + (its-start): Rewritten. Use its-insert-fence-open and + its-insert-fence-close. + (its-exit-mode-internal): Leave its-syl property. + (its-exit-mode-internal): Delete the property in this case. + (its-keydef): Require it. + + * its-keydef.el: Provide the feature. + + * egg-cnv.el (egg-convert-region): Add egg-source property to save + the source string. + (egg-conversion-map, \C-c): New keybind. + (egg-get-previous-bunsetsu): Bug fix. + (egg-decide-before-point): New implementation. + (egg-exit-conversion): Use gg-decide-before-point. + (egg-abort-conversion): New command. + +1998-02-20 NIIBE Yutaka + + * Makefile (SRCS), Egg.prj: Remove euc-china.el. + * egg-com.el: Include egg-china.el. + * egg-china.el: Removed. + +1998-02-18 NIIBE Yutaka + + * Egg.prj: Use PRCS. + + * Makefile (SRCS): Rename euc-cn.el to euc-china.el + * egg-mlh.el (mlh-space-bar-backward-henkan): Put "Japanese" + language property for text. + +1998-02-18 KATAYAMA Yoshio + + * euc-china.el: Rename from euc-cn.el. Update. + + * egg.el (egg-mode): Bug fix. Call get-exit-conversion. + * leim-list-egg.el ("japanese-egg-wnn", "japanese-egg-sj3"): + Use new definition (with language argument). + * egg/wnn.el (egg-activate-wnn): + * egg/sj3.el (egg-activate-sj3): + +1998-02-17 NIIBE Yutaka + + * Makefile (SRCS): Add its/pinyin.el, its/hangul.el and + its-keydef.el. + + * egg-com.el (ccl-encode-fixed-euc-kr): Fixed the name. + +1998-02-17 KATAYAMA Yoshio + + * its-keydef.el: New file. + * its/hangul.el, its/pinyin.el: New version. + + * egg/wnnrpc.el (load-library "egg/wnn"): Comment it out. + (wnnrpc-get-error-message): Support multiple languages. + (wnnrpc-call-with-environment): Chinese support. + + * egg/wnn.el (wnn-support-languages): New const. + (): Add , , and . + (wnnenv-get-server-type, wnnenv-get-dictionary-set, + wnnenv-get-reverse-flag): New substs. + (wnnenv-get-daibunsetsu-info, wnnenv-set-daibunsetsu-info): Changed. + (wnn-server): Removed. + (wnn-jserver, wnn-cserver, wnn-tserver, wnn-kserver): New custom. + (wnn-server-info-list): New const. + (wnn-get-server-info): New function. + (wnn-server-locale, wnn-server-type, wnn-server-port, + wnn-server-stream-name, wnn-server-buffer-name, + wnn-server-coding-system, wnn-server-hostname): New substs. + (wnn-start-conversion): Add new arguments. + (wnn-uniq-candidates): Initialize 'n'. + (wnn-change-bunsetsu-length): Simplefied. + (wnn-change-bunsetsu-length): Call renbunsetsu-conversion, + instead. + (wnn-fini, wnn-comm-sentinel): back to 971009 version. + (wnn-jserver-port): Removed. + (wnn-open): Argument change. Support languages. + + (wnn-dictionary-specification): Removed. + (wnn-dictionary-specification-list): New variable. + (wnn-get-dic-spec, wnn-dic-spec-dic-set, wnn-dic-spec-reverse, + wnn-dic-spec-name, wnn-dic-spec-param, wnn-dic-spec-fuzokugo, + wnn-dic-spec-dic-list): New substs. + (wnn-get-environment): Rewrite. + (wnn-create-environment): Rewrite. + + (egg-activate-wnn): Support languages. + + * egg/sj3rpc.el (load-library "egg/sj3"): Don't load it. + + * egg/sj3.el (sj3-support-languages): New const. + (sj3-start-conversion, sj3-fini): Add lang. + (sj3-change-bunsetsu-length): Simplified. + (egg-activate-sj3): Support language. + + * its/hira.el (its/hira): Packagefy. (?) + (its-hira-map): Add language spec. Move here the escape keys + ("Z", "~"). + + * leim-list-egg.el ("chinese-gb-egg-wnn-py", "chinese-gb-egg-wnn-zy", + "chinese-cns-egg-wnn-py", "chinese-cns-egg-wnn-zy", + "korean-egg-wnn"): New input methods. + + * its.el (its-current-language): New Local Variables. + : Change the structure. Add . + (its-get-language): New substitution. + (its-set-indicator): Removed. + (its-get-indicator, its-get-start-state): New implementation. + (its-reset-start-state): Removed. + (its-buffer-ins/del-SYL): Add new properties, its-map and its-lang. + (its-exit-mode-internal): Change for its-map and its-lang. + (its-in-fence-p): New function. + + ("its-keydef.el"): Load it. + + (its-select-map-menu): Removed. + (its-select-map-from-menu): Removed. + (its-select-hiragana, its-select-katakana, its-select-downcase, + its-select-upcase, its-select-zenkaku-downcase, + its-select-zenkaku-upcase, its-select-map, its-zenkaku-escape, + its-hankaku-escape): Removed. + + (define-its-state-machine): Rewrite. + (define-its-compiled-map): New macro. + (its-define-state-machine): Removed. + + (its-forward-SYL): Cleanup. + + (its-beginning-of-input-buffer): Fix. + (its-end-of-input-buffer): Likewise. + + * egg-com.el (egg-fixed-euc, egg-mb-euc): New Local Variables. + (ccl-decode-fixed-euc-kr, ccl-encode-fixed-euc-kr): New CCLs. + (fixed-euc-kr): New coding system. + (comm-format-mb-string, comm-format-u16-string): Support EUC-KR. + (comm-unpack-u16-string, comm-unpack-mb-string): Likewise. + + * egg-cnv.el (egg-get-bunsetsu-info): New function. + (egg-conversion-backend-alist, egg-finalize-backend-alist): + New Variables. + Make egg-conversion-backend buffer local. + (egg-set-current-backend): New function. + (egg-initialize-backend): Call egg-set-current-backend. + (egg-start-conversion): Add new argument LANGUAGE. + (egg-finalize-backend): Finalize for all backend(s). + (egg-set-conversion-backend-internal): New Macro. + (egg-convert-region): Support multiple languages in the region. + (egg-separate-languages, egg-char-to-language, egg-next-part-lang, + egg-next-chinese-lang): New functions. + (egg-insert-bunsetsu-list): Change the meaning of last argument. + (egg-shrink-bunsetsu): Simplified. Just call egg-enlarge-bunsetsu. + (egg-enlarge-bunsetsu): Support shrink. + + (egg-decide-bunsetsu, egg-next-candidate, egg-select-candidate): + Use egg-get-bunsetsu-info. + + (egg-insert-bunsetsu): The property now includes + egg-conversion-backend. + + * egg.el: Don't load its/hira and don't set its-current-map. + + * egg.el (egg-default-language, egg-support-languages): New Variables. + (egg-last-method-name, egg-mode-line-title): New Local Variables. + (egg-set-mode-line-title, egg-check-language): New functions. + (egg-set-support-languages): New function. + (egg-mode): Final processing: call its-exit-mode, call + egg-exit-conversion. + Changing the arguments, remember last input method. + + Bug fix. Don't set its-hira-period and its-hira-comma. + +1998-02-17 KAWABATA, Taichi + + * menudiag.el (menudiag-mode-map): New binds for new commands. + (menudiag-beginning-of-items, menudiag-end-of-items): New commands. + (menudiag-make-menu-formatted-string): Bug fix. Use + menudiag-item-num-to-char. + (menudiag-goto-item): Rewrite. Better user interface. + (menudiag-char-to-item-num, menudiag-item-num-to-char): New + functions. + 1998-02-07 MORIOKA Tomohiko * leim-list-egg.el: Delete autoload setting for `egg-mode'. diff --git a/egg.el b/egg.el index d722a3a..c8403a0 100644 --- a/egg.el +++ b/egg.el @@ -1,21 +1,22 @@ ;;; egg.el --- EGG Input Method Architecture -;; Copyright (C) 1997 Mule Project, Powered by Electrotechnical +;; Copyright (C) 1997, 1998 Mule Project, Powered by Electrotechnical ;; Laboratory, JAPAN. ;; Project Leader: Satoru Tomura ;; Author: NIIBE Yutaka +;; KATAYAMA Yoshio ;; Maintainer: NIIBE Yutaka ;; Keywords: mule, multilingual, input method ;; This file will be part of GNU Emacs (in future). -;; GNU Emacs is free software; you can redistribute it and/or modify +;; 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. -;; GNU Emacs is distributed in the hope that it will be useful, +;; 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. @@ -31,8 +32,14 @@ (defvar egg-mode-preference t "Non-nil if modefull.") +(defvar egg-default-language "Japanese") +(defvar egg-last-method-name) +(make-variable-buffer-local 'egg-last-method-name) +(defvar egg-mode-line-title) +(make-variable-buffer-local 'egg-mode-line-title) + ;;;###autoload -(defun egg-mode (&optional arg) +(defun egg-mode (&rest arg) "Toggle EGG mode. \\[describe-bindings] " @@ -40,12 +47,22 @@ (if (null arg) ;; Turn off (progn + (cond + ((its-in-fence-p) + (its-exit-mode)) + ((egg-get-bunsetsu-info (point)) + (egg-exit-conversion))) (setq describe-current-input-method-function nil) (setq current-input-method nil) (let ((orig-local-map (keymap-parent (current-local-map)))) (use-local-map orig-local-map)) (run-hooks 'input-method-inactivate-hook)) ;; Turn on + (if (null (string= (car arg) egg-last-method-name)) + (progn + (funcall (nth 1 arg)) + (setq egg-default-language its-current-language))) + (setq egg-last-method-name (car arg)) (use-local-map (if egg-mode-preference (egg-modefull-map) (egg-modeless-map))) @@ -54,6 +71,14 @@ (run-hooks 'input-method-activate-hook)) (force-mode-line-update)) +(defun egg-set-mode-line-title (title) + (setq egg-mode-line-title title) + (force-mode-line-update)) + +(defun egg-check-language (lang) + (if (null (member lang egg-support-languages)) + (error "%S is not supported" lang))) + (defun egg-modefull-map () "Generate modefull keymap for EGG mode." (let ((map (make-sparse-keymap)) @@ -138,9 +163,6 @@ (setq ocolumn (current-column)) (funcall auto-fill-function))))) -(setq its-hira-period "$B!#(B") ; ". " "$B!%(B" "$B!#(B" -(setq its-hira-comma ", ") ; ", " "$B!$(B" "$B!"(B" - (require 'its) (require 'menudiag) (require 'egg-mlh) @@ -151,8 +173,8 @@ (defgroup egg nil "Tamagotchy --- EGG Versio 4.0") -(load-library "its/hira") -(setq-default its-current-map its-hira-map) +;;(load-library "its/hira") +;;(setq-default its-current-map its-hira-map) ;;(load-library "egg/wnn") ;;(load-library "egg/wnnrpc") @@ -162,6 +184,14 @@ ;;(load-library "egg/sj3") ;;(setq egg-conversion-backend sj3-conversion-backend) +(defvar egg-support-languages nil) + +(defun egg-set-support-languages (langs) + (while langs + (if (null (member (car langs) egg-support-languages)) + (setq egg-support-languages (cons (car langs) egg-support-languages))) + (setq langs (cdr langs)))) + (add-hook 'kill-emacs-hook 'egg-kill-emacs-function) (defun egg-kill-emacs-function () (egg-finalize-backend)) diff --git a/egg/sj3.el b/egg/sj3.el index cf05bfa..6f059a7 100644 --- a/egg/sj3.el +++ b/egg/sj3.el @@ -10,12 +10,12 @@ ;; This file will be part of GNU Emacs (in future). -;; GNU Emacs is free software; you can redistribute it and/or modify +;; 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. -;; GNU Emacs is distributed in the hope that it will be useful, +;; 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. @@ -29,6 +29,8 @@ ;;; Code: +(defconst sj3-support-languages '("Japanese")) + (defconst sj3-conversion-backend [ sj3-init @@ -166,7 +168,7 @@ (defun sj3-init () ) -(defun sj3-start-conversion (yomi) +(defun sj3-start-conversion (yomi lang) "Convert YOMI string to kanji, and enter conversion mode. Return the list of bunsetsu." (let ((env (sj3-get-environment))) @@ -220,10 +222,8 @@ Return the list of bunsetsu." (env (sj3bunsetsu-get-env b1)) yomi1 yomi2 bunsetsu1 bunsetsu2) - (save-match-data - (string-match (concat "^\\(" (make-string len ?.) "\\)\\(.*$\\)") yomi) - (setq yomi1 (match-string 1 yomi)) - (setq yomi2 (match-string 2 yomi))) + (setq yomi1 (substring yomi 0 len) + yomi2 (substring yomi len)) (setq bunsetsu1 (sj3rpc-tanbunsetsu-conversion env yomi1)) ;; Only set once. @@ -240,7 +240,7 @@ Return the list of bunsetsu." (list bunsetsu1)))) ;; XXX: Not implemented yet -(defun sj3-fini () +(defun sj3-fini (lang) ) ;;; setup @@ -249,10 +249,12 @@ Return the list of bunsetsu." (load "egg/sj3rpc") ;;;###autoload -(defun egg-activate-sj3 (&optional arg) +(defun egg-activate-sj3 (&rest arg) "Activate SJ3 backend of Tamagotchy." - (setq egg-conversion-backend sj3-conversion-backend) - (egg-mode arg) - ) + (egg-set-support-languages sj3-support-languages) + (egg-set-conversion-backend sj3-conversion-backend + sj3-support-languages + nil) + (apply 'egg-mode arg)) ;;; egg/sj3.el ends here. diff --git a/egg/sj3rpc.el b/egg/sj3rpc.el index 6ae09aa..c92dbb7 100644 --- a/egg/sj3rpc.el +++ b/egg/sj3rpc.el @@ -10,12 +10,12 @@ ;; This file will be part of GNU Emacs (in future). -;; GNU Emacs is free software; you can redistribute it and/or modify +;; 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. -;; GNU Emacs is distributed in the hope that it will be useful, +;; 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. @@ -33,7 +33,7 @@ (eval-when-compile (require 'egg-com) - (load-library "egg/sj3") +;; (load-library "egg/sj3") (defmacro sj3-const (c) (cond ((eq c 'OPEN) 1) ((eq c 'CLOSE) 2) diff --git a/egg/wnn.el b/egg/wnn.el index d043bf0..a07977e 100644 --- a/egg/wnn.el +++ b/egg/wnn.el @@ -1,21 +1,23 @@ ;;; egg/wnn.el --- WNN Support (high level interface) in Egg ;;; Input Method Architecture -;; Copyright (C) 1997 Mule Project, Powered by Electrotechnical +;; Copyright (C) 1997, 1998 Mule Project, Powered by Electrotechnical ;; Laboratory, JAPAN. ;; Project Leader: Satoru Tomura ;; Author: NIIBE Yutaka +;; KATAYAMA Yoshio ; Korean, Chinese support. +;; ;; Maintainer: NIIBE Yutaka -;; This file will be part of GNU Emacs (in future). +;; This file will be part of EGG (in future). -;; GNU Emacs is free software; you can redistribute it and/or modify +;; 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. -;; GNU Emacs is distributed in the hope that it will be useful, +;; 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. @@ -28,11 +30,13 @@ ;;; Commentary: ;;; Code: - (defgroup wnn nil "Wnn interface for Tamagotchy" :group 'egg) +(defconst wnn-support-languages + '("Japanese" "Chinese-GB" "Chinese-CNS" "Korean")) + (eval-when-compile (defmacro WNN-const (c) (cond ((eq c 'BUN_SENTOU) -1) @@ -60,10 +64,11 @@ wnn-fini ]) -;; ::= [ ] +;; ::= [ +;; ] -(defsubst wnnenv-create (proc env-id) - (vector proc env-id nil)) +(defsubst wnnenv-create (proc env-id server-type dic-set rev-flag) + (vector proc env-id server-type dic-set rev-flag nil)) (defsubst wnnenv-get-proc (env) (aref env 0)) @@ -71,10 +76,19 @@ (defsubst wnnenv-get-env-id (env) (aref env 1)) -(defsubst wnnenv-get-daibunsetsu-info (env) +(defsubst wnnenv-get-server-type (env) (aref env 2)) + +(defsubst wnnenv-get-dictionary-set (env) + (aref env 3)) + +(defsubst wnnenv-get-reverse-flag (env) + (aref env 4)) + +(defsubst wnnenv-get-daibunsetsu-info (env) + (aref env 5)) (defsubst wnnenv-set-daibunsetsu-info (env d) - (aset env 2 d)) + (aset env 5 d)) ;; ::= [ ;; @@ -136,21 +150,58 @@ (defsubst wnn-bunsetsu-set-zenkouho-pos (bunsetsu zp) (aset bunsetsu 18 zp)) -(defcustom wnn-server "localhost" - "Hostname of wnn server" - :group 'wnn - :type 'string) - -(defvar wnn-environment nil +(defvar wnn-environments nil "Environment for WNN kana-kanji conversion") +(defcustom wnn-jserver "localhost" "jserver host" :group 'wnn :type 'string) +(defcustom wnn-cserver "localhost" "cserver host" :group 'wnn :type 'string) +(defcustom wnn-tserver "localhost" "tserver host" :group 'wnn :type 'string) +(defcustom wnn-kserver "localhost" "kserver host" :group 'wnn :type 'string) + +;; The port number should be initialized from $WNNLIB/serverdefs by wnn-init +(defconst wnn-server-info-list + ;; language locale server port stream coding-system hostname + '(("Japanese" "ja_JP" jserver 22273 "Wnn" fixed-euc-jp wnn-jserver) + ("Chinese-GB" "zh_CN" cserver 22289 "cWnn" fixed-euc-cn wnn-cserver) + ("Chinese-CNS" "zh_TW" tserver 22321 "tWnn" fixed-euc-tw wnn-tserver) + ("Korean" "ko_KR" kserver 22305 "kWnn" fixed-euc-kr wnn-kserver))) + +(defun wnn-get-server-info (lang) + (let (info) + (if (null lang) + (setq lang its-current-language)) + (if (setq info (assoc lang wnn-server-info-list)) info + (assoc "Japanese" wnn-server-info-list)))) + +(defsubst wnn-server-locale (info) + (nth 1 info)) + +(defsubst wnn-server-type (info) + (nth 2 info)) + +(defsubst wnn-server-port (info) + (nth 3 info)) + +(defsubst wnn-server-stream-name (info) + (nth 4 info)) + +(defsubst wnn-server-buffer-name (info) + (concat " *" (wnn-server-stream-name info) "*")) + +(defsubst wnn-server-coding-system (info) + (nth 5 info)) + +(defsubst wnn-server-hostname (info) + (symbol-value (nth 6 info))) + (defun wnn-init () ) -(defun wnn-start-conversion (yomi) +(defun wnn-start-conversion (yomi &optional language dic-set reverse) "Convert YOMI string to kanji, and enter conversion mode. Return the list of bunsetsu." - (let* ((env (wnn-get-environment wnn-dictionary-specification)) + (let* ((server-info (wnn-get-server-info language)) + (env (wnn-get-environment server-info dic-set reverse)) (result (wnnrpc-renbunsetsu-conversion env yomi (WNN-const BUN_SENTOU) ""))) (wnnenv-set-daibunsetsu-info env (car result)) @@ -177,7 +228,7 @@ Return the list of bunsetsu." (let ((hash-table (make-vector 31 0)) ; XXX why 31? (l bunsetsu-list) (i 0) - n sym0 result p b sym) + (n 0) sym0 result p b sym) (setq sym0 (intern (wnn-get-bunsetsu-converted bunsetsu) hash-table)) (while l (setq b (car l) @@ -261,10 +312,8 @@ Return the list of bunsetsu." prev-fuzokugo "") (setq prev-hinshi (wnn-bunsetsu-get-hinshi b0) prev-fuzokugo (wnn-bunsetsu-get-fuzokugo b0))) - (save-match-data - (string-match (concat "^\\(" (make-string len ?.) "\\)\\(.*$\\)") yomi) - (setq yomi1 (match-string 1 yomi)) - (setq yomi2 (match-string 2 yomi))) + (setq yomi1 (substring yomi 0 len) + yomi2 (substring yomi len)) (setq bunsetsu1 (car (wnnrpc-tanbunsetsu-conversion env yomi1 prev-hinshi prev-fuzokugo))) @@ -275,15 +324,14 @@ Return the list of bunsetsu." (list b1 b2) (list b1)))) (if (< 0 (length yomi2)) - ;; RENBUNSETSU? XXX (setq bunsetsu2 - (car (wnnrpc-tanbunsetsu-conversion + (cdr (wnnrpc-renbunsetsu-conversion env yomi2 (wnn-bunsetsu-get-hinshi bunsetsu1) (wnn-bunsetsu-get-fuzokugo bunsetsu1)))) (setq bunsetsu2 nil)) (if bunsetsu2 - (list bunsetsu1 bunsetsu2) + (append (list bunsetsu1) bunsetsu2) (list bunsetsu1)))) @@ -299,42 +347,60 @@ Return the list of bunsetsu." (defvar wnn-sticky-environment-flag nil "*Flag which specifies sticky environment.") -(defun wnn-fini () ; XXX - (if (null wnn-environment) - nil - (condition-case nil - (progn - (if wnn-sticky-environment-flag - (wnnrpc-make-env-sticky wnn-environment) - (wnnrpc-make-env-unsticky wnn-environment)) - (wnnrpc-disconnect wnn-environment)) - (error nil)) - (let ((proc (wnnenv-get-proc wnn-environment))) - (if (eq (process-status proc) 'open) - (progn - (wnnrpc-close proc) - (kill-buffer (process-buffer proc)) - (delete-process proc)))) - (setq wnn-environment nil))) +(defun wnn-fini (lang) ; XXX + ; tamago-971009 version + ; argument LANG is still dummy + (if wnn-environments + (let ((l wnn-environments)) + (condition-case nil + (while l + (let ((env (car l))) + (if wnn-sticky-environment-flag + (wnnrpc-make-env-sticky env) + (wnnrpc-make-env-unsticky env)) + (wnnrpc-disconnect env) + (setq l (cdr l)))) + (error nil)) + (setq l wnn-environments) + (while l + (let ((proc (wnnenv-get-proc (car l)))) + (if (eq (process-status proc) 'open) + (progn + (wnnrpc-close proc) + (kill-buffer (process-buffer proc))) + (setq l (cdr l))))) + (setq wnn-environments nil)))) -;; XXX should be array (index: server) of {C,J,K}server -(defconst wnn-jserver-port 22273) ;; (defun wnn-comm-sentinel (proc reason) ; assume it is close - (kill-buffer (process-buffer proc)) - (delete-process proc) - (setq wnn-environment nil) - (message "WNN: connection closed")) + ; tamago-971009 version + (let ((l wnn-environments) + env l1) + (kill-buffer (process-buffer proc)) + ;; delete env from the list. + (while l + (setq env (car l)) + (if (eq proc (wnnenv-get-proc env)) + (progn + (if l1 + (setcdr l1 (cdr l)) + (setq wnn-environments (cdr l))) + (setq l (cdr l))) + (setq l1 l + l (cdr l)))))) ;; -(defun wnn-open (hostname language) +(defun wnn-open (server-info) "Establish the connection to WNN server. Return process object." - ;; Specifying language (jserver/cserver/kserver), - ;; open the session to WNN server, - (let ((buf (generate-new-buffer " *WNN*")) - proc result) + ;; Open the session to WNN server, + (let ((buf (generate-new-buffer (wnn-server-buffer-name server-info))) + (hostname (wnn-server-hostname server-info)) + proc result) (condition-case result - (setq proc (open-network-stream "WNN" buf hostname wnn-jserver-port)) + (setq proc (open-network-stream (wnn-server-stream-name server-info) + buf + hostname + (wnn-server-port server-info))) (error (progn (kill-buffer buf) (signal (car result) (cdr result))))) @@ -346,33 +412,141 @@ Return the list of bunsetsu." (set-buffer buf) (erase-buffer) (buffer-disable-undo) - (setq enable-multibyte-characters nil)) - (setq result (wnnrpc-open proc (system-name) (user-login-name))) + (setq enable-multibyte-characters nil + egg-fixed-euc (wnn-server-coding-system server-info))) + (setq result (wnnrpc-open proc + (if (equal hostname "localhost") + "unix" + (system-name)) + (user-login-name))) (if (< result 0) (let ((msg (wnnrpc-get-error-message (- result)))) (delete-process proc) (kill-buffer buf) - (error "Can't open WNN session (%s %s): %s" hostname language msg)) + (error "Can't open WNN session (%s %S): %s" + hostname + (wnn-server-type server-info) msg)) proc))) -(defvar wnn-dictionary-specification - '([2 10 2 45 100 200 5 1 40 0 -100 200 -100 200 80 200 200] - "pubdic/full.fzk" - ["pubdic/kihon.dic" ("kihon.h") 5 nil t] - ["pubdic/setsuji.dic" ("setsuji.h") 5 nil t] - ["pubdic/koyuu.dic" ("koyuu.h") 1 nil t] - ["pubdic/chimei.dic" ("chimei.h") 1 nil t] - ["pubdic/jinmei.dic" ("jinmei.h") 1 nil t] - ["pubdic/special.dic" ("special.h") 5 nil t] - ["pubdic/computer.dic" ("computer.h") 5 nil t] - ["pubdic/symbol.dic" ("symbol.h") 1 nil t] - ["pubdic/tankan.dic" ("tankan.h") 1 nil t] - ["pubdic/bio.dic" ("bio.h") 1 nil t] - ["gerodic/g-jinmei.dic" ("g-jinmei.h") 1 nil t] - ["wnncons/tankan2.dic" ("tankan2.h") 1 nil t] - ["wnncons/tankan3.dic" ("tankan3.h") 1 nil t] - [("ud") nil 5 t t]) - "") +(defvar wnn-dictionary-specification-list + '((jserver + (nil nil "" + [2 10 2 45 100 200 5 1 40 -100 200 -100 200 80 200 200 200] + "pubdic/full.fzk" + ["pubdic/kihon.dic" ("kihon.h") 5 nil t] + ["pubdic/setsuji.dic" ("setsuji.h") 5 nil t] + ["pubdic/koyuu.dic" ("koyuu.h") 1 nil t] + ["pubdic/chimei.dic" ("chimei.h") 1 nil t] + ["pubdic/jinmei.dic" ("jinmei.h") 1 nil t] + ["pubdic/special.dic" ("special.h") 5 nil t] + ["pubdic/computer.dic" ("computer.h") 5 nil t] + ["pubdic/symbol.dic" ("symbol.h") 1 nil t] + ["pubdic/tankan.dic" nil 1 nil nil] + ["pubdic/bio.dic" ("bio.h") 1 nil t] + ["gerodic/g-jinmei.dic" ("g-jinmei.h") 1 nil t] + ["wnncons/tankan2.dic" nil 1 nil nil] + ["wnncons/tankan3.dic" nil 1 nil nil] + [("ud") nil 5 t t]) + (nil t "R" + [2 10 2 45 1 80 5 1 50 -20 400 -10 100 -100 200 0 200] + "pubdic/full.fzk" + ["pubdic/kihon.dic" ("kihon.h") 5 nil t] + ["pubdic/setsuji.dic" ("setsuji.h") 5 nil t] + ["pubdic/koyuu.dic" ("koyuu.h") 1 nil t] + ["pubdic/chimei.dic" ("chimei.h") 1 nil t] + ["pubdic/jinmei.dic" ("jinmei.h") 1 nil t] + ["pubdic/special.dic" ("special.h") 5 nil t] + ["pubdic/computer.dic" ("computer.h") 5 nil t] + ["pubdic/symbol.dic" ("symbol.h") 1 nil t] + ["pubdic/tankan.dic" nil 1 nil nil] + ["pubdic/bio.dic" ("bio.h") 1 nil t] + ["gerodic/g-jinmei.dic" ("g-jinmei.h") 1 nil t] + ["wnncons/tankan2.dic" nil 1 nil nil] + ["wnncons/tankan3.dic" nil 1 nil nil] + [("ud") nil 5 t t])) + (cserver + (Q nil "Q" + nil + "sys/full.con" + ["sys/QianMa.dic" nil 1 nil nil]) + (W nil "W" + nil + "sys/full.con" + ["sys/WuBi.dic" nil 1 nil nil]) + (nil nil "PZ" + [1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0] + "sys/full.con" + ["sys/level_1.dic" ("level_1.h") 4 nil t] + ["sys/level_2.dic" ("level_2.h") 1 nil t] + ["sys/basic.dic" ("basic.h") 7 nil t] + ["sys/computer.dic" ("computer.h") 4 nil t] + ["sys/cwnn.dic" ("cwnn.h") 4 nil t] + [("ud") nil 5 t t]) + (Q t "QR" + nil + "sys/full.conR" + ["sys/QianMa.dic" nil 1 nil nil]) + (W t "WR" + nil + "sys/full.conR" + ["sys/WuBi.dic" nil 1 nil nil]) + (nil t "PZR" + [1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0] + "sys/full.conR" + ["sys/level_1.dic" ("level_1.h") 4 nil t] + ["sys/level_2.dic" ("level_2.h") 1 nil t] + ["sys/basic.dic" ("basic.h") 7 nil t] + ["sys/computer.dic" ("computer.h") 4 nil t] + ["sys/cwnn.dic" ("cwnn.h") 4 nil t] + [("ud") nil 5 t t])) + (tserver + (nil nil "" + [1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0] + "sys/full.con" + ["sys/cns_ch.dic" ("cns_ch.h") 4 nil t] + ["sys/cns_wd.dic" ("cns_wd.h") 1 nil t] + [("ud") nil 5 t t]) + (nil t "R" + [1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0] + "sys/full.conR" + ["sys/cns_ch.dic" ("cns_ch.h") 4 nil t] + ["sys/cns_wd.dic" ("cns_wd.h") 1 nil t] + [("ud") nil 5 t t])) + (kserver + (nil nil "" + [2 5 2 45 200 80 5 1 40 0 400 -100 400 80 200 2 200] + "sys/full.fzk" + ["sys/hword.dic" ("hword.h") 5 nil t] + ["sys/single.dic" ("single.h") 1 nil t] + [("ud") nil 2 t t]) + (nil t "R" + [2 10 2 45 1 80 5 1 50 -20 400 -10 100 -100 200 0 200] + "sys/full.fzk" + ["sys/hword.dic" ("hword.h") 5 nil t] + ["sys/single.dic" ("single.h") 1 nil t] + [("ud") nil 2 t t])))) + +(defsubst wnn-get-dic-spec (server) + (cdr (assoc server wnn-dictionary-specification-list))) + +(defsubst wnn-dic-spec-dic-set (spec) + (nth 0 spec)) + +(defsubst wnn-dic-spec-reverse (spec) + (nth 1 spec)) + +(defsubst wnn-dic-spec-name (spec) + (nth 2 spec)) + +(defsubst wnn-dic-spec-param (spec) + (nth 3 spec)) + +(defsubst wnn-dic-spec-fuzokugo (spec) + (nth 4 spec)) + +(defsubst wnn-dic-spec-dic-list (spec) + (nthcdr 5 spec)) + (defcustom wnn-usr-dic-dir (concat "usr/" (user-login-name)) "*Directory of user dictionary for Wnn." @@ -520,48 +694,77 @@ On failure, return negate-encoded error code." (wnnrpc-open-file proc env-id freqname)) ; XXX: error? -1)) -(defun wnn-get-environment (dic-spec) - "Return WNN Environemt. If none, create new environment. -Take one argument DIC-SPEC for dictionary specification." - (if wnn-environment - wnn-environment - (let ((username (user-login-name)) - (proc (wnn-open wnn-server "ja_JP"))) - (setq wnn-environment - (wnn-create-environment proc username nil dic-spec))))) - -(defun wnn-create-environment (proc username reverse-flag spec) +(defun wnn-get-environment (server-info &optional dic-set reverse) + "Return WNN Environemt for the conversion server specified +by SERVER-INFO. If none, create new environment. Optional +argument DIC-SET specifies dictionary set. Optional argument +REVERSE specifies reverse conversion, if non nil." + (let ((server-type (wnn-server-type server-info)) + (env wnn-environments) + proc spec e s) + (setq reverse (null (null reverse))) + (if (catch 'found + (while env + (setq e (car env)) + (if (and (eq (wnnenv-get-server-type e) server-type) + (eq (wnnenv-get-dictionary-set e) dic-set) + (eq (wnnenv-get-reverse-flag e) reverse)) + (throw 'found t)) + (setq env (cdr env)))) + e + (setq proc (wnn-open server-info) + spec (wnn-get-dic-spec server-type)) + (while spec + (setq s (car spec) + e (wnn-create-environment proc server-type s) + wnn-environments (cons e wnn-environments)) + (if (and (eq (wnn-dic-spec-dic-set s) dic-set) + (eq (wnn-dic-spec-reverse s) reverse)) + (setq env e)) + (setq spec (cdr spec))) + env))) + +(defun wnn-create-environment (proc server-type spec) "" ;; Create new data structure: something like wnn_buf ;; Process, Environment-ID and Daibunsetsu-info. - (let (env env-id parameters) - (setq env-id (wnnrpc-connect proc username)) + (let (env-id parameters filename fuzokugo-fid ret dic-set reverse) + (setq env-id (wnnrpc-connect proc (wnn-make-env-name spec))) (if (< env-id 0) - (let ((msg (wnnrpc-get-error-message (- env-id)))) - (error "Can't connect new WNN environment: %s" msg))) - (setq parameters (car spec)) - (setq spec (cdr spec)) - (let ((filename (wnn-filename (car spec))) - fuzokugo-fid ret) - (setq fuzokugo-fid (wnn-open-file proc env-id filename)) - (if (null fuzokugo-fid) - (setq fuzokugo-fid -1) - (if (< fuzokugo-fid 0) - (let ((msg (wnnrpc-get-error-message (- fuzokugo-fid)))) - (message "WNN: Can't open fuzokugo file (%s): %s" filename msg) - (setq fuzokugo-fid -1)))) - (setq ret (wnnrpc-set-fuzokugo-file proc env-id fuzokugo-fid)) - (if (< ret 0) - (let ((msg (wnnrpc-get-error-message (- ret)))) - (message "WNN: Error on setting fuzokugo (%s): %s" filename msg)))) - (setq spec (cdr spec)) + (error "Can't connect new WNN environment: %s" + (wnnrpc-get-error-message (- env-id)))) + (setq dic-set (wnn-dic-spec-dic-set spec) + reverse (wnn-dic-spec-reverse spec) + parameters (wnn-dic-spec-param spec) + filename (wnn-filename (wnn-dic-spec-fuzokugo spec)) + fuzokugo-fid (wnn-open-file proc env-id filename)) + (if (null fuzokugo-fid) + (setq fuzokugo-fid -1) + (if (< fuzokugo-fid 0) + (progn + (message "WNN: Can't open fuzokugo file (%s): %s" + filename + (wnnrpc-get-error-message (- fuzokugo-fid))) + (setq fuzokugo-fid -1)))) + (setq ret (wnnrpc-set-fuzokugo-file proc env-id fuzokugo-fid)) + (if (< ret 0) + (let ((msg (wnnrpc-get-error-message (- ret)))) + (message "WNN: Error on setting fuzokugo (%s): %s" filename msg))) + (setq spec (wnn-dic-spec-dic-list spec)) (while spec - (let ((dic-spec (car spec))) - (wnn-set-dictionary proc env-id reverse-flag dic-spec) - (setq spec (cdr spec)))) - (wnnrpc-set-conversion-parameters proc env-id parameters) - (setq env (wnnenv-create proc env-id)) - env)) + (wnn-set-dictionary proc env-id reverse (car spec)) + (setq spec (cdr spec))) + (if parameters + (wnnrpc-set-conversion-parameters proc env-id parameters)) + (wnnenv-create proc env-id server-type dic-set reverse))) + +(defvar wnn-user-name nil) + +(defun wnn-make-env-name (spec) + (or wnn-user-name + (setq wnn-user-name (getenv "WNNUSER")) + (setq wnn-user-name (user-login-name))) + (concat wnn-user-name (wnn-dic-spec-name spec))) (defun wnn-update-frequency (env bunsetsu-info-list) (let ((l bunsetsu-info-list)) @@ -671,17 +874,18 @@ Take one argument DIC-SPEC for dictionary specification." (wnnrpc-add-word env dic-number yomi kanji comment hinshi-id initial-freq))) - ;;; setup (require 'egg) (load "egg/wnnrpc") ;;;###autoload -(defun egg-activate-wnn (&optional arg) +(defun egg-activate-wnn (&rest arg) "Activate Wnn backend of Tamagotchy." - (setq egg-conversion-backend wnn-conversion-backend) - (egg-mode arg) - ) + (egg-set-support-languages wnn-support-languages) + (egg-set-conversion-backend wnn-conversion-backend + (list (nth 2 arg)) + wnn-support-languages) + (apply 'egg-mode arg)) ;;; egg/wnn.el ends here. diff --git a/egg/wnnrpc.el b/egg/wnnrpc.el index 901d088..723453a 100644 --- a/egg/wnnrpc.el +++ b/egg/wnnrpc.el @@ -1,21 +1,23 @@ ;;; egg/wnnrpc.el --- WNN Support (low level interface) in Egg ;;; Input Method Architecture -;; Copyright (C) 1997 Mule Project, Powered by Electrotechnical +;; Copyright (C) 1997, 1998 Mule Project, Powered by Electrotechnical ;; Laboratory, JAPAN. ;; Project Leader: Satoru Tomura ;; Author: NIIBE Yutaka +;; KATAYAMA Yoshio ; Korean, Chinese support. +;; ;; Maintainer: NIIBE Yutaka ;; This file will be part of GNU Emacs (in future). -;; GNU Emacs is free software; you can redistribute it and/or modify +;; 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. -;; GNU Emacs is distributed in the hope that it will be useful, +;; 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. @@ -31,7 +33,7 @@ (eval-when-compile (require 'egg-com) - (load-library "egg/wnn") + ;; (load-library "egg/wnn") (defmacro wnn-const (c) "Macro for WNN constants." (cond ((eq c 'JS_VERSION) 0) @@ -104,135 +106,500 @@ ((eq c 'WNN_MAX_FILE_OF_AN_ENV) 60)))) (defconst wnnrpc-error-message - [ - 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" -] + '(("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" + ]) + ("Chinese-GB" . + [ + nil + "$AND<~2;4fTZ(B" + nil + "$ADZ4f(Balloc$AJ'0\(B" + nil + "$A2;JGWV5d(B" + "$A2;JGF56HND<~(B" + "$A2;JGND7(ND<~(B" + nil + "$AWV5d1m8qBz(B" + "$AF56HND<~#:2;JGV86(5DWV5d5DF56HND<~(B" + nil + nil + nil + nil + nil + "$AND<~2;D\4r?*(B" + "$A2;JGU}H75DF56HND<~(B" + "$A2;JGU}H75DND7(ND<~(B" + "$A8=JtSo5D8vJ}!"OrA?3$6H5H3,9}(B" + "$AUb8v:EBk5DWV5d!"C;SPJ9SC(B" + nil + nil + nil + "$AND7(ND<~5DDZH]2;U}H7(B" + "$APiDb4JPT:EBkRl3#(Bcixing.data$A2;U}H7(B" + "$AN46(Re5D4JPT!"6(ReAKG06K4JPT(B" + "$AND7(ND<~2;D\6AH!(B" + nil + nil + "$AWV5d5DOnJ}3,9}(B" + "$A1d;;:sWV7{4.5D3$6H3,9}(B" + "$A8=JtSo=bNvSr2;9;(B" + nil + "$A4N:n29Sr2;9;(B" + "$A:n29(B 1$A8vR2C;SP(B" + nil + nil + nil + nil + "$A6ARt3$6H3,9}(B" + "$A::WV3$6H3,9}(B" + "$AV86(5DWV5d!"2;D\5GB<(B" + "$A6ARt5D3$6HJG(B0" + "$AV86(5DWV5d!"2;D\Df2i(B" + "$AV;6A5DWV5d!"5GB<(B/$AO{3}AK(B" + "$A;7>3VP2;4fTZ5DWV5d!"5GB2;7{(B" + "$A2;JG#c#W#n#nSC;'Iz3I5D;7>3(B" + nil + nil + nil + nil + nil + "$AWSD?B<2;D\44=((B" + nil + nil + nil + nil + nil + nil + nil + nil + nil + "$AND<~2;D\6AH!(B" + "$AND<~2;D\P43v(B" + "$A2;JG#c#W#n#nSC;'?I6AH!5DND<~(B" + "$ARTIO5DND<~2;D\6AH!(B" + "password$A2;6T(B" + "$AND<~U}TZ6AH!(B" + "$AND<~2;D\O{3}(B" + "$AND<~C;SP44=(3v@4(B" + "$A2;JG#c#W#n#n5DND<~(B" + "$AND<~5D(BI-node$A:M(BFILE_UNIQ$A2;D\R;VB(B" + "$A4JPTND<~L+4s(B" + "$A4JPTND<~L+4s(B" + "$A4JPTND<~2;4fTZ(B" + "$A4JPTND<~5DDZH]2;6T(B" + nil + "$A4JPTND<~2;D\6AH!(B" + "$A4JPTC{2;6T(B" + "$A4JPT:EBk2;6T(B" + nil + "$AUb8v2YWw2;V'3V(B" + "password$A5DJdHkND<~2;D\4r?*(B" + "uumrc$AND<~2;4fTZ(B" + "uumrc$AND<~5DPNJ=4mNs(B" + "$ARTIO;7>32;D\44=((B" + "$AUb8v#c#W#n#nSC;'!"6AH!5DND<~C;SP(B" + "$AWV5d5DF56HND<~C;SP(B" + "password$A5DND<~C;SP44=(3v@4(B" + ]) + ("Chinese-CNS" . + [ + nil + "$(GEFG5DbGtGc(B" + nil + "$(GDyGt(Balloc$(GFBZu(B" + nil + "$(GDbQRGsL((B" + "$(GDbQRs"PyEFG5(B" + "$(GDbQREFNNEFG5(B" + nil + "$(GGsL(OPV*iH(B" + "$(Gs"PyEFG5!3DbQRQ@LyN{GsL(N{s"PyEFG5(B" + nil + nil + nil + nil + nil + "$(GEFG5DbWdFTbd(B" + "$(GDbQRF_m}N{s"PyEFG5(B" + "$(GDbQRF_m}N{EFNNEFG5(B" + "$(GOazhk#N{T6m0!#GWbXO[Pya+b>g4(B" + "$(G]UT6f@n#N{GsL(!#JtH4KpFn(B" + nil + nil + nil + "$(GEFNNEFG5N{DyU)DbF_m}(B" + "$(Gapsib$MLf@n#\,Z&(Bcixing.data$(GDbF_m}(B" + "$(GF\LyexN{b$ML!#LyexD'P)j&b$ML(B" + "$(GEFNNEFG5DbWd{tL=(B" + nil + nil + "$(GGsL(N{bzm0b>g4(B" + "$(G|H_PG[Gs\JHkN{O[Pyb>g4(B" + "$(GOazhk#fXN5YQDbY\(B" + nil + "$(GH9OlfPYQDbY\(B" + "$(GOlfP(B 1$(GT6D>JtH4(B" + nil + nil + nil + nil + "$(G{tSvO[Pyb>g4(B" + "$(GiGGsO[Pyb>g4(B" + "$(GQ@LyN{GsL(!#DbWd`trg(B" + "$(G{tSvN{O[PyQR(B0" + "$(GQ@LyN{GsL(!#DbWdXKQg(B" + "$(GF7{tN{GsL(!#`trg(B/$(GVJ=@4O4Y(B" + nil + "$(C8^8p8.(B alloc $(C?!<-(B $(C=GFPG_@>4O4Y(B" + nil + "$(C;g@|@L(B $(C>F4U4O4Y(B" + "$(C:s55(B $(CH-@O@L(B $(C>F4U4O4Y(B" + "$(C:Nn(B $(CH-@O@L(B $(C>F4U4O4Y(B" + nil + "$(C;g@|(B $(CEW@L:m@L(B $(C2K(B $(CC!@>4O4Y(B" + "$(CAvA$5H(B $(C;g@|@G(B $(C:s55(B $(CH-@O@L(B $(C>F4U4O4Y(B" + nil + nil + nil + nil + nil + "$(CH-@O@;(B $(C?-(B $(Cx@>4O4Y(B" + "$(C8B4B(B $(C:s55(B $(CH-@O@L(B $(C>F4U4O4Y(B" + "$(C8B4B(B $(C:Nn(B $(CH-@O@L(B $(C>F4U4O4Y(B" + "$(C:Nn@G(B $(C09J=@4O4Y(B" + nil + nil + nil + "$(C:Nn(B $(CH-@O@G(B $(C3;?k@L(B $(C8BAv(B $(C>J=@4O4Y(B" + "$(C0!;s(B $(CG0;g@G(B $(C9xH#0!(B $(CF2834O4Y(B. hinsi.data $(C0!(B $(C8BAv(B $(C>J=@4O4Y(B" + "$(C9LA$@G@G(B $(CG0;g0!(B $(C@|4\(B $(CG0;g7N(B $(CA$@G5G>n(B $(C@V=@4O4Y(B" + "$(C:Nn(B $(CH-@O@L(B $(C@PGtA.(B $(C@VAv(B $(C>J=@4O4Y(B" + nil + nil + "$(C;g@|@G(B $(C?#F.8.0!(B $(C3J9+(B $(C89=@4O4Y(B" + "$(C:/H/GO7A4B(B $(C9.@Z?-@L(B $(C3J9+(B $(C1i4O4Y(B" + "$(C:Nn(B $(CGX<.(B $(C?5?*@L(B $(C:NA7GU4O4Y(B" + nil + "$(C4Y@=(B $(CHD:8(B $(C?5?*@L(B $(C:NA7GU4O4Y(B" + "$(CHD:80!(B $(C>x@>4O4Y(B" + nil + nil + nil + nil + "$(CGQ1[@L(B $(C3J9+(B $(C1i4O4Y(B" + "$(CGQ@Z0!(B $(C3J9+(B $(C1i4O4Y(B" + "$(CAvA$5H(B $(C;g@|@:(B $(C5n7O(B $(C:R0!4I@T4O4Y(B" + "$(CGQ1[@G(B $(C1f@L0!(B 0 $(C@T4O4Y(B" + "$(CAvA$5H(B $(C;g@|@:(B $(C?*B|A6(B $(C:R0!4I@T4O4Y(B" + "$(C@P1b@|?k(B $(C;g@|?!(B $(C5n7O(B/$(C4O4Y(B" + "$(CA8@gGOAv(B $(C>J4B(B $(C;g@|?!(B $(C5n7O(B $(CGO7A0m(B $(CG_@>4O4Y(B" + nil + nil + "$(C@P1b@|?k(B $(C:s558&(B $(C0f=E(B $(CGO7A0m(B $(CG_@>4O4Y(B" + "$(CAvA$5H(B $(C4\>n4B(B $(CA8@gGOAv(B $(C>J=@4O4Y(B" + nil + nil + nil + nil + nil + nil + nil + nil + nil + "$(C8^8p8.(B alloc $(C?!(B $(C=GFPG_@>4O4Y(B" + nil + nil + nil + nil + nil + nil + nil + "$(C?!7/0!(B $(C9_;}G_@>4O4Y(B" + "$(C9v1W(B(Bug)$(C0!(B $(C9_;}G_@>4O4Y(B" + "$(C<-9v(B(Server)$(C0!(B $(CAW>n(B $(C@V@>4O4Y(B" + "alloc$(C?!(B $(C=GFPG_@>4O4Y(B" + "$(C<-9v(B(Server) $(C?M(B $(CA"CKGR(B $(Cx@>4O4Y(B" + "$(CEk=E(B $(CGA7NEdD]@G(B $(C9vA/@L(B $(C8BAv(B $(C>J=@4O4Y(B" + "$(CE,6s@L>HF.0!(B $(C;}<:GQ(B $(CH/0f@L(B $(C>F4U4O4Y(B" + nil + nil + nil + nil + nil + "$(C5p7:Ed8.8&(B $(C885i(B $(Cx@>4O4Y(B" + nil + nil + nil + nil + nil + nil + nil + nil + nil + "$(CH-@O(B $(C@P1b?!(B $(C=GFPG_@>4O4Y(B" + "$(CH-@O(B $(C>21b?!(B $(C=GFPG_@>4O4Y(B" + "$(CE,6s@L>HF.0!(B $(C@P>n(B $(C5e80(B $(CH-@O@L(B $(C>F4U4O4Y(B" + "$(C4u(B $(C@L;s@G(B $(CH-@O@;(B $(C@P>n(B $(C5e81(B $(Cx@>4O4Y(B" + "$(CFP=:?v5e0!(B $(CF2834O4Y(B" + "$(CH-@O@L(B $(C@PGtA.(B $(C@V@>4O4Y(B" + "$(CH-@O@;(B $(Cx@>4O4Y(B" + "$(CH-@O@;(B $(C@[<:GR(B $(Cx@>4O4Y(B" + "kWnn$(C@G(B $(CH-@O@L(B $(C>F4U4O4Y(B" + "$(CH-@O@G(B I-node $(C?M(B FILE_UNIQ $(C8&(B $(C@OD!=CE3(B $(Cx@>4O4Y(B" + "$(CG0;g(B $(CH-@O@G(B $(CE)1b0!(B $(C3J9+(B $(CE.4O4Y(B" + "$(CG0;g(B $(CH-@O@G(B $(CE)1b0!(B $(C3J9+(B $(CE.4O4Y(B" + "$(CG0;g(B $(CH-@O@L(B $(CA8@gGOAv(B $(C>J=@4O4Y(B" + "$(CG0;g(B $(CH-@O@G(B $(C3;?k@L(B $(CF2834O4Y(B" + nil + "$(CG0;g(B $(CH-@O@L(B $(C@PGtA.(B $(C@VAv(B $(C>J=@4O4Y(B" + "$(CG0;g(B $(C@L8'@L(B $(CF2834O4Y(B" + "$(CG0;g(B $(C9xH#0!(B $(CF2834O4Y(B" + nil + "$(C1W(B $(CA6@[@:(B $(CAv?x5GAv(B $(C>J=@4O4Y(B" + "$(CFP=:?v5e0!(B $(C5i>n@V4B(B $(CH-@O@;(B $(C?-(B $(Cx@>4O4Y(B" + "uumrc $(C@L(B $(CA8@gGOAv(B $(C>J=@4O4Y(B" + "uumrc $(C@G(B $(CG|=D@L(B $(CF2834O4Y(B" + "$(C@L(B $(C@L;s(B $(CH/0f@;(B $(C@[<:GR(B $(Cx@>4O4Y(B" + "$(CE)6s@L>HF.0!(B $(C@P>n(B $(C5e80(B $(CH-@O@L(B $(C>F4U4O4Y(B" + "$(C;g@|?!(B $(C:s55(B $(CH-@O@L(B $(CA8@gGOAv(B $(C>J=@4O4Y(B" + "$(CFP=:?v5e(B $(CH-@O@;(B $(C@[<:GR(B $(Cx@>4O4Y(B" + ])) "Array of WNN error messages. Indexed by error code.") (defun wnnrpc-get-error-message (errno) "Return error message string specified by ERRNO." - (or (aref wnnrpc-error-message errno) (format "#%d" errno))) + (let ((msg (or (assoc egg-default-language wnnrpc-error-message) + (assoc its-current-language wnnrpc-error-message) + (assoc "Japanese" wnnrpc-error-message)))) + (or (aref (cdr msg) errno) (format "#%d" errno)))) (defmacro wnnrpc-call-with-environment (e vlist send-expr &rest receive-exprs) (let ((v (append `((proc (wnnenv-get-proc ,e)) - (env-id (wnnenv-get-env-id ,e))) + (env-id (wnnenv-get-env-id ,e)) + (egg-zhuyin its-zhuyin)) vlist))) (list 'let v diff --git a/leim-list-egg.el b/leim-list-egg.el index 089fa66..8eae19b 100644 --- a/leim-list-egg.el +++ b/leim-list-egg.el @@ -5,8 +5,37 @@ (register-input-method "japanese-egg-wnn" "Japanese" 'egg-activate-wnn - "A$B$"(B" "Romaji -> Hiragana -> Kanji&Kana") + 'egg-mode-line-title "Romaji -> Hiragana -> Kanji&Kana" + 'its-select-hiragana "Japanese") (register-input-method "japanese-egg-sj3" "Japanese" 'egg-activate-sj3 - "A$B$"(B" "Romaji -> Hiragana -> Kanji&Kana") + 'egg-mode-line-title "Romaji -> Hiragana -> Kanji&Kana" + 'its-select-hiragana "Japanese") + +(register-input-method + "chinese-gb-egg-wnn-py" "Chinese-GB" 'egg-activate-wnn + 'egg-mode-line-title "Pinyin -> Simplified Hanzi" + 'its-select-pinyin-cn "Chinese-GB") + +(register-input-method + "chinese-gb-egg-wnn-zy" "Chinese-GB" 'egg-activate-wnn + 'egg-mode-line-title "Zhunyin -> Simplified Hanzi" + 'its-select-zhuyin-cn "Chinese-GB") + +(register-input-method + "chinese-cns-egg-wnn-py" "Chinese-CNS" 'egg-activate-wnn + 'egg-mode-line-title "Pinyin -> Traditional Hanzi" + 'its-select-pinyin-tw "Chinese-CNS") + +(register-input-method + "chinese-cns-egg-wnn-zy" "Chinese-CNS" 'egg-activate-wnn + 'egg-mode-line-title "Zhunyin -> Traditional Hanzi" + 'its-select-zhuyin-tw "Chinese-CNS") + +(register-input-method + "korean-egg-wnn" "Korean" 'egg-activate-wnn + 'egg-mode-line-title "Hangul -> Hanja" + 'its-select-hangul "Korean") + +(autoload 'egg-mode "egg" "Toggle EGG mode." t) diff --git a/menudiag.el b/menudiag.el index 639401a..a8a57de 100644 --- a/menudiag.el +++ b/menudiag.el @@ -51,7 +51,11 @@ (defvar menudiag-mode-map (let ((map (make-keymap)) (ch 0)) - (while (< ch 127) + (while (< ch 27) + (define-key map (char-to-string ch) 'undefined) + (setq ch (1+ ch))) + (setq ch 28) + (while (< ch 255) (define-key map (char-to-string ch) 'undefined) (setq ch (1+ ch))) (setq ch ?0) @@ -68,6 +72,8 @@ (setq ch (1+ ch))) (define-key map "\C-a" 'menudiag-beginning-of-line) (define-key map "\C-e" 'menudiag-end-of-line) + (define-key map "\M-<" 'menudiag-beginning-of-items) + (define-key map "\M->" 'menudiag-end-of-items) (define-key map "\C-f" 'menudiag-forward-item) (define-key map "\C-b" 'menudiag-backward-item) (define-key map "\C-n" 'menudiag-next-line) @@ -177,19 +183,39 @@ (mapconcat (function (lambda (item) (setq i (1+ i)) - (format " %x.%s" i (menudiag-item-string item)))) + (format " %c.%s" (menudiag-item-num-to-char i) + (menudiag-item-string item)))) item-list ""))) + +;; ITEM No --> Character +(defun menudiag-item-num-to-char (num) + (let ((char)) + (cond ((<= num 9) + (setq char (+ ?0 num))) + (t + (setq char (+ ?a (- num 10)))) + ) + char)) + +;; Character --> ITEM No +(defun menudiag-char-to-item-num (char) + (let ((num)) + (cond ((and (<= ?0 ch) (<= ch ?9)) + (setq num (- ch ?0))) + ((and (<= ?a ch) (<= ch ?z)) + (setq num (+ 10 (- ch ?a)))) + ((and (<= ?A ch) (<= ch ?Z)) + (setq num (+ 10 (- ch ?A)))) + (t (setq num 1000))) + num)) + + (defun menudiag-goto-item () (interactive) (let ((ch last-command-char) (n 0)) - (cond ((and (<= ?0 ch) (<= ch ?9)) - (setq n (- ch ?0))) - ((and (<= ?a ch) (<= ch ?z)) - (setq n (+ 10 (- ch ?a)))) - ((and (<= ?A ch) (<= ch ?Z)) - (setq n (+ 10 (- ch ?A))))) + (setq n (menudiag-char-to-item-num ch)) (if (>= n (length line)) (error "No such item") (menudiag-goto-item-internal n)))) @@ -204,6 +230,16 @@ (setq i (1+ i))) (goto-char p))) +(defun menudiag-beginning-of-items () + (interactive) + (menudiag-goto-line 0) + (menudiag-beginning-of-line)) + +(defun menudiag-end-of-items () + (interactive) + (menudiag-goto-line (1- (length selection-list))) + (menudiag-end-of-line)) + (defun menudiag-beginning-of-line () (interactive) (menudiag-goto-item-internal 0)) -- 1.7.10.4