diff -Nru egg-4.1.8/ATTIC/egg-com.el egg-4.2.0/ATTIC/egg-com.el --- egg-4.1.8/ATTIC/egg-com.el 1970-01-01 00:00:00.000000000 +0000 +++ egg-4.2.0/ATTIC/egg-com.el 2015-04-30 00:13:12.000000000 +0000 @@ -0,0 +1,328 @@ +;;; 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: +(eval-when-compile + (setq byte-compile-warnings '(obsolete redefine callargs)); free-vars unresolved +) + +(declare-function egg-error (message &rest args) + "egg.el" nil) + +(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 + +(define-charset 'fixed-euc-jp + "Fixed EUC Japanese" + :dimension 2 + :superset '(ascii + (katakana-jisx0201 . #x80) + (japanese-jisx0208 . #x8080) + (japanese-jisx0212 . #x8000))) + +(define-coding-system 'fixed-euc-jp + "Coding System for fixed EUC Japanese" + :mnemonic ?W + :coding-type 'charset + :charset-list '(fixed-euc-jp)) + +(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. + (Note: Elisp's integer may be greater than 32 bits) +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)) + (egg-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)) + (egg-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-i32 () + (progn + (comm-require-process-output 4) + (+ (lsh (- (logxor (comm-following+forward-char) 128) 128) 24) + (lsh (comm-following+forward-char) 16) + (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-i32))) + ((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)) + (with-current-buffer buffer + (let ,euc-select + (erase-buffer) + ,send-expr + (goto-char (point-max)) + (process-send-region proc (point-min) (point-max)) + ,@receive-exprs)) + (egg-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 'egg-com) +;;; egg-com.el ends here. diff -Nru egg-4.1.8/ATTIC/egg-sj3.el egg-4.2.0/ATTIC/egg-sj3.el --- egg-4.1.8/ATTIC/egg-sj3.el 1970-01-01 00:00:00.000000000 +0000 +++ egg-4.2.0/ATTIC/egg-sj3.el 2015-04-30 00:13:12.000000000 +0000 @@ -0,0 +1,407 @@ +;;; egg-sj3.el --- SJ3 Support (high level interface) -*- coding: utf-8 -*- +;;; in Egg Input Method Architecture + +;; Copyright (C) 1999, 2000 Free Software Foundation, Inc + +;; Author: NIIBE Yutaka + +;; Maintainer: TOMURA Satoru + +;; Keywords: 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 'egg) +(require 'egg-sj3rpc) + +(defgroup sj3 nil + "SJ3 interface for Tamago 4." + :group 'egg) + +(defcustom sj3-hostname "localhost" + "Hostname of SJ3 server" + :group 'sj3 :type 'string) + +(defcustom sj3-server-port 3086 + "Port number of SJ3 server" + :group 'sj3 :type 'integer) + +(defmacro SJ3-const (c) + (cond ((eq c 'FileNotExist) 35) + )) + +(defvar sj3-hinshi-menu + '(("名詞" . + (menu "品詞:名詞:" + (("名詞" . 1) + ("名詞(お…)" . 2) + ("名詞(ご…)" . 3) + ("名詞(…的/化)" . 4) + ("名詞(お…する)" . 5) + ("名詞(…する)" . 6) + ("名詞(ご…する)" . 7) + ("名詞(…な/に)" . 8) + ("名詞(お…な/に)" . 9) + ("名詞(ご…な/に)" . 10) + ("名詞(副詞)" . 11)))) + ("代名詞" . 12) + ("苗字" . 21) + ("名前" . 22) + ("地名" . 24) + ("県/区名" . 25) + ("動詞" . + (menu "品詞:動詞:" + (("サ変語幹" . 80) + ("ザ変語幹" . 81) + ("一段不変化部" . 90) + ("カ行五段語幹" . 91) + ("ガ行五段語幹" . 92) + ("サ行五段語幹" . 93) + ("タ行五段語幹" . 94) + ("ナ行五段語幹" . 95) + ("バ行五段語幹" . 96) + ("マ行五段語幹" . 97) + ("ラ行五段語幹" . 98) + ("ワ行五段語幹" . 99)))) + ("連体詞" . 26) + ("接続詞" . 27) + ("助数詞" . 29) + ("数詞" . 30) + ("接頭語" . 31) + ("接尾語" . 36) + ("副詞" . 45) + ("副詞2" . 46) + ("形容詞語幹" . 60) + ("形容動詞語幹" . 71) + ("単漢字" . 189)) + "Menu data for a hinshi (a part of speech) selection.") + +(defun sj3-hinshi-name (id &optional menu alist) + "Return a hinshi (a part of speech) name corresponding to ID. +If ID is nil, return a flattened alist from `sj3-hinshi-menu'. +Don't specify the optional arguments in normal use." + (let ((menu (or menu sj3-hinshi-menu))) + (if (consp menu) + (if (consp (cdr menu)) + (mapc (lambda (elem) + (setq alist (sj3-hinshi-name nil elem alist))) + menu) + (setq alist (nconc alist (list (cons (cdr menu) (car menu))))))) + (if id + (cdr (assq id alist)) + alist))) + +(setplist 'sj3-conversion-backend + '(egg-start-conversion sj3-start-conversion + egg-get-bunsetsu-source sj3-get-bunsetsu-source + egg-get-bunsetsu-converted sj3-get-bunsetsu-converted + egg-list-candidates sj3-list-candidates + egg-decide-candidate sj3-decide-candidate + egg-change-bunsetsu-length sj3-change-bunsetsu-length + egg-end-conversion sj3-end-conversion + egg-word-registration sj3-word-registration)) + +(defconst sj3-backend-alist '((Japanese ((sj3-conversion-backend))))) + +(egg-set-finalize-backend '(sj3-finalize-backend)) + +(defvar sj3-stdy-size 0 "STDYSIZE of SJ3 server") + +(defvar sj3-open-message) + +(defun sj3-open (hostname) + "Establish the connection to SJ3 server. Return process object." + (let* ((buf (generate-new-buffer " *SJ3*")) + proc result) + (condition-case err + (setq proc (open-network-stream "SJ3" buf hostname sj3-server-port)) + ((error quit) + (egg-error "failed to connect sj3 server"))) + (set-process-query-on-exit-flag proc nil) + (set-process-coding-system proc 'binary 'binary) + (set-marker-insertion-type (process-mark proc) t) + (with-current-buffer buf + (erase-buffer) + (buffer-disable-undo) + (set-buffer-multibyte nil)) + ;; Initialize dictionaries + (setq result (sj3rpc-open proc (system-name) (user-login-name))) + (if (< result 0) + (let ((msg (sj3rpc-get-error-message (- result)))) + (delete-process proc) + (kill-buffer buf) + (egg-error "Can't open SJ3 session (%s): %s" hostname msg))) + (setq result (sj3rpc-get-stdy-size proc)) + (if (< result 0) + (let ((msg (sj3rpc-get-error-message (- result)))) + (delete-process proc) + (kill-buffer buf) + (egg-error "Can't get SJ3 STDYSIZE: %s"msg))) + (setq sj3-stdy-size result) + proc)) + +;; ::= [ ] +(defvar sj3-environment nil + "Environment for SJ3 kana-kanji conversion") + +(defsubst sj3env-get-proc (env) + (aref env 0)) +(defsubst sj3env-get-dictionary-list (env) + (aref env 1)) + +;; ::= +;; [ +;; +;; ] +(defsubst sj3-make-bunsetsu (env source converted rest stdy) + (egg-bunsetsu-create + 'sj3-conversion-backend + (vector env source converted rest stdy nil nil nil nil nil))) + +(defsubst sj3bunsetsu-get-env (b) + (aref (egg-bunsetsu-get-info b) 0)) +(defsubst sj3bunsetsu-get-source (b) + (aref (egg-bunsetsu-get-info b) 1)) +(defsubst sj3bunsetsu-get-converted (b) + (aref (egg-bunsetsu-get-info b) 2)) +(defsubst sj3bunsetsu-get-rest (b) + (aref (egg-bunsetsu-get-info b) 3)) +(defsubst sj3bunsetsu-get-stdy (b) + (aref (egg-bunsetsu-get-info b) 4)) + +(defsubst sj3bunsetsu-get-zenkouho (b) + (aref (egg-bunsetsu-get-info b) 5)) +(defsubst sj3bunsetsu-set-zenkouho (b z) + (aset (egg-bunsetsu-get-info b) 5 z)) + +(defsubst sj3bunsetsu-get-zenkouho-pos (b) + (aref (egg-bunsetsu-get-info b) 6)) +(defsubst sj3bunsetsu-set-zenkouho-pos (b zp) + (aset (egg-bunsetsu-get-info b) 6 zp)) + +(defsubst sj3bunsetsu-get-zenkouho-converted (b) + (aref (egg-bunsetsu-get-info b) 7)) +(defsubst sj3bunsetsu-set-zenkouho-converted (b zc) + (aset (egg-bunsetsu-get-info b) 7 zc)) + +(defsubst sj3bunsetsu-get-kugiri-changed (b) + (aref (egg-bunsetsu-get-info b) 8)) +(defsubst sj3bunsetsu-set-kugiri-changed (b s) + (aset (egg-bunsetsu-get-info b) 8 s)) + +(defun sj3-get-bunsetsu-source (b) + (sj3bunsetsu-get-source b)) + +(defun sj3-get-bunsetsu-converted (b) + (concat (sj3bunsetsu-get-converted b) (sj3bunsetsu-get-rest b))) + +(defun sj3-get-bunsetsu-stdy (b) (sj3bunsetsu-get-stdy b)) + +(defvar sj3-dictionary-specification + '(("study.dat") + ["sj3main.dic" ""] + [("private.dic") ""]) + "Dictionary specification of SJ3.") + +(defvar sj3-usr-dic-dir (concat "user/" (user-login-name)) + "*Directory of user dictionary for SJ3.") + +(defun sj3-filename (p) + "" + (cond ((consp p) (concat sj3-usr-dic-dir "/" (car p))) + (t p))) + +(defun sj3-get-environment () + "Return the backend of SJ3 environment." + (if sj3-environment + sj3-environment + (let* ((proc (sj3-open sj3-hostname)) + (freq-info-name (sj3-filename (car sj3-dictionary-specification))) + (l (cdr sj3-dictionary-specification)) + dict-list) + (sj3-open-freq-info proc freq-info-name) + (while l + (let ((dic (car l)) + dic-id) + (setq dic-id + (sj3-open-dictionary proc (sj3-filename (aref dic 0)) + (aref dic 1))) + (if (< dic-id 0) + (egg-error "Dame2") ; XXX + (setq dict-list (cons dic-id dict-list) + l (cdr l))))) + (setq sj3-environment (vector proc dict-list))))) + +(defun sj3-open-freq-info (proc name) + (let ((trying t) + ret) + (while trying + (setq ret (sj3rpc-open-stdy proc name)) + (if (= ret 0) + (setq trying nil) + (message "学習ファイル(%s)がありません" name) + (if (/= ret (SJ3-const FileNotExist)) + (egg-error "Fatal1") ; XXX + (if (and (y-or-n-p + (format "学習ファイル(%s)がありません。作りますか? " + name)) + (sj3rpc-make-directory proc + (file-name-directory name)) + ;; ignore error + (= (sj3rpc-make-stdy proc name) 0)) + (message "学習ファイル(%s)を作りました" name) + (egg-error "Fatal2"))))))) ; XXX + +(defun sj3-open-dictionary (proc name passwd) + (let ((trying t) + ret) + (while trying + (setq ret (sj3rpc-open-dictionary proc name passwd)) + (if (>= ret 0) + (setq trying nil) + (message "辞書ファイル(%s)がありません" name) + (setq ret (- ret)) ; Get error code. + (if (/= ret (SJ3-const FileNotExist)) + (egg-error "Fatal3 %d" ret) ; XXX + (if (and (y-or-n-p + (format "辞書ファイル(%s)がありません。作りますか? " + name)) + (= (sj3rpc-make-dictionary proc name) 0)) + (message "辞書ファイル(%s)を作りました" name) + (egg-error "Fatal4"))))) ; XXX + ret)) + +(defun sj3-start-conversion (backend yomi &optional context) + "Convert YOMI string to kanji, and enter conversion mode. +Return the list of bunsetsu." + (let ((env (sj3-get-environment))) + (sj3rpc-begin env yomi))) + +(defun sj3-end-conversion (bunsetsu-list abort) + (if abort + () + (let ((env (sj3bunsetsu-get-env (car bunsetsu-list))) + (l bunsetsu-list) + bunsetsu stdy kugiri-changed) + (while l + (setq bunsetsu (car l)) + (setq l (cdr l)) + (setq stdy (sj3bunsetsu-get-stdy bunsetsu)) + (if stdy + (sj3rpc-bunsetsu-stdy env stdy)) + (if (and l + (setq kugiri-changed (sj3bunsetsu-get-kugiri-changed + bunsetsu))) + (let ((yomi1 (sj3bunsetsu-get-source bunsetsu)) + (yomi2 (sj3bunsetsu-get-source (car l)))) + (if (/= kugiri-changed (length yomi1)) + (sj3rpc-kugiri-stdy env yomi1 yomi2 + (sj3bunsetsu-get-stdy (car l)))))))))) + +(defun sj3-list-candidates (bunsetsu prev-bunsetsu next-bunsetsu major) + (setq bunsetsu (car bunsetsu)) + (if (sj3bunsetsu-get-zenkouho bunsetsu) + (cons (sj3bunsetsu-get-zenkouho-pos bunsetsu) + (sj3bunsetsu-get-zenkouho-converted bunsetsu)) + (let* ((env (sj3bunsetsu-get-env bunsetsu)) + (yomi (sj3bunsetsu-get-source bunsetsu)) + (z (sj3rpc-get-bunsetsu-candidates env yomi))) + (sj3bunsetsu-set-zenkouho bunsetsu z) + (cons (sj3bunsetsu-set-zenkouho-pos bunsetsu 0) + (sj3bunsetsu-set-zenkouho-converted + bunsetsu + (mapcar 'sj3bunsetsu-get-converted z)))))) + +(defun sj3-decide-candidate (bunsetsu candidate-pos prev-b next-b) + (setq bunsetsu (car bunsetsu)) + (let* ((candidate-list (sj3bunsetsu-get-zenkouho bunsetsu)) + (candidate (nth candidate-pos candidate-list))) + (sj3bunsetsu-set-zenkouho candidate candidate-list) + (sj3bunsetsu-set-zenkouho-pos candidate candidate-pos) + (sj3bunsetsu-set-zenkouho-converted + candidate (sj3bunsetsu-get-zenkouho-converted bunsetsu)) + (list (list candidate)))) + +(defun sj3-change-bunsetsu-length (bunsetsu prev-b next-b len major) + (let ((yomi (mapconcat 'sj3bunsetsu-get-source bunsetsu nil)) + (env (sj3bunsetsu-get-env (car bunsetsu))) + (old (car bunsetsu)) + new yomi1 yomi2) + (setq yomi1 (substring yomi 0 len) + yomi2 (substring yomi len)) + (setq new (sj3rpc-tanbunsetsu-conversion env yomi1)) + ;; Only set once (memory original length of the bunsetsu). + (sj3bunsetsu-set-kugiri-changed new + (or (sj3bunsetsu-get-kugiri-changed old) + (length (sj3bunsetsu-get-source old)))) + (if (> (length yomi2) 0) + (list (list new (sj3rpc-tanbunsetsu-conversion env yomi2))) + (list (list new))))) + +(defun sj3-finalize-backend () + (if sj3-environment + (let ((proc (sj3env-get-proc sj3-environment)) + (dict-list (sj3env-get-dictionary-list sj3-environment)) + dict) + (while dict-list + (setq dict (car dict-list)) + (setq dict-list (cdr dict-list)) + (sj3rpc-close-dictionary proc dict)) ; XXX: check error + (sj3rpc-close-stdy proc) + (sj3rpc-close proc) + (setq sj3-environment nil)))) + +;;; word registration + +(defun sj3-dictionary-select () + (menudiag-select (list 'menu + (egg-get-message 'sj3-register-1) + (aref (nth 2 sj3-dictionary-specification) 0)))) + +(defun sj3-hinshi-select () + (menudiag-select (list 'menu + (egg-get-message 'sj3-register-2) + sj3-hinshi-menu))) + +(defun sj3-word-registration (backend kanji yomi) + "Register a word KANJI with a pronunciation YOMI." + (let* ((env (sj3-get-environment)) + (dic (sj3-dictionary-select)) + (hinshi-id (sj3-hinshi-select)) + (result (sj3rpc-add-word env + (car (aref env 1)) + yomi kanji hinshi-id))) + (if (>= result 0) + (list (sj3-hinshi-name hinshi-id) dic) + (egg-error (sj3rpc-get-error-message (- result)))))) + +;;; setup + +(run-hooks 'sj3-load-hook) + +;;;###autoload +(defun egg-activate-sj3 (&rest arg) + "Activate SJ3 backend of Tamago 4." + (apply 'egg-mode (append arg sj3-backend-alist))) + +;;; egg-sj3.el ends here. diff -Nru egg-4.1.8/ATTIC/egg-sj3rpc.el egg-4.2.0/ATTIC/egg-sj3rpc.el --- egg-4.1.8/ATTIC/egg-sj3rpc.el 1970-01-01 00:00:00.000000000 +0000 +++ egg-4.2.0/ATTIC/egg-sj3rpc.el 2015-04-30 00:13:12.000000000 +0000 @@ -0,0 +1,309 @@ +;;; egg-sj3rpc.el --- SJ3 Support (low level interface) in Egg +;;; Input Method Architecture + +;; Copyright (C) 1999, 2000 Free Software Foundation, Inc + +;; Author: NIIBE Yutaka + +;; Maintainer: TOMURA Satoru + +;; Keywords: 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 'egg-com) +(defvar sj3-stdy-size) ; in egg-sj3.el +(declare-function egg-error (message &rest args) "egg.el" nil) +(declare-function sj3env-get-proc (env) "egg-sj3.el" nil) +(declare-function sj3-make-bunsetsu (env source converted rest stdy) + "egg-sj3.el" nil) + +(defvar sj3-server-version 2 + "*Major version number of SJ3 server.") + +(defvar sj3-server-coding-system 'shift_jis + "*Coding system used when decoding and encoding of I/O operation with +SJ3 server. Valid coding systems are depend on the server spec.") + +(require 'egg-com) +(defmacro sj3-sjis-p () + '(eq 'coding-category-sjis (coding-system-category + sj3-server-coding-system))) +(defmacro sj3-const (c) + (cond ((eq c 'OPEN) 1) + ((eq c 'CLOSE) 2) + ((eq c 'DICADD) 11) + ((eq c 'DICDEL) 12) + ((eq c 'OPENSTDY) 21) + ((eq c 'CLOSESTDY) 22) + ((eq c 'STDYSIZE) 23) + ((eq c 'LOCK) 31) + ((eq c 'UNLOCK) 32) + ((eq c 'BEGIN) '(if (sj3-sjis-p) 41 111)) + ((eq c 'TANCONV) '(if (sj3-sjis-p) 51 112)) + ((eq c 'KOUHO) '(if (sj3-sjis-p) 54 115)) + ((eq c 'KOUHOSU) '(if (sj3-sjis-p) 55 116)) + ((eq c 'STDY) 61) + ((eq c 'CLSTDY) '(if (sj3-sjis-p) 62 117)) + ((eq c 'WREG) '(if (sj3-sjis-p) 71 118)) + ((eq c 'WDEL) '(if (sj3-sjis-p) 72 119)) + ((eq c 'MKDIC) 81) + ((eq c 'MKSTDY) 82) + ((eq c 'MKDIR) 83) + ((eq c 'ACCESS) 84) + ((eq c 'WSCH) '(if (sj3-sjis-p) 91 120)) + ((eq c 'WNSCH) '(if (sj3-sjis-p) 92 121)) + ((eq c 'VERSION) 103) + (t (error "No such constant")))) + +;; XXX +(defconst sj3rpc-error-message (vector )) + +(defun sj3rpc-get-error-message (errno) + (or (and (>= errno 0) + (< errno (length sj3rpc-error-message)) + (aref sj3rpc-error-message errno)) + (format "#%d" errno))) + +(defmacro sj3rpc-call-with-environment (e vlist send-expr &rest receive-exprs) + (let ((v (append + `((proc (sj3env-get-proc ,e))) + vlist))) + (list + 'let v + (append + `(with-current-buffer (process-buffer proc) + (erase-buffer) + ,send-expr + (process-send-region proc (point-min) (point-max)) + (goto-char (prog1 (point) (accept-process-output proc)))) + receive-exprs)))) + +(defmacro sj3rpc-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))) + sj3-server-coding-system))) + +(defun sj3rpc-open (proc myhostname username) + "Open the session. Return 0 on success, error code on failure." + (comm-call-with-proc proc (result) + (comm-format (u u s s s) (sj3-const OPEN) sj3-server-version + myhostname username + ;; program name + (format "%d.emacs-egg" (emacs-pid))) + (comm-unpack (i) result) + (if (= result -2) + 0 + result))) + +(defun sj3rpc-close (proc) + (comm-call-with-proc proc (result) + (comm-format (u) (sj3-const CLOSE)) + (comm-unpack (i) result) + result)) + +(defun sj3rpc-get-stdy-size (proc) + "Return STDYSIZE of SJ3 server. On failure, return error code." + (comm-call-with-proc proc (result) + (comm-format (u) (sj3-const STDYSIZE)) + (comm-unpack (u) result) + (if (/= result 0) + (- result) ; failure + (comm-unpack (u) result) + result))) + +(defsubst sj3rpc-get-stdy (proc) + (let (r + (n 0) + (stdy (make-vector sj3-stdy-size 0))) + (while (< n sj3-stdy-size) + (comm-unpack (b) r) + (aset stdy n r) + (setq n (1+ n))) + stdy)) + +(defun sj3rpc-begin (env yomi) + "Begin conversion." + (let ((yomi-ext (encode-coding-string yomi sj3-server-coding-system)) + (p 0) + len source converted stdy bunsetsu-list bl result) + (sj3rpc-call-with-environment env (result) + (comm-format (u s) (sj3-const BEGIN) yomi-ext) + (comm-unpack (u) result) + (if (/= result 0) + (- result) ; failure + (comm-unpack (u) result) ; skip + (while (progn + (comm-unpack (b) len) + (> len 0)) + (setq stdy (sj3rpc-get-stdy proc)) + (setq converted (sj3rpc-unpack-mb-string)) + (setq source (decode-coding-string (substring yomi-ext p (+ p len)) + sj3-server-coding-system) + p (+ p len)) + (let ((bl1 (cons (sj3-make-bunsetsu env + source converted nil stdy) nil))) + (if bl + (setq bl (setcdr bl bl1)) + (setq bunsetsu-list (setq bl bl1))))) + bunsetsu-list)))) + +(defun sj3rpc-open-dictionary (proc dict-file-name password) + (comm-call-with-proc proc (result) + (comm-format (u s s) (sj3-const DICADD) dict-file-name password) + (comm-unpack (u) result) + (if (/= result 0) + (- result) ; failure + (comm-unpack (u) result) + result))) + +(defun sj3rpc-close-dictionary (proc dict-no) + (comm-call-with-proc proc (result) + (comm-format (u u) (sj3-const DICDEL) dict-no) + (comm-unpack (i) result) + result)) + +(defun sj3rpc-make-dictionary (proc dict-name) + (comm-call-with-proc proc (result) + (comm-format (u s u u u) (sj3-const MKDIC) dict-name + 2048 ; Index length + 2048 ; Length + 256 ; Number + ) + (comm-unpack (i) result) + result)) + +(defun sj3rpc-open-stdy (proc stdy-name) + (comm-call-with-proc proc (result) + (comm-format (u s s) (sj3-const OPENSTDY) stdy-name "") + (comm-unpack (i) result) + result)) + +(defun sj3rpc-close-stdy (proc) + (comm-call-with-proc proc (result) + (comm-format (u) (sj3-const CLOSESTDY)) + (comm-unpack (i) result) + result)) + +(defun sj3rpc-make-stdy (proc stdy-name) + (comm-call-with-proc proc (result) + (comm-format (u s u u u) (sj3-const MKSTDY) stdy-name + 2048 ; Number + 1 ; Step + 2048 ; Length + ) + (comm-unpack (i) result) + result)) + +(defun sj3rpc-make-directory (proc name) + (comm-call-with-proc proc (result) + (comm-format (u s) (sj3-const MKDIR) name) + (comm-unpack (i) result) + result)) + +(defun sj3rpc-get-bunsetsu-candidates-sub (proc env yomi yomi-ext len n) + (let ((i 0) + stdy converted bunsetsu bl bunsetsu-list cylen rest) + (comm-call-with-proc-1 proc (result) + (comm-format (u u s) (sj3-const KOUHO) len yomi-ext) + (comm-unpack (u) result) + (if (/= result 0) + (- result) ; failure + (while (< i n) + (comm-unpack (u) cylen) + (setq stdy (sj3rpc-get-stdy proc)) + (setq converted (sj3rpc-unpack-mb-string)) + (setq rest (decode-coding-string (substring yomi-ext cylen) + sj3-server-coding-system)) + (setq bunsetsu (sj3-make-bunsetsu env yomi converted rest stdy)) + (if bl + (setq bl (setcdr bl (cons bunsetsu nil))) + (setq bunsetsu-list (setq bl (cons bunsetsu nil)))) + (setq i (1+ i))) + (setq bunsetsu (sj3-make-bunsetsu env yomi yomi nil nil)) + (setq bl (setcdr bl (cons bunsetsu nil))) + (setq bunsetsu + (sj3-make-bunsetsu env yomi (japanese-katakana yomi) nil nil)) + (setq bl (setcdr bl (cons bunsetsu nil))) + bunsetsu-list)))) + +(defun sj3rpc-get-bunsetsu-candidates (env yomi) + (let* ((yomi-ext (encode-coding-string yomi sj3-server-coding-system)) + (len (length yomi-ext))) + (sj3rpc-call-with-environment env (result) + (comm-format (u u s) (sj3-const KOUHOSU) len yomi-ext) + (comm-unpack (u) result) + (if (/= result 0) + (- result) ; failure + (comm-unpack (u) result) + (if (= result 0) + (list (sj3-make-bunsetsu env yomi yomi nil nil)) ; XXX + (sj3rpc-get-bunsetsu-candidates-sub proc env + yomi yomi-ext len result)))))) + +(defun sj3rpc-tanbunsetsu-conversion (env yomi) + (let* ((yomi-ext (encode-coding-string yomi sj3-server-coding-system)) + (len (length yomi-ext)) cylen stdy converted rest bunsetsu) + (sj3rpc-call-with-environment env (result) + (comm-format (u u s) (sj3-const TANCONV) len yomi-ext) + (comm-unpack (u) result) + (if (/= result 0) + (- result) + (comm-unpack (u) cylen) + (setq stdy (sj3rpc-get-stdy proc)) + (setq converted (sj3rpc-unpack-mb-string)) + (setq rest (decode-coding-string (substring yomi-ext cylen) + sj3-server-coding-system)) + (setq bunsetsu (sj3-make-bunsetsu env yomi converted rest stdy)))))) + +(defun sj3rpc-bunsetsu-stdy (env stdy) + (sj3rpc-call-with-environment env (result) + (comm-format (u v) (sj3-const STDY) stdy (length stdy)) + (comm-unpack (u) result) + (- result))) + +(defun sj3rpc-kugiri-stdy (env yomi1 yomi2 stdy) + (sj3rpc-call-with-environment env (result) + (comm-format (u s s v) (sj3-const CLSTDY) + (encode-coding-string yomi1 sj3-server-coding-system) + (encode-coding-string yomi2 sj3-server-coding-system) + stdy (length stdy)) + (comm-unpack (u) result) + (- result))) + +(defun sj3rpc-add-word (env dictionary yomi kanji hinshi) + "Register a word KANJI into DICTIONARY with a pronunciation YOMI and +a part of speech HINSHI. Where DICTIONARY should be an integer." + (sj3rpc-call-with-environment env (result) + (comm-format (u u s s u) (sj3-const WREG) dictionary + (encode-coding-string yomi sj3-server-coding-system) + (encode-coding-string kanji sj3-server-coding-system) + hinshi) + (comm-unpack (u) result) + (- result))) + +(provide 'egg-sj3rpc) + +;;; egg-sj3rpc.el ends here. diff -Nru egg-4.1.8/AUTHORS egg-4.2.0/AUTHORS --- egg-4.1.8/AUTHORS 2014-11-10 02:03:36.000000000 +0000 +++ egg-4.2.0/AUTHORS 2015-04-30 00:13:12.000000000 +0000 @@ -8,12 +8,10 @@ Design a part of ITS programming. Wrote ITS: its.el - its/hira.el - Wrote egg.el, menudiag.el, egg-cnv.el, egg-com.el, - and egg-mlh.el. + its-hira.el + Wrote egg.el, menudiag.el, egg-cnv.el and egg-mlh.el. Wrote backend conversion engine interface: - ANTHY: egg-anthy.el, egg-anthyipc.el, - SJ3: egg-sj3.el, egg-sj3rpc.el, + ANTHY: egg-anthy.el, egg-anthyipc.el KATAYAMA Yoshio Design ITS programming, after Niibe. diff -Nru egg-4.1.8/ChangeLog egg-4.2.0/ChangeLog --- egg-4.1.8/ChangeLog 2014-11-10 02:03:36.000000000 +0000 +++ egg-4.2.0/ChangeLog 2015-04-30 00:13:12.000000000 +0000 @@ -1,6 +1,19 @@ +2015-04-30 Niibe Yutaka + + * egg.el (egg-version): 4.2.0. + * egg-anthy.el (anthy-new-environment): Use UTF-8. + +2015-04-27 Niibe Yutaka + + * egg-mlh.el: (mlh-beg, mlh-candidates, mlh-end-marker) + (henkan-begin, current-candidate, number-of-candidates) + (inhibit-henkan): Declare dyanmic binding variables. + + * egg-sj3.el, egg-sj3rpc.el, egg-comm.el: Move to ATTIC. + 2014-11-10 Niibe Yutaka - * egg.el (egg-version): 4.1.7. Save in UTF-8. + * egg.el (egg-version): 4.1.8. Save in UTF-8. * egg-mlh.el: Save in UTF-8. 2014-11-08 NIIBE Yutaka diff -Nru egg-4.1.8/debian/changelog egg-4.2.0/debian/changelog --- egg-4.1.8/debian/changelog 2014-11-10 02:18:58.000000000 +0000 +++ egg-4.2.0/debian/changelog 2015-04-30 00:23:45.000000000 +0000 @@ -1,3 +1,21 @@ +egg (4.2.0-1) unstable; urgency=low + + * New upstrem. + + -- NIIBE Yutaka Thu, 30 Apr 2015 09:23:42 +0900 + +egg (4.1.9-1) unstable; urgency=low + + * New upstream. Remove SJ3. + * debian/rules (EL_FILES): Remove egg-com.el, egg-sj3.el, egg-sj3rpc.el. + * Remove old patches: debian/patches/00-debian-specific.patch, + debian/patches/01-debian-its.patch, + debian/patches/02-debian-canna.patch, + debian/patches/03-debian-wnn.patch, + debian/patches/04-debian-egg.patch. + + -- NIIBE Yutaka Mon, 27 Apr 2015 12:24:51 +0900 + egg (4.1.8-1) unstable; urgency=medium * New upstream. Fix source code file format in UTF-8. diff -Nru egg-4.1.8/debian/copyright egg-4.2.0/debian/copyright --- egg-4.1.8/debian/copyright 2014-10-24 07:39:08.000000000 +0000 +++ egg-4.2.0/debian/copyright 2015-04-30 00:22:35.000000000 +0000 @@ -6,7 +6,6 @@ It was downloaded from Upstream Authors: see the AUTHORS file -anthy.el and anthyipc.el is enhanced by Hideyuki SHIRAI Copyright: diff -Nru egg-4.1.8/debian/NEWS.Debian egg-4.2.0/debian/NEWS.Debian --- egg-4.1.8/debian/NEWS.Debian 2014-11-06 02:34:35.000000000 +0000 +++ egg-4.2.0/debian/NEWS.Debian 2015-04-30 00:24:48.000000000 +0000 @@ -1,8 +1,8 @@ -egg (4.1.3-1) unstable; urgency=medium - - * WARNING: Only Japanese input is supported with Anthy. +egg (4.2.0-1) unstable; urgency=low + * WARNING: Only Japanese input is supported. + * WARNING: Only Anthy backend is supported. * Since upstream maintainer at AIST has no interest for the package any more, this package in Debian is a kind of fork. - -- NIIBE Yutaka Thu, 06 Nov 2014 11:34:25 +0900 + -- NIIBE Yutaka Thu, 30 Apr 2015 09:24:41 +0900 diff -Nru egg-4.1.8/debian/patches/00-debian-specific.patch egg-4.2.0/debian/patches/00-debian-specific.patch --- egg-4.1.8/debian/patches/00-debian-specific.patch 2014-10-31 03:57:40.000000000 +0000 +++ egg-4.2.0/debian/patches/00-debian-specific.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,1364 +0,0 @@ -diff --git a/egg-anthy.readme b/egg-anthy.readme -new file mode 100644 -index 0000000..c77753d ---- /dev/null -+++ b/egg-anthy.readme -@@ -0,0 +1,325 @@ -+$B!X<+2H@=(B egg-anthy$B!Y$K$D$$$F(B -+ -+1. $B<+2H@=(B egg-anthy $B$K$D$$$F(B -+ $B$3$N(B tar ball $B$OGr0f=(9T(B(*1)$B$,8D?ME*$K(B Anthy(*2) $B$r(B Tamago Ver.4(*3) $B$+(B -+ $B$i(B *$B$A$c$s$H(B* $B;H$*$&!*$H;W$$$?$A$G$C$A$"$2$?(B elisp $B72$G$9!#$\$/$O!"(BMeadow -+ $B$d(B Zaurus $B>e$N(B Emacs $B$G(B egg-anthy $B$r;H$C$F$a$A$c$/$A$c9,$;$K$J$j$^$7$?!#(B -+ -+ $B;d$O(B -+ -+ (1) Meadow $B$J(B NotePC $B$G;}$AJb$/$+$i!"%5!<%P$K7R$2$i$l$J$$$N$G(B Meadow $B$+$i(B -+ $B$b(B MS-IME $B$GHa$7$$!#$@$1$I!"(Banthy $B$C$F(B cygwin $B$G(B make $B$G$-$k$J$!!#(B -+ -+ (2) Zaurus $B$N(B Emacs $B$G(B FreeWnn $B$r(B egg-wnn $B$G;H$C$F$$$k$1$I!"$A$g$C$H<-=q(B -+ $B$rA}$d$9$H%a%b%j$O?)$&$o!"CY$/$J$k$o$G!"BgJQ!#(B -+ -+ (3) Anthy $BIUB0$N(B anthy.el $B$G$bNI$$$N$@$1$I!"$I$&$7$F$b;X$HF,$,(B egg $B$JF0$-(B -+ $B$N$^$^$@!#(B -+ -+ $B$H$$$&LdBj$KG:$^$5$l$F$$$^$7$?!#F1$8G:$_$r$*;}$A$NJ}$K$OM-8z$@$H;W$$$^$9!#(B -+ $B$^$?!"(Begg-remix(*4) $B$HAH$_9g$o$;$F$b=gD4$KF0$$$F$$$^$9!#(B -+ -+ (*1) shirai@meadowy.org <= $BMWK>(B/$B%P%0Js9pEy$O$3$A$i$^$G$I$&$>(B -+ (*2) http://anthy.sourceforge.jp/ -+ (*3) http://www.m17n.org/tamago/ -+ (*4) http://www.extipl.jp/~payashi/remix/ -+ -+ -+2. anthy $B$N%$%s%9%H!<%k(B -+ http://anthy.sourceforge.jp/ $B$+$i$I$&$>!#(B2005$BG/(B02$B7n(B28$BF|(B $B8=:_$G$O(B -+ anthy-6131 $B$KBP1~$7$F$$$^$9!#(Banthy-5900($B$^$?$O$=$l0JA0(B) $B$G$bF0:n$9$k$H;W(B -+ $B$o$l$^$9$,!"<-=qEPO?;~$K%5%]!<%H$7$F$$$kIJ;l$K%_%9%^%C%A$,@8$8$k$?$a!"(B -+ egg-anthy $B$,%5%]!<%H$7$F$$$k$9$Y$F$NIJ;l$r;H$&$3$H$O$G$-$^$;$s!#(B -+ -+ -+3. Tamago Ver.4 + $B<+2H@=(B egg-anthy $B$N%$%s%9%H!<%k(B -+ $B%j%j!<%9HG$N(B Tamago 4.0.6 $B$G$OF0:n$7$^$;$s$N$GCm0U$7$F$/$@$5$$!#(B -+ -+3.1 $B$^$@(B Tamago $B$r%$%s%9%H!<%k$7$F$$$J$$?M(B -+(1) CVS Head $B$J(B Tamago $B$r(B http://cvs.m17n.org/viewcvs/tamago/tamago/ $B$J$I(B -+ $B$+$iLc$C$F$-$^$9!#(BTamago Ver.4 $B$O$$$m$$$m$J%Q%C%A$,=P$F$$$k$N$G!"I,MW$J(B -+ $B?M$O5y$C$F$/$@$5$$!#(Bhttp://www.asahi-net.or.jp/~mu6k-ski/tamago.html $B$b(B -+ $B;29M$K$J$k$G$7$g$&!#(B -+ -+(2) $BF1:-$N(B anthy.el, anthyipc.el $B$r>e5-$N(B tamago $B0l<0$rE83+$7$?(B -+ tamago/egg/ $B0J2<$NF1L>$N%U%!%$%k$K>e=q$-$7$^$9!#(B -+ -+(3) $BIaDL$K(B tamago $B$r%$%s%9%H!<%k$7$^$9!#(B -+ -+3.2 $B$9$G$K(B Tamago $B$r%$%s%9%H!<%k$7$F$$$k?M(B -+ egg-anthy $BIU$-$N%P!<%8%g%s$+H]$+$G!"J}K!$,JQ$o$j$^$9!#(B -+ -+3.2.1 "C-uC-\" $B$G(B "japanese-egg-anthy" $B$,=P$F$3$J$$?M(B -+ 2.1 $B$r;29M$K$7$F!"0l$+$i(B Tamago $B$r%$%s%9%H!<%k$7$F$/$@$5$$!#(B -+ -+3.2.2 "C-uC-\" $B$G(B "japanese-egg-anthy" $B$,=P$F$/$k?M(B -+ ($B4D6-$K$h$C$F0c$&$H;W$$$^$9$,(B)/usr/local/local/share/emacs/site-lisp/egg/egg -+ $B0J2<$KF1:-$N(B anthy.el, anthyipc.el $B$r%3%T!<$7$F(B byte-compile $B$7$F$/$@$5$$!#(B -+ -+ -+4. $B;H$$J}(B -+ $BIaDL$K(B C-uC-\ $B$G(B "japanese-egg-anthy" $B$rA*Br$9$l$P(B OK $B$G$9!#(B -+ -+ (setq default-input-method "japanese-egg-anthy") -+ -+ $B$H$+(B ~/.emacs $B$K=q$$$F$*$1$P$9$0(B egg-anthy $B$,;H$($k>uBV$K$J$j$^$9!#(B -+ -+ -+5. $B<+2H@=(B egg-anthy $B$NCf?H(B -+ http://anthy.sourceforge.jp/cgi-bin/hiki/hiki.cgi?Emacs%A4%AB%A4%E9 $B$N%Q%C(B -+ $B%A$r;H$o$;$F$$$?$@$-$^$7$?!#$@$1$I$3$l$@$1$@$H!"JQ49$7$F(B C-h $B$GC$7$C(B -+ $B$F(B 16$B2s$d$C$?$iGKC>$7$^$9$h$M!#(B -+ -+5.1 $B@)8B;v9`(B -+(1) Tamago Ver.4 $B$NFCD'$N0l$D$G$"$k%^%k%A%U%'%s%9$OF1;~$K(B 16$B8D$^$G$7$+%*!<(B -+ $B%W%s$G$-$^$;$s!#(B -+ -+ $B$3$l$O!"(Banthy-agent $B$r(B -egg $BIU$-$GF0$+$7$?>l9g$N(B anthy-agent $B$N@)8B;v9`$G(B -+ $B$9!#(B15$B8D$r1[$($k$H%7%D%3%/%a%C%;!<%8$r=P$7$^$9!#<+J,$G2~B$$9$l$P$=$l0J>e(B -+ $B$N%U%'%s%9$r%*!<%W%s$G$-$^$9$,!"DL>oI,MW$J$$$H;W$$$^$9!#$b$7!"4V0c$C$F(B -+ 17$B8D0J>e$N%U%'%s%9$r%*!<%W%s$7$FGKC>$7$?$H$-$O!"(B -+ "M-x anthy-egg-recover" $B$HBG$C$F$/$@$5$$!#(B -+ -+(2) egg-abort-conversion(), egg-decide-before-point() $B$NFs$D$N4X?t$K(B -+ advice $B$r$+$1$F$$$^$9$N$G!"Cm0U$7$F$/$@$5$$!#(B -+ -+ tamago $BK\BN$K "/usr/local/share/emacs/site-lisp/anthy/anthy.elc" -+ $B$H$$$&$U$&$K!"(BAnthy $BIUB0$N(B anthy.el $B$,(B load-path $B$N$O$8$a$K=P$F$/$k$h$&$K(B -+ $BD4@0$7$F$/$@$5$$!#(B -+ -+ (locate-libraries "anthy") -+ => ("/usr/local/share/emacs/site-lisp/anthy/anthy.elc" -+ "/usr/local/share/emacs/site-lisp/egg/egg/anthy.elc") -+ $B$H$J$l$P(B OK $B$G$9!#(B -+ -+(2) anthy-6131 $BIUB0$N(B anthy-dic-tool $B$,%5%]!<%H$7$F$$$kIJ;l$O$9$Y$F(B egg $B$+(B -+ $B$iEPO?$9$k$3$H$,=PMh$^$9!#(B -+ -+ $B:#8e(B anthy-dic-tool $B$,%5%]!<%H$9$kIJ;l$,A}$($?$H$-$NBP1~$O$=$N$H$-$K9M$((B -+ $B$^$9$,!"(B/usr/local/share/anthy/typetab $B$r<+F0$G2r@O$7$J$$$H$@$a$+$J$!!#!#!#(B -+ -+ $B$^$?!"F0;l$NEPO?$OJJ$,$"$j$^$9!#Nc$($P!V>F$-9~$`!W$rEPO?$9$k$H$-$O!"(B -+ $B4A;z(B:$B!X=q$-9~!Y!"FI$_(B:$B!X$d$-$3!Y!"3hMQ(B:$B!X%^9T8^CJ3hMQ!Y(B -+ $B$NMM$K3hMQ8lHx$r30$7$FEPO?$7$^$9!#(B -+ -+(3) $B%*%j%8%J%k$N(B egg-anthy $B$,BP1~$7$F$$$J$+$C$?!"$R$i$,$JJQ49(B(M-h)$B!"%+%?%+(B -+ $B%JJQ49(B(M-k) $B$KBP1~$7$F$$$^$9!#(B -+ -+ -+6. UTF-8 $BBP1~(B -+ $B:G6a$N(B Anthy $B$G$O!"(BAnthy $BFbIt$,(B UNICODE $B2=$7!"0BDjHG$G$O(B anthy-8700 $B0J9_(B -+ $B$N(B anthy-agent, anthy-dic-tool $B$G$b(B "--utf8" $B$H$$$&%*%W%7%g%s$r;H$($P(B -+ UTF-8 $B$GDL?.$9$k$3$H$,$G$-$^$9!#$*;H$$$N(B Emacs $B$,(B Emacs-22 $B$^$?$O(B -+ Emacs-21 + Mule-UCS $B$N$H$-$O!"(BAnthy $B$H(B UTF-8 $B$GDL?.$9$k$3$H$,$G$-$^$9!#(B -+ -+6.1 $B@_Dj(B -+ egg-anthy $B$r;H$&A0$K(B -+ -+ (setq anthy-egg-use-utf8 t) -+ -+ $B$H$7$^$9!#%G%U%)%k%H$O(B nil $B$G$9!#(B -+ -+ $B$^$?!"(Bleim $B$KEPO?$5$l$F$$$k(B egg-anthy $B$N(B input-method $BL>$,I8=`$N(B -+ "japanese-egg-anthy" $B$G$J$$$H$-!"$^$?$OJ#?t;}$D$H$-$O!"(B -+ anthy-egg-input-method-list $B$K0J2<$N$h$&$K@_Dj$7$^$9!#(B -+ -+ (setq anthy-egg-input-method-list '("japanese-egg-anthy" "anthy")) -+ -+6.2 $BCm0UE@(B $B$=$N0l(B -+ $BF|K\8l(B($B!)(B)$B0J30$NC18l$r(B Anthy $B$N<-=q$KEPO?2DG=$K$9$kE@$H!"F|K\8l(B($B!)(B)$B0J30$r(B -+ $B%j!<%8%g%s$K;XDj$7$F$N(B "M-x egg-convert-region" $B$G%(%i!<$r=P$5$J$$$h$&$K(B -+ $B$9$k$?$a!"(Begg-toroku-bunsetsu, egg-toroku-region, egg-convert-region, -+ egg-separate-languages $B$N3F4X?t$K(B advice $B$r$+$1$F$$$^$9!#(B -+ -+ $B$3$N5!G=$O(B -+ -+ (setq anthy-egg-use-chinese-korean-server t) -+ -+ $B$H$9$k$HL58z$K$J$j!"(BkWnn, cWnn $B$H(B utf-8 $B$J(B Anthy $B$,6&B8$G$-$^$9!#%G%U%)%k(B -+ $B%H$O(B nil $B$G$9!#(B -+ -+6.3 $BCm0UE@(B $B$=$NFs(B -+ UTF-8 $B$rMQ$$$F(B Anthy $B$+$iJ8;z$,=P$FMh$?$H$-$K(B Emacs $B$,$=$NJ8;z$,$I$N(B -+ charset set $B$K3d$jEv$F$k$+$O!"$=$N(B Emacs $B!#(B -+ -+(cond -+ ((featurep 'jisx0213) -+ ;; Mule-UCS + JISX0213 $B$N@_Dj(B -+ (setq unicode-basic-translation-charset-order-list -+ '(ascii -+ japanese-jisx0208 ;; $B0\F0(B -+ japanese-jisx0213-1 ;; $B0\F0(B -+ japanese-jisx0213-2 ;; $B0\F0(B -+ japanese-jisx0212 ;; $B0\F0(B -+ latin-iso8859-1 -+ latin-iso8859-2 -+ latin-iso8859-3 -+ latin-iso8859-4 -+ cyrillic-iso8859-5 -+ greek-iso8859-7 -+ hebrew-iso8859-8 -+ latin-iso8859-9 -+ latin-iso8859-14 -+ latin-iso8859-15 -+ ipa -+ ;; $B$b$H$O$3$3(B -+ chinese-gb2312 -+ chinese-cns11643-1 -+ chinese-cns11643-2 -+ chinese-cns11643-3 -+ chinese-cns11643-4 -+ chinese-cns11643-5 -+ chinese-cns11643-6 -+ chinese-cns11643-7 -+ chinese-big5-1 -+ chinese-big5-2 -+ korean-ksc5601 -+ latin-jisx0201 -+ katakana-jisx0201 -+ thai-tis620 -+ ethiopic -+ indian-is13194 -+ chinese-sisheng -+ lao -+ vietnamese-viscii-lower -+ vietnamese-viscii-upper -+ tibetan -+ mule-unicode-0100-24ff -+ mule-unicode-2500-33ff -+ mule-unicode-e000-ffff -+ mule-ucs-unicode-multichar)) -+ (un-define-change-charset-order)) -+ ((featurep 'un-define) -+ ;; Mule-UCS $B$N@_Dj(B -+ (setq unicode-basic-translation-charset-order-list -+ '(ascii -+ japanese-jisx0208 ;; $B0\F0(B -+ japanese-jisx0212 ;; $B0\F0(B -+ latin-iso8859-1 -+ latin-iso8859-2 -+ latin-iso8859-3 -+ latin-iso8859-4 -+ cyrillic-iso8859-5 -+ greek-iso8859-7 -+ hebrew-iso8859-8 -+ latin-iso8859-9 -+ latin-iso8859-14 -+ latin-iso8859-15 -+ ipa -+ ;; $B$b$H$O$3$3(B -+ chinese-gb2312 -+ chinese-cns11643-1 -+ chinese-cns11643-2 -+ chinese-cns11643-3 -+ chinese-cns11643-4 -+ chinese-cns11643-5 -+ chinese-cns11643-6 -+ chinese-cns11643-7 -+ chinese-big5-1 -+ chinese-big5-2 -+ korean-ksc5601 -+ latin-jisx0201 -+ katakana-jisx0201 -+ thai-tis620 -+ ethiopic -+ indian-is13194 -+ chinese-sisheng -+ lao -+ vietnamese-viscii-lower -+ vietnamese-viscii-upper -+ tibetan -+ mule-unicode-0100-24ff -+ mule-unicode-2500-33ff -+ mule-unicode-e000-ffff -+ mule-ucs-unicode-multichar)) -+ (un-define-change-charset-order))) -+ -+;; Emacs-22 $B$N(B utf-translate-cjk-mode $B$N@_DjNc(B (mule-ja ML $B$h$j(B) -+(when (fboundp 'utf-translate-cjk-set-unicode-range) -+ (utf-translate-cjk-set-unicode-range -+ '((?\x2e80 . ?\xd7a3) -+ (?\xff00 . ?\xffef) -+ (?\xa7 . ?\xa7) -+ (?\xb0 . ?\xb1) -+ (?\xb4 . ?\xb4) -+ (?\xb6 . ?\xb6) -+ (?\xd7 . ?\xd7) -+ (?\xf7 . ?\xf7) -+ (?\x370 . ?\x3ff) -+ (?\x400 . ?\x4ff) -+ (?\x2000 . ?\x206f) -+ (?\x2103 . ?\x2103) -+ (?\x212b . ?\x212b) -+ (?\x2190 . ?\x21ff) -+ (?\x2200 . ?\x22ff) -+ (?\x2300 . ?\x23ff) -+ (?\x2500 . ?\x257f) -+ (?\x25a0 . ?\x25ff) -+ (?\x2600 . ?\x26ff)))) -+ -+ -+$B!|JQ99MzNr(B -+ 2005$BG/(B 2$B7n(B28$BF|(B -+ $B?75,(B -+ -+ 2005$BG/(B 3$B7n(B 9$BF|(B -+ * egg/anthyipc.el (anthyipc-get-greeting): anthy-agent $B$N(B '6300d' $B7A<0$N(B -+ $B%P!<%8%g%sHV9f$KBP1~!#(B -+ -+ 2005$BG/(B 5$B7n(B10$BF|(B -+ * $BA02s$NJQ99$,;W$$$C$-$j4V0c$C$F$$$?(B ^^;;; $B$N$G=$@5!#(B -+ -+ 2005$BG/(B 8$B7n(B 4$BF|(B -+ * $BM9JXHV9f$r4JC1$K0z$/$?$a$NBP1~(B(add-hook)$B!#(B -+ -+ 2006$BG/(B 2$B7n(B13$BF|(B -+ * $BC18lEPO?$7$?8l6g$K%9%Z!<%9$,4^$^$l$F$$$k$HGKC>$7$F$$$?$N$r=$@5!#(B -+ => Anthy-7100b $B$GF0:n3NG'!#$=$l0J9_(B($B8=;~E@$G$O(B Anthy-7411)$B$O(B Anthy $BB&$,(B -+ $B$*$+$7$J46$8$J$N$G!"K\BNB&$N=$@5BT$A!#(B -+ * $BM9JXHV9fBP1~$O(B Anthy-7100b $B0J9_K\BN$K4^$^$l$?$N$G0UL#$,L5$/$J$C$?$?$a30(B -+ $B$7$?!#(B -+ -+ 2006$BG/(B 5$B7n(B19$BF|(B -+ * "nihonngoto[SPC][RET][SPC]qalphabet[SPC][C-g]nokonnzai[SPC][RET]" $BBP1~!#(B -+ anthyipc-read-string-type1(), anthyipc-read-string-type2() $B$rJQ99!#(B -+ -+ 2006$BG/(B 5$B7n(B24$BF|(B -+ * $BA02s$NBP1~$N=$@5!#(Banthyipc-read-string-type1() $B$N=q$-D>$7!#(B -+ -+ 2006$BG/(B 5$B7n(B25$BF|(B -+ * $B$h$/$h$/9M$($?$i!"(Bsplit-string $B$N5sF0$,(B Emacs-22 $B$H(B Emacs-20,21 $B$H$O0c(B -+ $B$&$3$H$r;W$$=P$7$?$N$G!"BP1~!#(B -+ -+ 2006$BG/(B 6$B7n(B 6$BF|(B -+ * $BF0;l$NC18lEPO?$r4V0c$C$F$$$?$N$G=$@5!#3hMQ7A$r(B anthy-dic-tool $B$KEO$7$F(B -+ $B$$$J$+$C$?$,!"$I$&$d$i:G=i$+$i$N$h$&$@!#(B -+ * $BA02s$N=$@5$G4V0c$(8+IU$1!#FsJ8@a$a0J9_$r$R$i$,$J!"%+%?%+%J$K$G$-$J$+$C$?!#(B -+ -+ 2007$BG/(B 4$B7n(B19$BF|(B -+ * Anthy $B$N(B utf-8 $BBP1~!#(BReadme $B$NDI5-!#(B -+ * elisp $B$N(B Version $B$NIU$1J}$rJQ$($?!#(B -+ -+$B0J>e!*(B -+ -+ -+Local Variables: -+mode: outline -+mode: numbered-outline -+numbered-outline-begin-number: 1 -+mode: auto-fill -+fill-column: 74 -+End: -diff --git a/egg-com.el b/egg-com.el -index 6aaa58b..f4ae1c2 100644 ---- a/egg-com.el -+++ b/egg-com.el -@@ -44,62 +44,134 @@ - - ;; 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))))) --) -+(defun fixed-euc-jp-pre-write-conversion (from to) -+ (let ((work-buf (generate-new-buffer " *temp*")) -+ ch) -+ (if (stringp from) -+ (encode-coding-string from 'euc-japan nil work-buf) -+ (encode-coding-region from to 'euc-japan work-buf)) -+ (set-buffer work-buf) -+ (set-buffer-multibyte nil) -+ (goto-char (point-min)) -+ (while (not (eobp)) -+ (setq ch (following-char)) -+ (cond ((= ch #x8E) ; SS2 for JISX0201-kana -+ (delete-char 1) ; SS2 BYTE -> 0 BYTE&0x7F -+ (insert 0) -+ (forward-char 1)) -+ ((= ch #x8F) ; SS3 for JISX0212 -+ (delete-char 1) ; SS3 BYTE1 BYTE2 -> BYTE1 BYTE2&0x7F -+ (forward-char 1) -+ (setq ch (following-char)) -+ (delete-char 1) -+ (insert (logand ch #x7F))) -+ ((>= ch #xA0) ; JISX0208 -+ (forward-char 2)) -+ (t ; ASCII -+ (insert 0) ; BYTE -> 0 BYTE -+ (forward-char 1)))))) -+ -+(defun fixed-euc-jp-post-read-conversion (len) -+ (let ((str (string-as-unibyte (buffer-substring (point) (+ (point) len)))) -+ (pos (point)) -+ i ch1 ch2) -+ (delete-region (point) (+ (point) len)) -+ (setq i 0) -+ (while (< i len) -+ (setq ch1 (aref str i)) -+ (setq ch2 (aref str (1+ i))) -+ (cond ((>= ch1 #x80) -+ (if (>= ch2 #x80) -+ (setq ch1 ; JISX0208 -+ (decode-char 'japanese-jisx0208 -+ (logior (lsh (logand ch1 #x7F) 8) -+ (logand ch2 #x7F)))) -+ (setq ch1 ; JISX0212 -+ (decode-char 'japanese-jisx0212 -+ (logior (lsh (logand ch1 #x7F) 8) ch2))))) -+ (t -+ (if (>= ch2 #x80) -+ (setq ch1 ; JISX0201-kana -+ (decode-char 'katakana-jisx0201 (logand ch2 #x7F))) -+ (setq ch1 ch2)))) -+ (insert ch1) -+ (setq i (+ i 2))) -+ (prog1 (- (point) pos) -+ (goto-char pos)))) - --(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)) -+(eval-and-compile -+ (if (string< mule-version "6.0") ;; for before Emacs23 -+ (progn -+ (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))))) -+ (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)) -+ ) -+ ;; Emacs23 or later -+ ;; From Handa-san. [mule-ja : No.09414] -+ (define-charset 'fixed-euc-jp -+ "Fixed EUC Japanese" -+ :dimension 2 -+ :superset '(ascii -+ (katakana-jisx0201 . #x80) -+ (japanese-jisx0208 . #x8080) -+ (japanese-jisx0212 . #x8000))) -+ (define-coding-system 'fixed-euc-jp -+ "Coding System for fixed EUC Japanese" -+ :mnemonic ?W -+ :coding-type 'charset -+ :charset-list '(fixed-euc-jp)) -+ ) -+ ) - - ;; Korean - -@@ -757,7 +829,7 @@ V: Fixed length string (0x00 terminated). This takes 2 args (data length)." - (defmacro comm-accept-process-output () - `(let ((p (point))) - (if (null (accept-process-output proc comm-accept-timeout)) -- (egg-error "backend timeout")) -+ (egg-error "backend timeout (comm-accept-process-output)")) - (goto-char p))) - - (defmacro comm-require-process-output (n) -@@ -769,7 +841,7 @@ V: Fixed length string (0x00 terminated). This takes 2 args (data length)." - (r (+ (point) n))) - (while (< (point-max) r) - (if (null (accept-process-output proc comm-accept-timeout)) -- (egg-error "backend timeout")) -+ (egg-error "backend timeout (comm-wait-for-space)")) - (goto-char p)))) - - (defmacro comm-following+forward-char () -@@ -893,7 +965,7 @@ See `comm-format' for FORMAT." - `(let* ((proc ,proc) - (buffer (process-buffer proc)) - ,@vlist) -- (if (and (eq (process-status proc) 'open) -+ (if (and (memq (process-status proc) '(open run)) - (buffer-live-p buffer)) - (save-excursion - (set-buffer buffer) -diff --git a/egg/anthy.el b/egg/anthy.el -index ed1c93e..622453f 100644 ---- a/egg/anthy.el -+++ b/egg/anthy.el -@@ -6,6 +6,7 @@ - ;; Author: NIIBE Yutaka - - ;; Maintainer: NIIBE Yutaka -+;; Hideyuki SHIRAI - - ;; Keywords: mule, multilingual, input method - -@@ -28,193 +29,492 @@ - - ;;; Commentary: - -- - ;;; Code: - - (require 'egg) - (require 'egg-edep) - --(defgroup anthy nil -+(defgroup anthy-egg nil - "Anthy interface for Tamago 4." - :group 'egg) - --(setplist 'anthy-conversion-backend -- '(egg-start-conversion anthy-convert -- egg-get-bunsetsu-source anthy-get-bunsetsu-source -- egg-get-bunsetsu-converted anthy-get-bunsetsu-converted -- egg-list-candidates anthy-get-candidates -- egg-decide-candidate anthy-select-candidate -- egg-change-bunsetsu-length anthy-resize-segment -- egg-end-conversion anthy-commit -+(defcustom anthy-egg-use-utf8 nil -+ "*Use UTF-8 for anthy-agent and anthy-dic-tool." -+ :group 'anthy-egg -+ :type '(choice (const :tag "Use UTF8" t) -+ (const :tag "No use UTF8" nil))) -+ -+(defcustom anthy-egg-input-method-list '("japanese-egg-anthy") -+ "*List of input method to use egg-anthy." -+ :group 'anthy-egg -+ :type '(repeat (string :format "Input method: %v\n" :size 0))) -+ -+(defcustom anthy-egg-use-chinese-korean-server nil -+ "*Use egg-anthy with Chinese and/or Korean servers." -+ :group 'anthy-egg -+ :type '(choice (const :tag "Use Anthy with Chinese and/or Korean servers" t) -+ (const :tag "No use" nil))) -+ -+(setplist 'anthy-egg-conversion-backend -+ '(egg-start-conversion anthy-egg-convert -+ egg-get-bunsetsu-source anthy-egg-get-bunsetsu-source -+ egg-get-bunsetsu-converted anthy-egg-get-bunsetsu-converted -+ egg-list-candidates anthy-egg-get-candidates -+ egg-decide-candidate anthy-egg-select-candidate -+ egg-change-bunsetsu-length anthy-egg-resize-segment -+ egg-end-conversion anthy-egg-commit -+ ;; -+ egg-special-candidate anthy-egg-special-candidate -+ egg-word-registration anthy-egg-word-registration - ;; -- egg-get-source-language anthy-get-source-language -- egg-get-converted-language anthy-get-converted-language)) -+ egg-get-source-language anthy-egg-get-source-language -+ egg-get-converted-language anthy-egg-get-converted-language)) - --(defconst anthy-backend-alist '((Japanese ((anthy-conversion-backend))))) -+(defconst anthy-egg-backend-alist '((Japanese ((anthy-egg-conversion-backend))))) - --(egg-set-finalize-backend '(anthy-finalize-backend)) -+(egg-set-finalize-backend '(anthy-egg-finalize-backend)) - --(defvar anthy-proc nil -+(defvar anthy-egg-proc nil - "Process of ANTHY helper agent.") - --;; ::= ( ... ) --;; -+(defvar anthy-egg-version nil) -+(defvar anthy-egg-el-version "20070419") -+ -+(defvar anthy-egg-anthy-agent-version "") -+ -+(defun anthy-egg-version () -+ (interactive) -+ (message "anthy-egg/anthyipc/anthy-agent: %s" anthy-egg-version) -+ anthy-egg-version) -+ - ;; ::= - ;; ::= --(defvar anthy-environment-pool nil -+(defvar anthy-egg-environment-pool nil - "Environments for ANTHY kana-kanji conversion, to be used.") - --(defvar anthy-environments-in-use nil -+(defvar anthy-egg-environments-in-use nil - "Environments for ANTHY kana-kanji conversion, in use.") - - ;; - ;; ::= - ;; [ ] --(defsubst anthy-make-bunsetsu (env source converted seg-no) -+(defsubst anthy-egg-make-bunsetsu (env source converted seg-no) - (egg-bunsetsu-create -- 'anthy-conversion-backend -+ 'anthy-egg-conversion-backend - (vector env source converted nil 0 seg-no))) - --(defsubst anthybunsetsu-get-env (b) -+(defsubst anthy-egg-bunsetsu-get-env (b) - (aref (egg-bunsetsu-get-info b) 0)) --(defsubst anthybunsetsu-get-source (b) -+(defsubst anthy-egg-bunsetsu-get-source (b) - (aref (egg-bunsetsu-get-info b) 1)) --(defsubst anthybunsetsu-get-converted (b) -+(defsubst anthy-egg-bunsetsu-get-converted (b) - (aref (egg-bunsetsu-get-info b) 2)) --(defsubst anthybunsetsu-get-candidates (b) -+(defsubst anthy-egg-bunsetsu-get-candidates (b) - (aref (egg-bunsetsu-get-info b) 3)) --(defsubst anthybunsetsu-set-candidates (b z) -+(defsubst anthy-egg-bunsetsu-set-candidates (b z) - (aset (egg-bunsetsu-get-info b) 3 z)) --(defsubst anthybunsetsu-get-candidate-pos (b) -+(defsubst anthy-egg-bunsetsu-get-candidate-pos (b) - (aref (egg-bunsetsu-get-info b) 4)) --(defsubst anthybunsetsu-set-candidate-pos (b zp) -+(defsubst anthy-egg-bunsetsu-set-candidate-pos (b zp) - (aset (egg-bunsetsu-get-info b) 4 zp)) --(defsubst anthybunsetsu-get-seg-no (b) -+(defsubst anthy-egg-bunsetsu-get-seg-no (b) - (aref (egg-bunsetsu-get-info b) 5)) - --(defun anthy-get-bunsetsu-source (b) -- (anthybunsetsu-get-source b)) -+(defun anthy-egg-get-bunsetsu-source (b) -+ (anthy-egg-bunsetsu-get-source b)) - --(defun anthy-get-bunsetsu-converted (b) -- (let ((cands (anthybunsetsu-get-candidates b))) -+(defun anthy-egg-get-bunsetsu-converted (b) -+ (let ((cands (anthy-egg-bunsetsu-get-candidates b))) - (if cands -- (nth (anthybunsetsu-get-candidate-pos b) cands) -- (anthybunsetsu-get-converted b)))) -+ (nth (anthy-egg-bunsetsu-get-candidate-pos b) cands) -+ (anthy-egg-bunsetsu-get-converted b)))) -+ -+(defun anthy-egg-get-source-language (b) 'Japanese) -+(defun anthy-egg-get-converted-language (b) 'Japanese) - --(defun anthy-get-source-language (b) 'Japanese) --(defun anthy-get-converted-language (b) 'Japanese) -+(defvar anthy-egg-agent-buffer-name " *anthy-egg*") - - ;; Getting new context-descriptor, and returns environment with 'inuse' bit --(defun anthy-new-environment () -- (if (null anthy-proc) -- (let ((buf (generate-new-buffer " *ANTHY*")) -+(defun anthy-egg-new-environment () -+ (if (null anthy-egg-proc) -+ (let ((buf (get-buffer-create anthy-egg-agent-buffer-name)) -+ (cs (if anthy-egg-use-utf8 'utf-8-dos 'euc-japan-dos)) - (process-connection-type nil)) ; avoid using pty -- (setq anthy-proc -- (start-process "anthy-agent" buf "anthy-agent" "--egg")) -- (process-kill-without-query anthy-proc) -- (set-process-coding-system anthy-proc 'euc-jp-dos 'euc-jp-dos) -- (set-process-sentinel anthy-proc 'anthy-proc-sentinel) -- (set-marker-insertion-type (process-mark anthy-proc) t) -+ (setq anthy-egg-proc -+ (apply 'start-process "anthy-egg-agent" buf -+ "anthy-agent" -+ (if anthy-egg-use-utf8 -+ '("--egg" "--utf8") -+ '("--egg")))) -+ (process-kill-without-query anthy-egg-proc) -+ (set-process-coding-system anthy-egg-proc cs cs) -+ (set-process-sentinel anthy-egg-proc 'anthy-egg-proc-sentinel) -+ (set-marker-insertion-type (process-mark anthy-egg-proc) t) - (save-excursion - (set-buffer buf) - (erase-buffer) - (buffer-disable-undo)) -- (anthyipc-get-greeting anthy-proc))) -- (anthyipc-new-context anthy-proc)) -+ (anthyipc-get-greeting anthy-egg-proc))) -+ ;; Patch http://www.freebsd.org/cgi/query-pr.cgi?pr=68617 -+ (anthyipc-new-context anthy-egg-proc)) - - ;;; XXX: Don't kill buffer (for now) so that I can debug this program --(defun anthy-proc-sentinel (proc reason) --; (kill-buffer (process-buffer proc)) -- (setq anthy-proc nil -- anthy-environments-in-use nil -- anthy-environment-pool nil)) -- --;;; anthyipc-release-context -- -+(defun anthy-egg-proc-sentinel (proc reason) -+ ;; (kill-buffer (process-buffer proc)) -+ (setq anthy-egg-proc nil -+ anthy-egg-environments-in-use nil -+ anthy-egg-environment-pool nil)) - --(defun anthy-get-environment () -+(defun anthy-egg-get-environment () - "Return the ANTHY environment." -- (if anthy-environment-pool -- (let ((env (car anthy-environment-pool))) -- (setq anthy-environment-pool (cdr anthy-environment-pool)) -- (setq anthy-environments-in-use (cons env anthy-environments-in-use)) -+ (if anthy-egg-environment-pool -+ (let ((env (car anthy-egg-environment-pool))) -+ (setq anthy-egg-environment-pool (cdr anthy-egg-environment-pool)) -+ (setq anthy-egg-environments-in-use (cons env anthy-egg-environments-in-use)) - env) -- (let ((env (anthy-new-environment))) -- (setq anthy-environments-in-use (cons env anthy-environments-in-use)) -+ (let ((env (anthy-egg-new-environment))) -+ (setq anthy-egg-environments-in-use (cons env anthy-egg-environments-in-use)) - env))) - - ;; -+;; Fake egg functions for UTF-8 -+;; -+(defvar anthy-egg-force-anthy nil) -+(make-variable-buffer-local 'anthy-egg-force-anthy) -+ -+(defmacro anthy-egg-utf8-p () -+ `(and anthy-egg-use-utf8 -+ (not anthy-egg-use-chinese-korean-server) -+ (or (equal (egg-get-conversion-backend 'Japanese 0 nil) -+ '(0 (anthy-egg-conversion-backend))) -+ (and (not egg-conversion-backend-alist) -+ (member default-input-method anthy-egg-input-method-list))))) -+ -+(defadvice egg-toroku-bunsetsu (around force-anthy activate compile) -+ "Advice for force-anthy." -+ (if (anthy-egg-utf8-p) -+ (let ((anthy-egg-force-anthy t)) -+ ad-do-it) -+ ad-do-it)) -+ -+(defadvice egg-toroku-region (around force-anthy activate compile) -+ "Advice for force-anthy." -+ (if (anthy-egg-utf8-p) -+ (let ((anthy-egg-force-anthy t)) -+ ad-do-it) -+ ad-do-it)) -+ -+(defadvice egg-convert-region (around force-anthy activate compile) -+ "Advice for force-anthy." -+ (if (and (interactive-p) (anthy-egg-utf8-p)) -+ (let ((anthy-egg-force-anthy t)) -+ ad-do-it) -+ ad-do-it)) -+ -+(defadvice egg-separate-languages (around force-anthy activate compile) -+ "Advice for force-anthy." -+ (if (and anthy-egg-force-anthy -+ (or (not last-lang) -+ (eq last-lang 'Japanese))) -+ (let ((len (length str))) -+ (egg-remove-all-text-properties 0 len str) -+ (put-text-property 0 len 'egg-lang 'Japanese str)) -+ ad-do-it)) -+ -+;; - ;; Returns list of bunsetsu - ;; --(defun anthy-convert (backend yomi &optional context) -+(defun anthy-egg-convert (backend yomi &optional context) - "Convert YOMI string to kanji, and enter conversion mode. - Return the list of bunsetsu." -- (let ((env (anthy-get-environment))) -- (anthyipc-convert anthy-proc env yomi))) -+ ;; Convert Katakana to Hiragana -+ (when (eq last-command 'its-katakana) -+ (setq yomi (japanese-hiragana yomi))) -+ (let ((env (anthy-egg-get-environment))) -+ (anthyipc-convert anthy-egg-proc env yomi))) - - ;; -+;; Pool the context - ;; --;; --(defun anthy-commit (bunsetsu-list abort) -- (let ((env (anthybunsetsu-get-env (car bunsetsu-list)))) -- (anthyipc-commit anthy-proc env (if abort 1 0)) -- (setq anthy-environment-pool (cons env anthy-environment-pool)) -- (setq anthy-environments-in-use (delq env anthy-environments-in-use)))) -+(defun anthy-egg-commit (bunsetsu-list abort) -+ (let ((env (anthy-egg-bunsetsu-get-env (car bunsetsu-list)))) -+ (anthyipc-commit anthy-egg-proc env (if abort 1 0)) -+ ;; Guard twice pool in egg-decide-before-point() -+ ;; Add. Hideyuki SHIRAI at 2005-02-10 -+ (unless (memq env anthy-egg-environment-pool) -+ (setq anthy-egg-environment-pool (cons env anthy-egg-environment-pool))) -+ (setq anthy-egg-environments-in-use (delq env anthy-egg-environments-in-use)) -+ (anthy-egg-debug-check))) - - ;; - ;; Returns ( ) - ;; --(defun anthy-get-candidates (bunsetsu-list prev-bunsetsu next-bunsetsu major) -+(defun anthy-egg-get-candidates (bunsetsu-list prev-bunsetsu next-bunsetsu major) - (let ((bunsetsu (car bunsetsu-list))) -- (if (anthybunsetsu-get-candidates bunsetsu) -- (cons (anthybunsetsu-get-candidate-pos bunsetsu) -- (anthybunsetsu-get-candidates bunsetsu)) -- (let* ((env (anthybunsetsu-get-env bunsetsu)) -- (seg-no (anthybunsetsu-get-seg-no bunsetsu)) -- (cands (anthyipc-get-candidates anthy-proc env seg-no))) -- (cons (anthybunsetsu-set-candidate-pos bunsetsu 0) -- (anthybunsetsu-set-candidates bunsetsu cands)))))) -+ (if (anthy-egg-bunsetsu-get-candidates bunsetsu) -+ (cons (anthy-egg-bunsetsu-get-candidate-pos bunsetsu) -+ (anthy-egg-bunsetsu-get-candidates bunsetsu)) -+ (let* ((env (anthy-egg-bunsetsu-get-env bunsetsu)) -+ (seg-no (anthy-egg-bunsetsu-get-seg-no bunsetsu)) -+ (cands (anthyipc-get-candidates anthy-egg-proc env seg-no))) -+ (cons (anthy-egg-bunsetsu-set-candidate-pos bunsetsu 0) -+ (anthy-egg-bunsetsu-set-candidates bunsetsu cands)))))) - - ;; Returns list of list of bunsetsu --(defun anthy-select-candidate (bunsetsu-list candidate-pos prev-b next-b) -+(defun anthy-egg-select-candidate (bunsetsu-list candidate-pos prev-b next-b) - (let* ((bunsetsu (car bunsetsu-list)) -- (candidate-list (anthybunsetsu-get-candidates bunsetsu)) -+ (candidate-list (anthy-egg-bunsetsu-get-candidates bunsetsu)) - (candidate (nth candidate-pos candidate-list)) -- (env (anthybunsetsu-get-env bunsetsu)) -- (seg-no (anthybunsetsu-get-seg-no bunsetsu))) -- (anthybunsetsu-set-candidate-pos bunsetsu candidate-pos) -+ (env (anthy-egg-bunsetsu-get-env bunsetsu)) -+ (seg-no (anthy-egg-bunsetsu-get-seg-no bunsetsu))) -+ (anthy-egg-bunsetsu-set-candidate-pos bunsetsu candidate-pos) - ;; Anthy doesn't have capability of changing another segment - ;; at the selection of a segment. - ;; So, just ignore the result of "SELECT-CANDIDATE" -- (anthyipc-select-candidate anthy-proc env seg-no candidate-pos) -+ (anthyipc-select-candidate anthy-egg-proc env seg-no candidate-pos) - (list (list bunsetsu)))) - - ;; Returns list of list of bunsetsu --(defun anthy-resize-segment (bunsetsu-list prev-b next-b len major) -+(defun anthy-egg-resize-segment (bunsetsu-list prev-b next-b len major) - (let ((bunsetsu (car bunsetsu-list))) -- (let ((env (anthybunsetsu-get-env bunsetsu)) -- (seg-no (anthybunsetsu-get-seg-no bunsetsu)) -- (prevlen (length (anthybunsetsu-get-source bunsetsu)))) -- (let ((r (anthyipc-resize-segment anthy-proc env seg-no -+ (let ((env (anthy-egg-bunsetsu-get-env bunsetsu)) -+ (seg-no (anthy-egg-bunsetsu-get-seg-no bunsetsu)) -+ (prevlen (length (anthy-egg-bunsetsu-get-source bunsetsu)))) -+ (let ((r (anthyipc-resize-segment anthy-egg-proc env seg-no - (if (< prevlen len) 0 1)))) -- ;; XXX: I don't know what this means, -+ ;; XXX: I don't know what this means, - ;; but this works. Blame EGG. - (list (list (car r)) nil (cdr r)))))) - --(defun anthy-finalize-backend () -- (if anthy-proc -- (progn -- (delete-process anthy-proc) -- (setq anthy-proc nil)))) -+(defun anthy-egg-finalize-backend () -+ (when anthy-egg-proc -+ (delete-process anthy-egg-proc) -+ (setq anthy-egg-proc nil))) -+ -+;; -+;; Add. Hideyuki SHIRAI at 2005-02-10 -+(defvar anthy-egg-debug t -+ "*Enable debug for egg-anthy.") -+ -+(defvar anthy-egg-debug-depth 15 -+ "*Display message when over this.") -+ -+(defadvice egg-abort-conversion (before release-content activate) -+ "Advice on anthy.el" -+ (anthy-egg-pool-content)) -+ -+(defadvice egg-decide-before-point (before release-content activate) -+ "Advice on anthy.el" -+ (anthy-egg-pool-content)) -+ -+(defun anthy-egg-pool-content () -+ "Used context move to `pool'." -+ (let* ((bunsetsu (egg-get-bunsetsu-info (point))) -+ (backend (car bunsetsu)) -+ env) -+ (when (eq backend 'anthy-egg-conversion-backend) -+ (setq env (anthy-egg-bunsetsu-get-env bunsetsu)) -+ ;; Guard twice pool in egg-decide-before-point() -+ (unless (memq env anthy-egg-environment-pool) -+ (setq anthy-egg-environment-pool (cons env anthy-egg-environment-pool))) -+ (setq anthy-egg-environments-in-use (delq env anthy-egg-environments-in-use)) -+ (anthy-egg-debug-check)))) -+ -+(defun anthy-egg-debug-check () -+ "Debug message." -+ (when (and anthy-egg-debug -+ (> (length anthy-egg-environments-in-use) anthy-egg-debug-depth)) -+ (message "egg-anthy debug: in-use %d, pool %d with `%s' => `%s'." -+ (length anthy-egg-environments-in-use) -+ (length anthy-egg-environment-pool) -+ (symbol-name last-command) (symbol-name this-command)) -+ (sit-for 1.5))) -+ -+(defun anthy-egg-recover () -+ "Recover error Anthy." -+ (interactive) -+ (when anthy-egg-proc -+ (delete-process anthy-egg-proc) -+ (setq anthy-egg-proc nil)) -+ (setq anthy-egg-environments-in-use nil) -+ (setq anthy-egg-environment-pool nil)) -+ -+(defun anthy-egg-special-candidate (bunsetsu prev-b next-b major type) -+ "Suport Hiragana, Katakana." -+ (let* ((head (car bunsetsu)) -+ (backend (egg-bunsetsu-get-backend head)) -+ (lang (get backend 'language)) -+ source converted zenkouho-list kouho-list pos) -+ ;; Japnese only -+ (setq source (anthy-egg-get-bunsetsu-source head)) -+ (cond ((eq type 'egg-hiragana) -+ (setq converted source)) -+ ((eq type 'egg-katakana) -+ (setq converted (japanese-katakana source)))) -+ (setq zenkouho-list -+ (cdr (anthy-egg-get-candidates bunsetsu prev-b next-b major))) -+ (setq pos -+ (when (setq kouho-list (member converted zenkouho-list)) -+ (- (length zenkouho-list) (length kouho-list)))) -+ (when pos -+ (anthy-egg-select-candidate bunsetsu pos prev-b next-b)))) -+ -+;; -+;; Dictionary add -+;; freq $B$O$$$/$D$,NI$$$N$+!)(B 1, 10, 100, 1000? $BA*Br!)(B -+(defvar anthy-egg-hinshi-menu '(("$B0lHLL>;l(B" . NOUN) -+ ("$B8GM-L>;l(B" . PROPER_NOUN) -+ ("$B7AMF;l(B" . ADJECTIVE) -+ ("$BI{;l(B" . ADV) -+ ("$BF0;l(B" . VERB)) -+ "*Anthy $B$N<-=qEPO?MQIJ;l(B.") -+ -+(defvar anthy-egg-hinshi-proper-menu '("$B?ML>(B" "$BCOL>(B") -+ "*Anthy $B$N8GM-L>;l(B") -+ -+(defvar anthy-egg-hinshi-verb-menu '(("$B%+9T8^CJ3hMQ(B" . "$B%+9T8^CJ(B") -+ ("$B%,9T8^CJ3hMQ(B" . "$B%,9T8^CJ(B") -+ ("$B%59T8^CJ3hMQ(B" . "$B%59T8^CJ(B") -+ ("$B%?9T8^CJ3hMQ(B" . "$B%?9T8^CJ(B") -+ ("$B%J9T8^CJ3hMQ(B" . "$B%J9T8^CJ(B") -+ ("$B%P9T8^CJ3hMQ(B" . "$B%P9T8^CJ(B") -+ ("$B%^9T8^CJ3hMQ(B" . "$B%^9T8^CJ(B") -+ ("$B%i9T8^CJ3hMQ(B" . "$B%i9T8^CJ(B") -+ ("$B%o9T8^CJ3hMQ(B" . "$B%o9T8^CJ(B")) -+ "*Anthy $B$NF0;l3hMQ7?(B.") -+ -+ -+(defvar anthy-egg-dic-util-command "anthy-dic-tool") -+(defvar anthy-egg-dic-buffer-name " *anthy-egg-dic*") -+ -+(defun anthy-egg-add-word-compose-paramlist (param) -+ (let ((str "")) -+ (while param -+ (let* ((cur (car param)) -+ (var (car cur)) -+ (val (if (stringp (cdr cur)) -+ (cdr cur) -+ (if (cdr cur) "y" "n")))) -+ (setq str (concat str -+ var " = " val "\n"))) -+ (setq param (cdr param))) -+ str)) -+ -+(defun anthy-egg-add-word (yomi freq word paramlist) -+ (let ((buf (get-buffer-create anthy-egg-dic-buffer-name)) -+ (cs (if anthy-egg-use-utf8 'utf-8-unix 'euc-japan-unix)) -+ proc) -+ (save-excursion -+ (set-buffer buf) -+ (setq proc (apply 'start-process "anthy-egg-dic" buf -+ anthy-egg-dic-util-command -+ (if anthy-egg-use-utf8 -+ '("--append" "--utf8") -+ '("--append")))) -+ (when proc -+ (set-process-coding-system proc cs cs) -+ (set-process-sentinel proc -+ (lambda (proc event) -+ (let ((buf (process-buffer proc))) -+ (when (and (process-buffer proc) -+ (buffer-name (process-buffer proc))) -+ (kill-buffer (process-buffer proc)))))) -+ (process-send-string proc -+ (concat yomi " " -+ (int-to-string freq) " " -+ word "\n")) -+ (process-send-string proc -+ (anthy-egg-add-word-compose-paramlist paramlist)) -+ (process-send-string proc "\n") -+ (process-send-eof proc) -+ t)))) -+ -+(defun anthy-egg-hinshi-NOUN (kanji) -+ (let ((res '(("$BIJ;l(B" . "$BL>;l(B"))) -+ (na (y-or-n-p (format " $B!V(B%s$B$J!W$H8@$$$^$9$+(B? " kanji))) -+ (sa (y-or-n-p (format " $B!V(B%s$B$5!W$H8@$$$^$9$+(B? " kanji))) -+ (suru (y-or-n-p (format " $B!V(B%s$B$9$k!W$H8@$$$^$9$+(B? " kanji))) -+ (ind (y-or-n-p (format " $B!V(B%s$B!W$OC1FH$GJ8@a$K$J$j$^$9$+(B? " kanji))) -+ (kaku (y-or-n-p (format " $B!V(B%s$B$H!W$H8@$$$^$9$+(B? " kanji)))) -+ (setq res (cons `("$B$J@\B3(B" . ,na) res)) -+ (setq res (cons `("$B$5@\B3(B" . ,sa) res)) -+ (setq res (cons `("$B$9$k@\B3(B" . ,suru) res)) -+ (setq res (cons `("$B8l44$N$_$GJ8@a(B" . ,ind) res)) -+ (setq res (cons `("$B3J=u;l@\B3(B" . ,kaku) res)) -+ res)) -+ -+(defun anthy-egg-hinshi-PROPER_NOUN (kanji) -+ `(("$BIJ;l(B" . ,(menudiag-select (list 'menu -+ (format "(%s) $B3hMQ7O(B:" kanji) -+ anthy-egg-hinshi-proper-menu))))) -+ -+(defun anthy-egg-hinshi-PERSONAL (kanji) -+ '(("$BIJ;l(B" . "$B?ML>(B"))) -+ -+(defun anthy-egg-hinshi-PLACE (kanji) -+ '(("$BIJ;l(B" . "$BCOL>(B"))) -+ -+(defun anthy-egg-hinshi-ADJECTIVE (kanji) -+ '(("$BIJ;l(B" . "$B7AMF;l(B"))) -+ -+(defun anthy-egg-hinshi-ADV (kanji) -+ (let ((res '(("$BIJ;l(B" . "$BI{;l(B"))) -+ (to (y-or-n-p (format " $B!V(B%s$B$H!W$H8@$$$^$9$+(B? " kanji))) -+ (taru (y-or-n-p (format " $B!V(B%s$B$?$k!W$H8@$$$^$9$+(B? " kanji))) -+ (suru (y-or-n-p (format " $B!V(B%s$B$9$k!W$H8@$$$^$9$+(B? " kanji))) -+ (ind (y-or-n-p (format " $B!V(B%s$B!W$OC1FH$GJ8@a$K$J$j$^$9$+(B? " kanji)))) -+ (setq res (cons `("$B$H@\B3(B" . ,to) res)) -+ (setq res (cons `("$B$?$k@\B3(B" . ,taru) res)) -+ (setq res (cons `("$B$9$k@\B3(B" . ,suru) res)) -+ (setq res (cons `("$B8l44$N$_$GJ8@a(B" . ,ind) res)) -+ res)) -+ -+(defun anthy-egg-hinshi-VERB (kanji) -+ (let* ((res '(("$BIJ;l(B" . "$BF0;l(B"))) -+ (key (menudiag-select (list 'menu -+ (format "(%s) $B3hMQ7O(B:" kanji) -+ anthy-egg-hinshi-verb-menu))) -+ (meishi (y-or-n-p (format "%s: $BO"BN7A$rL>;l2=$7$^$9$+(B? " kanji)))) -+ (setq res (cons `("$B3hMQ(B" . ,key) res)) -+ (setq res (cons `("$BO"MQ7A$NL>;l2=(B" . ,meishi) res)) -+ res)) -+ -+(defun anthy-egg-hinshi-select (kanji yomi) -+ (let ((key (menudiag-select (list 'menu -+ (concat kanji"(" yomi ") " "$BIJ;l(B:") -+ anthy-egg-hinshi-menu)))) -+ (cond ((symbolp key) -+ (funcall (intern (concat "anthy-egg-hinshi-" (symbol-name key))) -+ kanji)) -+ ((stringp key) -+ (cdr (assoc key anthy-egg-hinshi-menu)))))) -+ -+(defun anthy-egg-word-registration-add (kanji yomi) -+ (let (param freq) -+ (setq param (nreverse (anthy-egg-hinshi-select kanji yomi))) -+ (if (anthy-egg-add-word yomi 1000 kanji param) -+ (list (cdr (car param)) "$B%f!<%6<-=q(B") -+ (message "%s (%s) $B$NEPO?$K<:GT$7$^$7$?(B" kanji yomi)))) -+ -+(defun anthy-egg-word-registration (backend kanji yomi) -+ "Register a word KANJI with a pronunciation YOMI." -+ (if (or (null (eq (egg-get-language 0 kanji) -+ (anthy-egg-get-converted-language backend))) -+ (next-single-property-change 0 'egg-lang kanji) -+ (null (eq (egg-get-language 0 yomi) -+ (anthy-egg-get-source-language backend))) -+ (next-single-property-change 0 'egg-lang yomi)) -+ (egg-error "word registration: invalid character") -+ (anthy-egg-word-registration-add kanji yomi))) - - ;;; setup - - (load "egg/anthyipc") --(run-hooks 'anthy-load-hook) -+(run-hooks 'anthy-egg-load-hook) - - ;;;###autoload - (defun egg-activate-anthy (&rest arg) - "Activate ANTHY backend of Tamago 4." -- (apply 'egg-mode (append arg anthy-backend-alist))) -+ (apply 'egg-mode (append arg anthy-egg-backend-alist))) - - ;;; egg/anthy.el ends here. -diff --git a/egg/anthyipc.el b/egg/anthyipc.el -index 347bdf6..607f065 100644 ---- a/egg/anthyipc.el -+++ b/egg/anthyipc.el -@@ -6,6 +6,7 @@ - ;; Author: NIIBE Yutaka - - ;; Maintainer: NIIBE Yutaka -+;; Hideyuki SHIRAI - - ;; Keywords: mule, multilingual, input method - -@@ -30,6 +31,14 @@ - - - ;;; Code: -+(defvar anthy-egg-anthyipc-version "20070419") -+ -+(eval-when-compile -+ (defvar anthy-egg-proc) -+ (defvar anthy-egg-version) -+ (defvar anthy-egg-el-version) -+ (defvar anthy-egg-anthyipc-version) -+ (defvar anthy-egg-anthy-agent-version)) - - (defmacro anthyipc-call-with-proc (proc vlist send-expr &rest receive-exprs) - `(let* ((proc ,proc) -@@ -46,21 +55,21 @@ - ,@receive-exprs) - (egg-error "process %s was killed" proc)))) - --(defun anthyipc-wait-line () -+(defsubst anthyipc-wait-line () - (let ((start (point))) - (while (not (search-forward "\n" nil 1)) -- (accept-process-output proc 1000) -+ (accept-process-output anthy-egg-proc 1000) - (goto-char start)) - (goto-char start))) - --(defun anthyipc-accept-ok () -+(defsubst anthyipc-accept-ok () - (anthyipc-wait-line) - (if (eq (char-after) ?+) - ;; "+OK" - (goto-char (point-max)) - (egg-error "protocol error: %s" (buffer-substring (point) (point-max))))) - --(defun anthyipc-accept-number () -+(defsubst anthyipc-accept-number () - (anthyipc-wait-line) - (if (eq (char-after) ?+) - ;; "+OK " -@@ -71,15 +80,90 @@ - (goto-char (point-max)))) - (egg-error "protocol error: %s" (buffer-substring (point) (point-max))))) - --(defun anthyipc-read-string () -+(if (equal (split-string " " " ") '("" "")) -+ (defalias 'egg-anthy-split-string 'split-string) -+ (defun egg-anthy-split-string (string separators) -+ "Split STRING from Emacs-22." -+ (let ((keep-nulls t) -+ (rexp separators) -+ (start 0) -+ notfirst -+ (list nil)) -+ (while (and (string-match rexp string -+ (if (and notfirst -+ (= start (match-beginning 0)) -+ (< start (length string))) -+ (1+ start) start)) -+ (< start (length string))) -+ (setq notfirst t) -+ (if (or keep-nulls (< start (match-beginning 0))) -+ (setq list -+ (cons (substring string start (match-beginning 0)) -+ list))) -+ (setq start (match-end 0))) -+ (if (or keep-nulls (< start (length string))) -+ (setq list -+ (cons (substring string start) -+ list))) -+ (nreverse list)))) -+ -+(defsubst anthyipc-read-string-type1 () - (if (eq (char-after) ?\ ) -- (forward-char 1)) -- (let ((start (point))) -- (while (and (char-after) -- (not (eq (char-after) ?\ )) -- (not (eq (char-after) ?\n))) - (forward-char 1)) -- (buffer-substring start (point)))) -+ (cond -+ ((looking-at "\\([^ ]+\\) \\([^ \n]+\\)\n") -+ ;; $B%9%Z!<%9$,$R$H$D(B -+ ;; $BJQ498e(B($B%9%Z!<%9(B)$BFI$_$,$J(B $B$N0lHLE*$J%Q%?!<%s(B ($B9bB.2=$N$?$a(B) -+ (prog1 -+ (cons (match-string-no-properties 1) (match-string-no-properties 2)) -+ (end-of-line))) -+ ((not (looking-at ".* .*$")) -+ ;; $B%9%Z!<%9$,$R$H$D$bL5$+$C$?$i%(%i!<(B -+ (egg-error "protocol error: %s" -+ (buffer-substring-no-properties (point) (line-end-position)))) -+ (t -+ ;; $BJ#?t8D$N%9%Z!<%9$,$"$k$N$G2r@O(B -+ (let* ((line (buffer-substring-no-properties (point) (line-end-position))) -+ (elements (egg-anthy-split-string line " ")) -+ (sum (length elements))) -+ (if (or (< sum 3) (= (% sum 2) 1)) -+ ;; $B6v?t8D$N%9%Z!<%9$OJQ498e$K%9%Z!<%9$,F~$C$F$$$k$H$-$@$1$J$N$G!"(B -+ ;; $B:G8e$N%9%Z!<%90J9_$rFI$_$,$J$K$9$k(B <= $B<+?.L5$7(B -+ (if (looking-at "\\(.+\\) \\([^ \n]+\\)\n") -+ (prog1 -+ (cons (match-string-no-properties 1) (match-string-no-properties 2)) -+ (end-of-line)) -+ (egg-error "protocol error: %s" line)) -+ (let* ((div (/ sum 2)) -+ conv yomi yomilst) -+ (setq yomilst (nthcdr div elements)) -+ (setcdr (nthcdr (1- div) elements) nil) -+ (setq conv (mapconcat 'identity elements " ")) -+ (setq yomi (mapconcat 'identity yomilst " ")) -+ ;; $B4q?t8D$N%9%Z!<%9$O(B -+ ;; alphabet/$B#a#l#p#h#a#b#e#t(B+$B%9%Z!<%9(B, $B%9%Z!<%9$N$_$NJQ49$N7k2L(B -+ ;; $BFI$_$HJQ498e$G%9%Z!<%9$N?t$,JQ$o$k$3$H$O$J$$(B <= $B<+?.L5$7(B -+ (if (string= conv yomi) -+ (prog1 -+ (cons conv yomi) -+ (end-of-line)) -+ ;; $BJQ498e$NC18l$K%9%Z!<%9$,6v?t8D4^$^$l$?$H$-$O:G8e$N%9%Z!<%90J9_(B -+ ;; $B$rFI$_$,$J$K$9$k(B <= $B<+?.L5$7(B -+ (if (looking-at "\\(.+\\) \\([^ \n]+\\)\n") -+ (prog1 -+ (cons (match-string-no-properties 1) (match-string-no-properties 2)) -+ (end-of-line)) -+ (egg-error "protocol error: %s" line))))))))) -+ -+(defsubst anthyipc-read-string-type2 () -+ (prog1 -+ (buffer-substring-no-properties (point) (line-end-position)) -+ (end-of-line))) -+ -+(defsubst anthyipc-egg-make-bunsetsu (env source converted seg-no) -+ (egg-bunsetsu-create -+ 'anthy-egg-conversion-backend -+ (vector env source converted nil 0 seg-no))) - - (defun anthyipc-accept-segments (env seg-no-orig) - (anthyipc-wait-line) -@@ -108,9 +192,10 @@ - (if (eq (char-after) ?\n) - (setq in-loop nil) - (let* ((num-candidates (read (current-buffer))) -- (converted (anthyipc-read-string)) -- (source (anthyipc-read-string)) -- (segment (anthy-make-bunsetsu env source converted i))) -+ (conv-source (anthyipc-read-string-type1)) -+ (converted (car conv-source)) -+ (source (cdr conv-source)) -+ (segment (anthyipc-egg-make-bunsetsu env source converted i))) - (setq i (1+ i)) - (setq segment-list (cons segment segment-list))))) - ;; XXX check if seg-no == seg-no-orig -@@ -136,7 +221,7 @@ - (anthyipc-wait-line) - (if (eq (char-after) ?\n) - (setq in-loop nil) -- (let ((candidate (anthyipc-read-string))) -+ (let ((candidate (anthyipc-read-string-type2))) - (setq candidate-list (cons candidate candidate-list))))) - ;; XXX check num-candidates and length of candidate-list??? - (forward-char 1) -@@ -147,7 +232,17 @@ - (anthyipc-call-with-proc proc () - nil - (anthyipc-wait-line) -- (message (buffer-substring (point-min) (1- (point-max)))))) -+ (goto-char (point-min)) -+ (when (looking-at "^Anthy (Version \\([^)]+\\))") -+ (setq anthy-egg-anthy-agent-version (match-string 1))) -+ (setq anthy-egg-version -+ (concat anthy-egg-el-version -+ "/" -+ anthy-egg-anthyipc-version -+ "/" -+ anthy-egg-anthy-agent-version)) -+ (unless (window-minibuffer-p (selected-window)) -+ (message (buffer-substring (point-min) (1- (point-max))))))) - - (defun anthyipc-new-context (proc) - (anthyipc-call-with-proc proc () -@@ -172,11 +267,11 @@ - (anthyipc-accept-ok))) - - ;;; Returns list of candidate --(defconst anthy-max-candidates 9999) -+(defconst anthy-egg-max-candidates 9999) - (defun anthyipc-get-candidates (proc cont seg-no) - (anthyipc-call-with-proc proc () - (insert -- (format "GET-CANDIDATES %d %d %d %d\n" cont seg-no 0 anthy-max-candidates)) -+ (format "GET-CANDIDATES %d %d %d %d\n" cont seg-no 0 anthy-egg-max-candidates)) - (let ((r (anthyipc-accept-candidates))) - (cdr r)))) - diff -Nru egg-4.1.8/debian/patches/01-debian-its.patch egg-4.2.0/debian/patches/01-debian-its.patch --- egg-4.1.8/debian/patches/01-debian-its.patch 2014-10-31 03:53:50.000000000 +0000 +++ egg-4.2.0/debian/patches/01-debian-its.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -diff --git a/its.el b/its.el -index 84cec8a..04e2940 100644 ---- a/its.el -+++ b/its.el -@@ -1561,25 +1561,23 @@ Return last state." - ;; which isn't terminated with a newline or the command `previous-line' - ;; is used in the first line of a buffer. - (defun its-next-line (&optional arg) -- "Go to the end of the line if the line isn't terminated with a newline, --otherwise run `next-line' as usual." -+ "Go to the end of the line if the line isn't terminated with a newline, otherwise run `next-line' as usual." - (interactive "p") - (if (= (line-end-position) (point-max)) - (end-of-line) - (next-line arg))) - - (defun its-previous-line (&optional arg) -- "Go to the beginning of the line if it is called in the first line of a --buffer, otherwise run `previous-line' as usual." -+ "Go to the beginning of the line if it is called in the first line of a buffer, otherwise run `previous-line' as usual." - (interactive "p") - (if (= (line-beginning-position) (point-min)) - (beginning-of-line) - (previous-line arg))) - - (substitute-key-definition 'next-line 'its-next-line -- its-mode-map global-map) -+ its-mode-map global-map) - (substitute-key-definition 'previous-line 'its-previous-line -- its-mode-map global-map) -+ its-mode-map global-map) - - (provide 'its) - diff -Nru egg-4.1.8/debian/patches/02-debian-canna.patch egg-4.2.0/debian/patches/02-debian-canna.patch --- egg-4.1.8/debian/patches/02-debian-canna.patch 2014-10-31 03:55:21.000000000 +0000 +++ egg-4.2.0/debian/patches/02-debian-canna.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,226 +0,0 @@ -diff --git a/helper/egg-helper.c b/helper/egg-helper.c -new file mode 100644 -index 0000000..57ea7c9 ---- /dev/null -+++ b/helper/egg-helper.c -@@ -0,0 +1,118 @@ -+/* -+ * egg unix domain socket connetion helper. -+ * This program is based on icanna.c (yc-el's canna unix domain socket helper) -+ * -+ * Copyright (c) 2005 ISHIKAWA Mutsumi -+ * -+*/ -+ -+/* icanna.c -+ * VERSION: 0.9.0 -+ * AUTHER: knak@ceres.dti.ne.jp -+ * DATE: 2003.9.29 -+ * LICENCE: GPL -+ */ -+ -+/* -+ * communicate unix domain IM server -+ * stdin -> IM server -> stdout -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define BFSZ (4096) /* buffer size */ -+ -+#define SUNMAX 108 /* sockaddr_un.sun_path length = 108 */ -+ -+/* -+ * connect unix domain IM server -+ */ -+int connect_server(const char *sock_path) -+{ -+ int sockfd; -+ struct sockaddr_un sun; -+ -+ /* create unix domain socket */ -+ if ((sockfd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) { -+ perror("unable open socket"); -+ exit(1); -+ } -+ -+ /* connect IM server */ -+ sun.sun_family = AF_UNIX; -+ strncpy(sun.sun_path, sock_path, SUNMAX - 1); -+ if (connect(sockfd, (struct sockaddr*)&sun, SUN_LEN(&sun)) < 0) { -+ perror("unable connect"); -+ exit(1); -+ } -+ return sockfd; -+} -+ -+/* -+ * data transport -+ * stdin -> IM server -+ * IMserver -> stdout -+ */ -+int transport(int in, int out) -+{ -+ char* buf = NULL; /* data buffer */ -+ int len = BFSZ; /* data length */ -+ int count = -1; /* read count */ -+ -+ /* read input */ -+ while (len == BFSZ) { -+ count++; -+ /* allocate data buffer */ -+ if ((buf = (char*)realloc(buf, (count + 1) * BFSZ)) == NULL) { -+ perror("realloc"); -+ exit(1); -+ } -+ /* read input to data buffer */ -+ if ((len = read(in, buf + count * BFSZ, BFSZ)) < 0) { -+ perror("read"); -+ exit(1); -+ } -+ } -+ len += count * BFSZ; -+ /* write output */ -+ if (len > 0 && write(out, buf, len) < 0) { -+ perror("write"); -+ exit(1); -+ } -+ /* destroy data buffer */ -+ free(buf); -+ return len; -+} -+ -+/* -+ * communicate unix domain IM server -+ */ -+int main(int argc, char *argv[]) -+{ -+ int server; -+ struct stat stat_buf; -+ -+ if ( argc < 2 ) { -+ fprintf(stderr, "usage: egg-helper socket_path\n"); -+ exit(1); -+ } -+ -+ /* connect IM server via unix domain socket */ -+ server = connect_server(argv[1]); -+ -+ /* transport request & response, until stdin or IM server is eof */ -+ while (1) -+ /* transport request from stdin to IM server, -+ * transport response from IM server to stdout */ -+ if (transport(0, server) == 0 || transport(server, 1) == 0) -+ /* when stdin or IM server is eof, break loop */ -+ break; -+ close(server); /* close IM server via unix domain socket */ -+ exit(0); -+} -diff --git a/egg/canna.el b/egg/canna.el -index acb5d4a..15f856e 100644 ---- a/egg/canna.el -+++ b/egg/canna.el -@@ -37,11 +37,11 @@ - "CANNA interface for Tamago 4." - :group 'egg) - --(defcustom canna-hostname "localhost" -+(defcustom canna-hostname "unix/" - "Hostname of CANNA server" - :group 'canna :type 'string) - --(defcustom canna-server-port "canna" -+(defcustom canna-server-port "/tmp/.iroha_unix/IROHA" - "A service name or a port number (should be a string) of CANNA server" - :group 'canna :type 'string) - -@@ -53,6 +53,10 @@ - "Group Name on CANNA server" - :group 'canna :type 'string) - -+(defcustom egg-canna-helper-path "egg-helper" -+ "path of canna unix domain connection helper program" -+ :group 'canna :type 'file) -+ - ; (eval-when-compile - ; (defmacro CANNA-const (c) - ; (cond ((eq c 'FileNotExist) xxxxxxxxxxxxxx) -@@ -326,14 +330,23 @@ katakana to candidates list. NOSTUDY specifies not study." - (while (and hostname-list (null proc)) - (setq hostname (or (car hostname-list) "") - hostname-list (cdr hostname-list)) -- (if (null (string-match ":" hostname)) -- (setq port canna-server-port) -- (setq port (substring hostname (match-end 0)) -- hostname (substring hostname 0 (match-beginning 0)))) -- (if (and (stringp port) (string-match "^[0-9]+$" port)) -- (setq port (string-to-int port))) -- (and (equal hostname "") -- (setq hostname (or (getenv "CANNAHOST") "localhost"))) -+ (if (null (string-match "^unix/" hostname)) -+ (progn -+ (if (null (string-match ":" hostname)) -+ (setq port canna-server-port) -+ (setq port (substring hostname (match-end 0)) -+ hostname (substring hostname 0 (match-beginning 0)))) -+ (if (and (stringp port) (string-match "^[0-9]+$" port)) -+ (setq port (string-to-int port))) -+ (and (equal hostname "") -+ (setq hostname (or (getenv "CANNAHOST") "localhost"))) -+ (setq host hostname) -+ (setq family nil)) -+ (setq family 'local) -+ (setq host nil) -+ (setq port canna-server-port) -+ (if (null (and (stringp port) (string-match "IROHA$" port))) -+ (setq port "/tmp/.iroha_unix/IROHA"))) - (let ((inhibit-quit save-inhibit-quit)) - (if (and msg - (null (y-or-n-p (format "%s failed. Try to %s? " -@@ -342,10 +355,18 @@ katakana to candidates list. NOSTUDY specifies not study." - (setq msg (format "Canna: connecting to %s..." hostname)) - (message "%s" msg) - (let ((inhibit-quit save-inhibit-quit)) -- (condition-case nil -- (setq proc (open-network-stream proc-name buf hostname port)) -- ((error quit)))) -- (when proc -+ (if (fboundp 'make-network-process) -+ (condition-case nil -+ (setq proc (make-network-process :name proc-name :buffer buf :host host :service port :family family)) -+ ((error quit))) -+ ; for old emacs (<= 21.3) bellow -+ (if (string-match "^unix/" hostname) -+ (let ((process-connection-type nil)) -+ (setq proc (start-process proc-name buf egg-canna-helper-path port))) -+ (condition-case nil -+ (setq proc (open-network-stream proc-name buf hostname port)) -+ (error quit))))) -+ (when (processp proc) - (process-kill-without-query proc) - (set-process-coding-system proc 'binary 'binary) - (set-process-sentinel proc 'canna-comm-sentinel) -@@ -353,7 +374,7 @@ katakana to candidates list. NOSTUDY specifies not study." - (setq result (cannarpc-open proc user-name)) ;; result is context - (if (= result -1) - (progn -- (delete-process proc) -+ (delete-process proc) - (setq proc nil)) - (cannarpc-notice-group-name proc result group) - (cannarpc-set-app-name proc result "EGG4")))) -@@ -632,7 +653,7 @@ Return the list of bunsetsu." - (unless (eq action 'save-only) - (while proc-list - (if (and (car proc-list) -- (eq (process-status (car proc-list)) 'open)) -+ (memq (process-status (car proc-list)) '(open run))) - (cannarpc-close (car proc-list))) - (setq proc-list (cdr proc-list))))) - (setq canna-environments nil)) diff -Nru egg-4.1.8/debian/patches/03-debian-wnn.patch egg-4.2.0/debian/patches/03-debian-wnn.patch --- egg-4.1.8/debian/patches/03-debian-wnn.patch 2014-10-31 04:09:26.000000000 +0000 +++ egg-4.2.0/debian/patches/03-debian-wnn.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,873 +0,0 @@ -diff --git a/egg/wnn.el b/egg/wnn.el -index 0f2a5ea..2c2b7b7 100644 ---- a/egg/wnn.el -+++ b/egg/wnn.el -@@ -384,6 +384,8 @@ by ':' and digit N." - (defsubst wnnenv-set-bmodify (env v) (aset (wnnenv-get-auto-learn env) 1 v)) - - (defsubst wnnenv-is-wnn6 (env) (eq (wnnenv-get-wnn-version env) 'wnn6)) -+(defsubst wnnenv-is-wnn7 (env) (eq (wnnenv-get-wnn-version env) 'wnn7)) -+(defsubst wnnenv-is-wnn8 (env) (eq (wnnenv-get-wnn-version env) 'wnn8)) - - (defvar wnn-environments nil - "Environment for Wnn conversion server") -@@ -947,7 +949,7 @@ Return the list of bunsetsu." - (let* ((head (car bunsetsu-list)) - (env (wnn-bunsetsu-get-env head))) - (prog1 -- (if (wnnenv-is-wnn6 env) -+ (if (or (wnnenv-is-wnn6 env) (wnnenv-is-wnn7 env) (wnnenv-is-wnn8 env)) - (progn - (wnn-clear-now-flag bunsetsu-list) - (wnn-merge-fi-rel head (cdr bunsetsu-list)) -@@ -1263,12 +1265,17 @@ Return the list of bunsetsu." - (defvar wnn-current-envspec-reverse nil) - (defvar wnn-server-type nil) - (defvar wnn-wnn6-server nil) -+(defvar wnn-wnn7-server nil) -+(defvar wnn-wnn8-server nil) - - (defmacro wnn-envspec-conv-param-name-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)) -+ fi-relation-learn fi-freq-func -+ ;; Wnn7/8 funcs bellow -+ yosoku-learn yosoku-max-disp yosoku-last-is-first -+ boin-kabusoku shiin-choka n-choka nihongo-kosei)) - - (defmacro wnn-envspec-conv-param-length () - (length (wnn-envspec-conv-param-name-list))) -@@ -1369,7 +1376,7 @@ is non-NIL." - `((null (or (eq ,drw nil) (eq ,drw t) - (eq ,drw 0) (eq ,drw 1) - ,@(if dmax -- `((and wnn-wnn6-server -+ `((and (or wnn-wnn6-server wnn-wnn7-server wnn-wnn8-server) - ,@(let ((x `((eq ,drw 2)))) - (when (>= dmax 3) - (nconc x `((eq ,drw 3)))) -@@ -1380,7 +1387,7 @@ is non-NIL." - `((null (or (eq ,frw nil) (eq ,frw t) - (eq ,frw 0) (eq ,frw 1) - ,@(if fmax -- `((and wnn-wnn6-server -+ `((and (or wnn-wnn6-server wnn-wnn7-server wnn-wnn8-server) - ,@(let ((x `((eq ,frw 2)))) - (when (>= fmax 3) - (nconc x `((eq ,frw 3)))) -@@ -1402,6 +1409,22 @@ is non-NIL." - `(or wnn-wnn6-server - (egg-error ,(format "%s is available only on Wnn6" func)))) - -+(defmacro wnn-wnn7-env-func (func) -+ `(or wnn-wnn7-server -+ (egg-error ,(format "%s is available only on Wnn7" func)))) -+ -+(defmacro wnn-wnn8-env-func (func) -+ `(or wnn-wnn8-server -+ (egg-error ,(format "%s is available only on Wnn8" func)))) -+ -+(defmacro wnn-wnn7-and-wnn8-env-func (func) -+ `(or (or wnn-wnn7-server wnn-wnn8-server) -+ (egg-error ,(format "%s is available only on Wnn7/Wnn8" func)))) -+ -+(defmacro wnn-wnn678-env-func (func) -+ `(or (or wnn-wnn6-server wnn-wnn7-server wnn-wnn8-server) -+ (egg-error ,(format "%s is available only on Wnn6/Wnn7/Wnn8" func)))) -+ - (defun wnn-add-dict (dict freq priority dict-rw freq-rw - &optional dict-passwd freq-passwd &rest reverse) - (wnn-add-dict-param-check wnn-add-dict -@@ -1412,7 +1435,7 @@ is non-NIL." - dict-passwd freq-passwd reverse)) - - (defun wnn-add-fisys-dict (dict freq freq-rw &optional freq-passwd) -- (wnn-wnn6-env-func wnn-add-fisys-dict) -+ (wnn-wnn678-env-func wnn-add-fisys-dict) - (wnn-add-dict-param-check wnn-add-fisys-dict - dict freq nil nil nil freq-rw 3 - nil freq-passwd) -@@ -1421,7 +1444,7 @@ is non-NIL." - - (defun wnn-add-fiusr-dict (dict freq dict-rw freq-rw - &optional dict-passwd freq-passwd) -- (wnn-wnn6-env-func wnn-add-fiusr-dict) -+ (wnn-wnn678-env-func wnn-add-fiusr-dict) - (wnn-add-dict-param-check wnn-add-fiusr-dict - dict freq nil dict-rw 3 freq-rw 3 - dict-passwd freq-passwd) -@@ -1431,7 +1454,7 @@ is non-NIL." - - (defun wnn-add-notrans-dict (dict priority dict-rw - &optional dict-passwd &rest reverse) -- (wnn-wnn6-env-func wnn-add-notrans-dict) -+ (wnn-wnn678-env-func wnn-add-notrans-dict) - (wnn-add-dict-param-check wnn-add-notrans-dict - dict nil priority dict-rw nil nil nil - dict-passwd nil reverse) -@@ -1442,7 +1465,7 @@ is non-NIL." - - (defun wnn-add-bmodify-dict (dict priority dict-rw - &optional dict-passwd &rest reverse) -- (wnn-wnn6-env-func wnn-add-notrans-dict) -+ (wnn-wnn678-env-func wnn-add-notrans-dict) - (wnn-add-dict-param-check wnn-add-bmodify-dict - dict nil priority dict-rw nil nil nil - dict-passwd nil reverse) -@@ -1466,22 +1489,22 @@ is non-NIL." - (t (wnn-arg-type-error ,func))))) - - (defun wnn-set-last-is-first-mode (flag) -- (wnn-wnn6-env-func wnn-set-last-is-first-mode) -+ (wnn-wnn678-env-func wnn-set-last-is-first-mode) - (wnn-boolean-param-check wnn-set-last-is-first-mode flag) - (wnn-envspec-set-conv-param-last-is-first wnn-current-envspec flag)) - - (defun wnn-set-complex-conv-mode (flag) -- (wnn-wnn6-env-func wnn-set-complex-conv-mode) -+ (wnn-wnn678-env-func wnn-set-complex-conv-mode) - (wnn-boolean-param-check wnn-set-complex-conv-mode flag) - (wnn-envspec-set-conv-param-complex wnn-current-envspec flag)) - - (defun wnn-set-okuri-learn-mode (flag) -- (wnn-wnn6-env-func wnn-set-okuri-learn-mode) -+ (wnn-wnn678-env-func wnn-set-okuri-learn-mode) - (wnn-boolean-param-check wnn-set-okuri-learn-mode flag) - (wnn-envspec-set-conv-param-okuri-learn wnn-current-envspec flag)) - - (defun wnn-set-okuri-flag (mode) -- (wnn-wnn6-env-func wnn-set-okuri-flag) -+ (wnn-wnn678-env-func wnn-set-okuri-flag) - (setq mode (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) -@@ -1489,29 +1512,29 @@ is non-NIL." - (wnn-envspec-set-conv-param-okuri wnn-current-envspec mode)) - - (defun wnn-set-prefix-learn-mode (flag) -- (wnn-wnn6-env-func wnn-set-prefix-learn-mode) -+ (wnn-wnn678-env-func wnn-set-prefix-learn-mode) - (wnn-boolean-param-check wnn-set-prefix-learn-mode flag) - (wnn-envspec-set-conv-param-prefix-learn wnn-current-envspec flag)) - - (defun wnn-set-prefix-flag (mode) -- (wnn-wnn6-env-func wnn-set-prefix-flag) -+ (wnn-wnn678-env-func wnn-set-prefix-flag) - (setq mode (cond ((or (eq mode 0) (eq mode 'hiragana)) 0) - ((or (eq mode 1) (eq mode 'kanji)) 1) - (t (wnn-arg-type-error wnn-set-prefix-flag)))) - (wnn-envspec-set-conv-param-prefix wnn-current-envspec mode)) - - (defun wnn-set-suffix-learn-mode (flag) -- (wnn-wnn6-env-func wnn-set-suffix-learn-mode) -+ (wnn-wnn678-env-func wnn-set-suffix-learn-mode) - (wnn-boolean-param-check wnn-set-suffix-learn-mode flag) - (wnn-envspec-set-conv-param-suffix-learn wnn-current-envspec flag)) - - (defun wnn-set-common-learn-mode (flag) -- (wnn-wnn6-env-func wnn-set-common-learn-mode) -+ (wnn-wnn678-env-func wnn-set-common-learn-mode) - (wnn-boolean-param-check wnn-set-common-learn-mode flag) - (wnn-envspec-set-conv-param-common-learn wnn-current-envspec flag)) - - (defun wnn-set-freq-func-mode (mode) -- (wnn-wnn6-env-func wnn-set-freq-func-mode) -+ (wnn-wnn678-env-func wnn-set-freq-func-mode) - (setq mode (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) -@@ -1521,7 +1544,7 @@ is non-NIL." - (wnn-envspec-set-conv-param-freq-func wnn-current-envspec mode)) - - (defun wnn-set-numeric-mode (mode) -- (wnn-wnn6-env-func wnn-set-numeric-mode) -+ (wnn-wnn678-env-func wnn-set-numeric-mode) - (setq mode (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) -@@ -1533,14 +1556,14 @@ is non-NIL." - (wnn-envspec-set-conv-param-numeric wnn-current-envspec mode)) - - (defun wnn-set-alphabet-mode (mode) -- (wnn-wnn6-env-func wnn-set-alphabet-mode) -+ (wnn-wnn678-env-func wnn-set-alphabet-mode) - (setq mode (cond ((or (eq mode -4) (eq mode 'han)) -4) - ((or (eq mode -30) (eq mode 'zen)) -30) - (t (wnn-arg-type-error wnn-set-alphabet-mode)))) - (wnn-envspec-set-conv-param-alphabet wnn-current-envspec mode)) - - (defun wnn-set-symbol-mode (mode) -- (wnn-wnn6-env-func wnn-set-symbol-mode) -+ (wnn-wnn678-env-func wnn-set-symbol-mode) - (setq mode (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) -@@ -1548,21 +1571,59 @@ is non-NIL." - (wnn-envspec-set-conv-param-symbol wnn-current-envspec mode)) - - (defun wnn-set-yuragi-mode (flag) -- (wnn-wnn6-env-func wnn-set-yuragi-mode) -+ (wnn-wnn678-env-func wnn-set-yuragi-mode) - (wnn-boolean-param-check wnn-set-yuragi-mode flag) - (wnn-envspec-set-conv-param-yuragi wnn-current-envspec flag)) - - (defun wnn-set-rendaku-mode (flag) -- (wnn-wnn6-env-func wnn-set-rendaku-mode) -+ (wnn-wnn678-env-func wnn-set-rendaku-mode) - (wnn-boolean-param-check wnn-set-rendaku-mode flag) - (wnn-envspec-set-conv-param-rendaku wnn-current-envspec flag)) -+ -+;; added for Wnn7 -+(defun wnn-set-yosoku-learn-mode (flag) -+ (wnn-wnn7-and-wnn8-env-func wnn-set-yosoku-learn-mode) -+ (wnn-boolean-param-check wnn-set-yosoku-learn-mode flag) -+ (wnn-envspec-set-conv-param-yosoku-learn wnn-current-envspec flag)) -+ -+(defun wnn-set-yosoku-max-disp (mode) -+ (wnn-wnn7-and-wnn8-env-func wnn-set-yosoku-max-disp) -+ (setq mode (cond ((and (<= mode 10) (>= mode 1) mode)) -+ (t (wnn-arg-type-error wnn-set-yosoku-max-disp)))) -+ (wnn-envspec-set-conv-param-yosoku-max-disp wnn-current-envspec mode)) -+ -+(defun wnn-set-yosoku-last-is-first-mode (flag) -+ (wnn-wnn7-and-wnn8-env-func wnn-set-yosoku-last-is-first-mode) -+ (wnn-boolean-param-check wnn-set-yosoku-last-is-first-mode flag) -+ (wnn-envspec-set-conv-param-yosoku-last-is-first wnn-current-envspec flag)) -+ -+(defun wnn-set-boin-kabusoku-mode (flag) -+ (wnn-wnn7-and-wnn8-env-func wnn-set-boin-kabusoku-mode) -+ (wnn-boolean-param-check wnn-set-boin-kabusoku-mode flag) -+ (wnn-envspec-set-conv-param-boin-kabusoku wnn-current-envspec flag)) -+ -+(defun wnn-set-shiin-choka-mode (flag) -+ (wnn-wnn7-and-wnn8-env-func wnn-set-shiin-choka-mode) -+ (wnn-boolean-param-check wnn-set-shiin-choka-mode flag) -+ (wnn-envspec-set-conv-param-shiin-choka wnn-current-envspec flag)) -+ -+(defun wnn-set-n-choka-mode (flag) -+ (wnn-wnn7-and-wnn8-env-func wnn-set-n-choka-mode) -+ (wnn-boolean-param-check wnn-set-n-choka-mode flag) -+ (wnn-envspec-set-conv-param-n-choka wnn-current-envspec flag)) -+ -+(defun wnn-set-nihongo-kosei-mode (flag) -+ (wnn-wnn7-and-wnn8-env-func wnn-set-nihongo-kosei-mode) -+ (wnn-boolean-param-check wnn-set-nihongo-kosei-mode flag) -+ (wnn-envspec-set-conv-param-nihongo-kosei wnn-current-envspec flag)) -+ - - (defun wnn-renbunsetsu-conversion (env yomi hinshi fuzokugo v context) - (let ((result - (cond - ((wnnenv-get-tankan env) - (wnnrpc-tanbunsetsu-conversion env yomi hinshi fuzokugo v)) -- ((wnnenv-is-wnn6 env) -+ ((or (wnnenv-is-wnn6 env) (wnnenv-is-wnn7 env) (wnnenv-is-wnn8 env)) - (wnnrpc-fi-renbunsetsu-conversion env yomi hinshi fuzokugo v - context)) - (t -@@ -1838,6 +1899,8 @@ On failure, return negative error code." - (eq wnn-server-type 'tserver)) - "PZ")))) - (fset 'is-wnn6-server (lambda () wnn-wnn6-server)) -+ (fset 'is-wnn7-server (lambda () wnn-wnn7-server)) -+ (fset 'is-wnn8-server (lambda () wnn-wnn8-server)) - (fset 'set-wnn-fuzokugo 'wnn-set-fuzokugo) - (fset 'add-wnn-dict 'wnn-add-dict) - (fset 'set-wnn-param 'wnn-set-param) -@@ -1875,6 +1938,8 @@ environment." - wnn-envspec-list nil) - (condition-case err - (let ((wnn-server-type server-type) -+ (wnn-wnn8-server (eq version 'wnn8)) -+ (wnn-wnn7-server (eq version 'wnn7)) - (wnn-wnn6-server (eq version 'wnn6))) - (if wnn-use-v3-eggrc - (wnn-v3-eggrc-defines)) -@@ -1946,8 +2011,10 @@ environment." - (setq cvmask (wnn-envspec-conv-vmask spec) - param (wnn-envspec-conv-param spec)) - (if (/= cvmask 0) -- (wnnrpc-set-conversion-env-param env cvmask param)))) -- ((eq version 'wnn6) -+ (if (or (wnnenv-is-wnn7 env) (wnnenv-is-wnn8 env)) -+ (wnn7rpc-set-conversion-env-param env cvmask param) -+ (wnnrpc-set-conversion-env-param env cvmask param))))) -+ ((or (eq version 'wnn6) (eq version 'wnn7) (eq version 'wnn8)) - (wnnenv-set-bmodify env (wnn-get-autolearning-dic-mode - env (WNN-const BMODIFY_LEARN))) - (wnnenv-set-notrans env (wnn-get-autolearning-dic-mode -@@ -1955,7 +2022,7 @@ environment." - (cond - ((eq (wnnenv-get-server-type env) 'jserver) - (wnn-set-hinshi env 'noun "$BL>;l(B") -- (when (wnnenv-is-wnn6 env) -+ (when (or (wnnenv-is-wnn6 env) (wnnenv-is-wnn7 env) (wnnenv-is-wnn8 env)) - (wnn-set-hinshi env 'settou "$B@\F,8l(B($B$*(B)") - (wnn-set-hinshi env 'rendaku "$BO"By(B"))) - ((eq (wnnenv-get-server-type env) 'cserver) -@@ -2008,7 +2075,7 @@ environment." - (WNN-const DIC_RDONLY)))) - - (defun wnn-get-dictionary-list-with-environment (env) -- (if (wnnenv-is-wnn6 env) -+ (if (or (wnnenv-is-wnn6 env) (wnnenv-is-wnn7 env) (wnnenv-is-wnn8 env)) - (wnnrpc-get-fi-dictionary-list-with-environment env - (WNN-const DIC_NO_TEMPS)) - (wnnrpc-get-dictionary-list-with-environment env))) -diff --git a/egg/wnnrpc.el b/egg/wnnrpc.el -index 5de060b..7944008 100644 ---- a/egg/wnnrpc.el -+++ b/egg/wnnrpc.el -@@ -126,8 +126,30 @@ - ((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 'JLIB_VERSION_WNN8) ?\x4f02) - - ((eq c 'WNN_C_LOCAL) "!") - ((eq c 'WNN_FT_DICT_FILE) 1) -@@ -709,8 +731,10 @@ - (wnnrpc-get-result))) - - (defun wnnrpc-open (proc myhostname username) -- "Open the session. Return wnn4 or wnn6 on success, NIL on failure." -- (let ((type-list `((wnn6 . ,(wnn-const JLIB_VERSION_WNN6)) -+ "Open the session. Return wnn4/wnn6/wnn7 or wnn8 on success, NIL on failure." -+ (let ((type-list `((wnn8 . ,(wnn-const JLIB_VERSION_WNN8)) -+ (wnn7 . ,(wnn-const JLIB_VERSION_WNN7)) -+ (wnn6 . ,(wnn-const JLIB_VERSION_WNN6)) - (wnn4 . ,(wnn-const JLIB_VERSION)))) - (result (- (wnn-const WNN_BAD_VERSION))) - type version) -@@ -882,6 +906,38 @@ before remove and create new file." - (aref v 15) (aref v 16) (aref v 17)) - (wnnrpc-get-result))) - -+(defun wnn7rpc-set-conversion-env-param (env mask v) -+ "Set Wnn7 conversion parameter." -+ (wnnrpc-call-with-environment env () -+ (comm-format (u u u i i i i i i i i i i i i i i i i i i i i i i i i) -+ (wnn-const JS_SET_HENKAN_ENV) -+ env-id mask -+ (aref v 0) (aref v 1) (aref v 2) (aref v 3) (aref v 4) -+ (aref v 5) (aref v 6) (aref v 7) (aref v 8) (aref v 9) -+ (aref v 10) (aref v 11) (aref v 12) (aref v 13) (aref v 14) -+ (aref v 15) (aref v 16) (aref v 17) -+ ;; (aref v 18) -+ ;; (aref v 19) -+ ;; (aref v 20) -+ ;; (aref v 21) -+ ;; (aref v 22) -+ ;; (aref v 23)) -+ 0 10 0 0 0 0) -+ (wnnrpc-get-result))) -+ -+(defun wnn7rpc-set-conversion-env-param-highbit (env maskh maskl v) -+ "Set Wnn7 conversion parameter (use high bit mask)." -+ (wnnrpc-call-with-environment env () -+ (comm-format (u u w w i i i i i i i i i i i i i i i i i i i i i i i i) -+ (wnn-const JS_SET_HENKAN_ENV) -+ env-id maskh maskl -+ (aref v 0) (aref v 1) (aref v 2) (aref v 3) (aref v 4) -+ (aref v 5) (aref v 6) (aref v 7) (aref v 8) (aref v 9) -+ (aref v 10) (aref v 11) (aref v 12) (aref v 13) (aref v 14) -+ (aref v 15) (aref v 16) (aref v 17) (aref v 18) (aref v 19) -+ (aref v 20) (aref v 21) (aref v 22) (aref v 23)) -+ (wnnrpc-get-result))) -+ - (defun wnnrpc-temporary-dic-loaded (env) - "Ask to the server whether the temporary dictionary is loaded or not. - Return positive if loaded, zero if not, negative on failure." -@@ -1239,6 +1295,21 @@ HINSHI and FUZOKUGO are information of preceding bunsetsu." - (vector p1 p2 p3 p4 p5 p6 p7 p8 p9 - p10 p11 p12 p13 p14 p15 p16 p17 p18)))) - -+(defun wnn7rpc-get-conversion-env-param (env) -+ "" -+ (wnnrpc-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) -+ (wnnrpc-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 wnnrpc-file-loaded (proc path) - "" - (comm-call-with-proc proc (result) -@@ -1708,7 +1779,7 @@ HINSHI and FUZOKUGO are information of preceding bunsetsu." - (eq type (wnn-const CWNN_REV_DICT)) - (eq type (wnn-const BWNN_REV_DICT)) - (eq type (wnn-const WNN_UD_DICT)) -- (and (wnnenv-is-wnn6 env) -+ (and (or (wnnenv-is-wnn6 env) (wnnenv-is-wnn7 env) (wnnenv-is-wnn8 env)) - (eq type (wnn-const WNN_FI_USER_DICT)))) - (wnnrpc-create-and-move-to-client env nil dicname type - comment passwd hpasswd)) -@@ -1768,4 +1839,175 @@ HINSHI and FUZOKUGO are information of preceding bunsetsu." - (backward-char)) - (buffer-substring 1 (point)))))) - --;;; egg/wnnrpc.el ends here -+;;; egg/wnnrpc.el ends here. -+ -+;;; -+;;; Wnn7 new function: -+;;; Input Prediction -+;;; -+;;; -+(defun wnn7rpc-yosoku-init (env) -+ "Initialize input prediction function" -+ (wnnrpc-call-with-environment env () -+ (comm-format (u u) (wnn-const JS_YOSOKU_INIT) env-id) -+ (wnnrpc-get-result))) -+ -+(defun wnn7rpc-yosoku-free (env) -+ "Free input prediction function area from server." -+ (wnnrpc-call-with-environment env () -+ (comm-format (u u) (wnn-const JS_YOSOKU_FREE) env-id) -+ (wnnrpc-get-result))) -+(defun wnn7rpc-yosoku-yosoku (env moji) -+ "Execute input prediction." -+ (wnnrpc-call-with-environment env (candnum len kouho kouho-list) -+ (comm-format (u u E) (wnn-const JS_YOSOKU_YOSOKU) env-id moji) -+ (wnnrpc-get-result -+ (comm-unpack (i) 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." -+ (wnnrpc-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)))) -+ (wnnrpc-get-result))) -+ -+(defun wnn7rpc-yosoku-selected-cand (env selectpos) -+ "Select the input prediction candidate." -+ (wnnrpc-call-with-environment env () -+ (comm-format (u u u) (wnn-const JS_YOSOKU_SELECTED_CAND) -+ env-id selectpos) -+ (wnnrpc-get-result))) -+ -+(defun wnn7rpc-yosoku-delete-cand (env selectpos) -+ "Delete the input prediction candidate." -+ (wnnrpc-call-with-environment env () -+ (comm-format (u u u) (wnn-const JS_YOSOKU_DELETE_CAND) -+ env-id selectpos) -+ (wnnrpc-get-result))) -+ -+(defun wnn7rpc-yosoku-cancel-latest-toroku (env) -+ "Cancel the latest registered word." -+ (wnnrpc-call-with-environment env () -+ (comm-format (u u) (wnn-const JS_YOSOKU_CANCEL_LATEST_TOROKU) env-id) -+ (wnnrpc-get-result))) -+ -+(defun wnn7rpc-yosoku-reset-pre-yosoku (env) -+ "Clear the connection information for the latest registered word." -+ (wnnrpc-call-with-environment env () -+ (comm-format (u u) (wnn-const JS_YOSOKU_RESET_PRE_YOSOKU) env-id) -+ (wnnrpc-get-result))) -+ -+(defun wnn7rpc-yosoku-ikkatsu-toroku (env torokustr) -+ "Register the input prediction candidate with phrase analysis." -+ (wnnrpc-call-with-environment env () -+ (comm-format (u u S) (wnn-const JS_YOSOKU_IKKATSU_TOROKU) -+ env-id torokustr) -+ (wnnrpc-get-result))) -+ -+(defun wnn7rpc-yosoku-save-datalist (env) -+ "Save the input prediction data in data file." -+ (wnnrpc-call-with-environment env () -+ (comm-format (u u) (wnn-const JS_YOSOKU_SAVE_DATALIST) env-id) -+ (wnnrpc-get-result))) -+ -+(defun wnn7rpc-yosoku-init-time-keydata (env) -+ "Initialize input efficiency data about inputed key." -+ (wnnrpc-call-with-environment env () -+ (comm-format (u u) (wnn-const JS_YOSOKU_INIT_TIME_KEYDATA) env-id) -+ (wnnrpc-get-result))) -+ -+(defun wnn7rpc-yosoku-init-inputinfo (env) -+ "Initialize input efficiency data about input time." -+ (wnnrpc-call-with-environment env () -+ (comm-format (u u) (wnn-const JS_YOSOKU_INIT_INPUTINFO) env-id) -+ (wnnrpc-get-result))) -+ -+(defun wnn7rpc-yosoku-set-user-inputinfo (env allkey userkey yosokuselect) -+ "Set user input information to the input efficiency data." -+ (wnnrpc-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)) -+ (wnnrpc-get-result))) -+ -+(defun wnn7rpc-yosoku-set-timeinfo (env yosokuselect throughyosoku inputtime -+ keylen) -+ "Set input-time information to the input efficiency data." -+ (wnnrpc-call-with-environment env () -+ (comm-format (u u u u u u) (wnn-const JS_YOSOKU_SET_TIMEINFO) -+ env-id yosokuselect throughyosoku inputtime keylen) -+ (wnnrpc-get-result))) -+ -+(defun wnn7rpc-yosoku-status (env) -+ "Get input efficiency information." -+ (wnnrpc-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 (i) 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." -+ (wnnrpc-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) -+ (wnnrpc-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) -+ "" -+ (wnnrpc-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)))) -+ (wnnrpc-get-result))) -diff --git a/eggrc b/eggrc -index 50f6226..08650bc 100644 ---- a/eggrc -+++ b/eggrc -@@ -77,7 +77,7 @@ - (wnn-add-dict "iwanami/tankan2.dic" nil 1 nil nil) - (wnn-add-dict "iwanami/tel.dic" nil 1 nil nil) - (wnn-add-dict "iwanami/zip.dic" nil 1 nil nil) -- (wnn-add-dict '("ud") nil 15 t t) -+ (wnn-add-dict '("ud") nil 15 t t) - ; (wnn-add-dict "wnncons/tankan2.dic" nil 1 nil nil) - ; (wnn-add-dict "wnncons/tankan3.dic" nil 1 nil nil) - (wnn-set-param 5 10 2 45 0 80 5 1 20 0 400 -100 400 80 200 2 200) -@@ -113,30 +113,31 @@ - (wnn-add-fisys-dict "system/fisd" '("fisd.h") t) - (wnn-add-fiusr-dict '("fiud") nil t nil) - -- (wnn-add-dict "system/kihon.dic" '("kihon.h") 6 nil t) -- (wnn-add-dict "system/symbol.dic" '("symbol.h") 1 nil t) -- (wnn-add-dict "system/symbol_noat.dic" '("symbol_noat.h") 1 nil t) -- (wnn-add-dict "system/tel.dic" '("tel.h") 1 nil t) -- (wnn-add-dict "system/zip.dic" '("zip.h") 1 nil t) -- (wnn-add-dict "system/tankan.dic" nil 1 nil nil) -- (wnn-add-dict "system/tankan2.dic" nil 1 nil nil) -- (wnn-add-dict "system/ikeiji.dic" nil 1 nil nil) -- (wnn-add-dict "system/rensou.dic" nil 1 nil nil) -- (wnn-add-dict '("ud") nil 15 t t) -- -- (wnn-add-dict "option/jinmei.dic" '("jinmei.h") 1 nil t) -- (wnn-add-dict "option/chimei.dic" '("chimei.h") 1 nil t) -- (wnn-add-dict "option/address.dic" '("address.h") 1 nil t) -- (wnn-add-dict "option/station.dic" '("station.h") 1 nil t) -- (wnn-add-dict "option/kana_english.dic" '("kana_english.h")1 nil t) -- (wnn-add-dict "option/enterprise.dic" '("enterprise.h") 1 nil t) -- (wnn-add-dict "option/airport.dic" '("airport.h") 1 nil t) -- (wnn-add-dict "option/university.dic" '("university.h") 1 nil t) -- (wnn-add-dict "option/zoo.dic" '("zoo.h") 1 nil t) -+ (wnn-add-dict "system/kihon.dic" '("kihon.h") 6 nil t) -+ (wnn-add-dict "system/symbol.dic" '("symbol.h") 1 nil t) -+ (wnn-add-dict "system/symbol_noat.dic" '("symbol_noat.h") 1 nil t) -+ (wnn-add-dict "system/tel.dic" '("tel.h") 1 nil t) -+ (wnn-add-dict "system/zip.dic" '("zip.h") 1 nil t) -+ (wnn-add-dict "system/tankan.dic" nil 1 nil nil) -+ (wnn-add-dict "system/tankan2.dic" nil 1 nil nil) -+ (wnn-add-dict "system/ikeiji.dic" nil 1 nil nil) -+ (wnn-add-dict "system/rensou.dic" nil 1 nil nil) -+ (wnn-add-dict '("ud") "" 15 t t) -+ -+ (wnn-add-dict "option/jinmei.dic" '("jinmei.h") 1 nil t) -+ (wnn-add-dict "option/chimei.dic" '("chimei.h") 1 nil t) -+ (wnn-add-dict "option/address.dic" '("address.h") 1 nil t) -+ (wnn-add-dict "option/station.dic" '("station.h") 1 nil t) -+ (wnn-add-dict "option/kana_english.dic" '("kana_english.h") 1 nil t) -+ (wnn-add-dict "option/enterprise.dic" '("enterprise.h") 1 nil t) -+ (wnn-add-dict "option/airport.dic" '("airport.h") 1 nil t) -+ (wnn-add-dict "option/university.dic" '("university.h") 1 nil t) -+ (wnn-add-dict "option/zoo.dic" '("zoo.h") 1 nil t) - (wnn-add-dict "option/botanical_garden.dic" '("botanical_garden.h") 1 nil t) -- (wnn-add-dict "option/aquarium.dic" '("aquarium.h") 1 nil t) -- (wnn-add-dict "option/conveni.dic" '("conveni.h") 1 nil t) -- (wnn-add-dict "option/amusement.dic" '("amusement.h") 1 nil t) -+ (wnn-add-dict "option/aquarium.dic" '("aquarium.h") 1 nil t) -+ (wnn-add-dict "option/conveni.dic" '("conveni.h") 1 nil t) -+ (wnn-add-dict "option/amusement.dic" '("amusement.h") 1 nil t) -+ (wnn-add-dict "option/computer.dic" '("computer.h") 1 nil t) - - (wnn-set-param 5 10 2 45 0 80 5 1 20 0 400 -100 400 80 200 2 200) - -@@ -156,14 +157,14 @@ - - (wnn-set-freq-func-mode 4) - --;; (wnn-set-yosoku-learn t) --;; (wnn-set-yosoku-max-disp 10) --;; (wnn-set-yosoku-last-is-first t) -+ (wnn-set-yosoku-learn-mode t) -+ (wnn-set-yosoku-max-disp 10) -+ (wnn-set-yosoku-last-is-first-mode t) - --;; (wnn-set-boin-kabusoku t) --;; (wnn-set-shiin-choka t) --;; (wnn-set-n-choka t) --;; (wnn-set-nihongo-kosei t) -+ (wnn-set-boin-kabusoku-mode t) -+ (wnn-set-shiin-choka-mode t) -+ (wnn-set-n-choka-mode t) -+ (wnn-set-nihongo-kosei-mode t) - - ;; (wnn-set-numeric-mode -12) - ;; (wnn-set-alphabet-mode -30) -@@ -171,36 +172,150 @@ - - (wnn-define-environment t) - (wnn-set-fuzokugo "system/kougo.fzk") -- (wnn-add-dict "system/kihonR.dic" nil 1 nil nil) -- (wnn-add-dict "system/telR.dic" nil 1 nil nil) -- (wnn-add-dict "system/zipR.dic" nil 1 nil nil) -- (wnn-add-dict "system/tankanR.dic" nil 1 nil nil) -+ (wnn-add-dict "system/kihonR.dic" nil 1 nil nil) -+ (wnn-add-dict "system/telR.dic" nil 1 nil nil) -+ (wnn-add-dict "system/zipR.dic" nil 1 nil nil) -+ (wnn-add-dict "system/tankanR.dic" nil 1 nil nil) - (wnn-add-dict "system/tankan2R.dic" nil 1 nil nil) - -- (wnn-add-dict "option/jinmeiR.dic" nil 1 nil nil) -- (wnn-add-dict "option/chimeiR.dic" nil 1 nil nil) -+ (wnn-add-dict "option/jinmeiR.dic" nil 1 nil nil) -+ (wnn-add-dict "option/chimeiR.dic" nil 1 nil nil) - (wnn-add-dict "option/addressR.dic" nil 1 nil nil) -- ;;(wnn-add-dict "option/stationR.dic" nil 1 nil nil) -- ;;(wnn-add-dict "option/kana_englishR.dic" nil 1 nil nil) -- ;;(wnn-add-dict "option/enterpriseR.dic" nil 1 nil nil) -- ;;(wnn-add-dict "option/airportR.dic" nil 1 nil nil) -- ;;(wnn-add-dict "option/universityR.dic" nil 1 nil nil) -- ;;(wnn-add-dict "option/zooR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/stationR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/kana_englishR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/enterpriseR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/airportR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/universityR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/zooR.dic" nil 1 nil nil) - ;;(wnn-add-dict "option/botanical_gardenR.dic" nil 1 nil nil) -- ;;(wnn-add-dict "option/aquariumR.dic" nil 1 nil nil) -- ;;(wnn-add-dict "option/conveniR.dic" nil 1 nil nil) -- ;;(wnn-add-dict "option/amusementR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/aquariumR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/conveniR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/amusementR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/computerR.dic" nil 1 nil nil) - -- (wnn-add-dict '("ud") nil 15 t t) -+ (wnn-add-dict '("ud") "" 15 t t) -+ (wnn-set-param 2 10 2 45 1 80 5 1 50 -20 400 -10 100 -100 200 0 200)) -+ -+(defun wnn8-jserver-setup () -+ (wnn-define-environment nil) -+ (wnn-set-fuzokugo "system/kougo.fzk") -+ (wnn-add-fisys-dict "system/fisd" '("fisd.h") t) -+ (wnn-add-fiusr-dict '("fiud") nil t nil) -+ -+ (wnn-add-dict "system/kihon.dic" '("kihon.h") 6 nil t) -+ (wnn-add-dict "system/kihon3_4.dic" '("kihon3_4.h") 6 nil t) -+ (wnn-add-dict "system/symbol.dic" '("symbol.h") 1 nil t) -+ (wnn-add-dict "system/symbol3_4.dic" '("symbol3_4.h") 1 nil t) -+ (wnn-add-dict "system/symbol_noat.dic" '("symbol_noat.h") 1 nil t) -+ (wnn-add-dict "system/symbol3_4_noat.dic" '("symbol3_4_noat.h") 1 nil t) -+ (wnn-add-dict "system/tel.dic" '("tel.h") 1 nil t) -+ (wnn-add-dict "system/zip.dic" '("zip.h") 1 nil t) -+ (wnn-add-dict "system/tankan.dic" nil 1 nil nil) -+ (wnn-add-dict "system/tankan2.dic" nil 1 nil nil) -+ (wnn-add-dict "system/tankan3_4.dic" nil 1 nil nil) -+ (wnn-add-dict "system/ikeiji.dic" nil 1 nil nil) -+ (wnn-add-dict "system/rensou.dic" nil 1 nil nil) -+ (wnn-add-dict '("ud") "" 15 t t) -+ -+ (wnn-add-dict "option/jinmei.dic" '("jinmei.h") 1 nil t) -+ (wnn-add-dict "option/chimei.dic" '("chimei.h") 1 nil t) -+ (wnn-add-dict "option/address.dic" '("address.h") 1 nil t) -+ (wnn-add-dict "option/station.dic" '("station.h") 1 nil t) -+ (wnn-add-dict "option/kana_english.dic" '("kana_english.h") 1 nil t) -+ (wnn-add-dict "option/enterprise.dic" '("enterprise.h") 1 nil t) -+ (wnn-add-dict "option/airport.dic" '("airport.h") 1 nil t) -+ (wnn-add-dict "option/university.dic" '("university.h") 1 nil t) -+ (wnn-add-dict "option/zoo.dic" '("zoo.h") 1 nil t) -+ (wnn-add-dict "option/botanical_garden.dic" '("botanical_garden.h") 1 nil t) -+ (wnn-add-dict "option/aquarium.dic" '("aquarium.h") 1 nil t) -+ (wnn-add-dict "option/conveni.dic" '("conveni.h") 1 nil t) -+ (wnn-add-dict "option/amusement.dic" '("amusement.h") 1 nil t) -+ (wnn-add-dict "option/computer.dic" '("computer.h") 1 nil t) -+ (wnn-add-dict "option/business.dic" '("business.h") 1 nil t) -+ (wnn-add-dict "option/food.dic" '("food.h") 1 nil t) -+ (wnn-add-dict "option/hobby.dic" '("hobby.h") 1 nil t) -+ (wnn-add-dict "option/mailextend.dic" '("mailextend.h") 1 nil t) -+ (wnn-add-dict "option/person.dic" '("person.h") 1 nil t) -+ (wnn-add-dict "option/sports.dic" '("sports.h") 1 nil t) -+ (wnn-add-dict "option/spot.dic" '("spot.h") 1 nil t) -+ -+ (wnn-set-param 5 10 2 45 0 80 5 1 20 0 400 -100 400 80 200 2 200) -+ -+ (wnn-add-notrans-dict '("katakana") 15 t) -+ (wnn-add-bmodify-dict '("bunsetsu") 15 t) -+ -+ (wnn-set-last-is-first-mode t) -+ (wnn-set-complex-conv-mode nil) -+ ;; (wnn-set-okuri-flag -1) -+ (wnn-set-prefix-flag 0) -+ -+ (wnn-set-okuri-learn-mode t) -+ (wnn-set-prefix-learn-mode t) -+ (wnn-set-suffix-learn-mode t) -+ (wnn-set-common-learn-mode t) -+ (wnn-set-yuragi-mode nil) -+ -+ (wnn-set-freq-func-mode 4) -+ -+ (wnn-set-yosoku-learn-mode t) -+ (wnn-set-yosoku-max-disp 10) -+ (wnn-set-yosoku-last-is-first-mode t) -+ -+ (wnn-set-boin-kabusoku-mode t) -+ (wnn-set-shiin-choka-mode t) -+ (wnn-set-n-choka-mode t) -+ (wnn-set-nihongo-kosei-mode t) -+ -+ ;; (wnn-set-numeric-mode -12) -+ ;; (wnn-set-alphabet-mode -30) -+ ;; (wnn-set-symbol-mode -40) -+ -+ (wnn-define-environment t) -+ (wnn-set-fuzokugo "system/kougo.fzk") -+ (wnn-add-dict "system/kihonR.dic" nil 1 nil nil) -+ (wnn-add-dict "system/kihon3_4R.dic" nil 1 nil nil) -+ (wnn-add-dict "system/telR.dic" nil 1 nil nil) -+ (wnn-add-dict "system/zipR.dic" nil 1 nil nil) -+ (wnn-add-dict "system/tankanR.dic" nil 1 nil nil) -+ (wnn-add-dict "system/tankan2R.dic" nil 1 nil nil) -+ (wnn-add-dict "system/tankan3_4R.dic" nil 1 nil nil) -+ -+ (wnn-add-dict "option/jinmeiR.dic" nil 1 nil nil) -+ (wnn-add-dict "option/chimeiR.dic" nil 1 nil nil) -+ (wnn-add-dict "option/addressR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/stationR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/kana_englishR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/enterpriseR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/airportR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/universityR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/zooR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/botanical_gardenR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/aquariumR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/conveniR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/amusementR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/computerR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/businessR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/foodR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/hobbyR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/mailextendR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/personR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/sportsR.dic" nil 1 nil nil) -+ ;;(wnn-add-dict "option/spotR.dic" nil 1 nil nil) -+ -+ (wnn-add-dict '("ud") "" 15 t t) - (wnn-set-param 2 10 2 45 1 80 5 1 50 -20 400 -10 100 -100 200 0 200)) - - (cond - ((eq egg-backend-type 'wnn) - (cond - ((eq wnn-server-type 'jserver) -- (if wnn-wnn6-server -- (wnn6-jserver-setup) -- (wnn4-jserver-setup))) -+ (if wnn-wnn8-server -+ (wnn8-jserver-setup) -+ (if wnn-wnn7-server -+ (wnn7-jserver-setup) -+ (if wnn-wnn6-server -+ (wnn6-jserver-setup) -+ (wnn4-jserver-setup))))) - - ((eq wnn-server-type 'cserver) - (if wnn-use-bixing diff -Nru egg-4.1.8/debian/patches/04-debian-egg.patch egg-4.2.0/debian/patches/04-debian-egg.patch --- egg-4.1.8/debian/patches/04-debian-egg.patch 2014-10-31 03:57:49.000000000 +0000 +++ egg-4.2.0/debian/patches/04-debian-egg.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -diff --git a/egg.el b/egg.el -index b4d88e2..a9b9026 100644 ---- a/egg.el -+++ b/egg.el -@@ -30,7 +30,7 @@ - - ;;; Code: - --(defconst egg-version "4.0.6" -+(defconst egg-version "4.0.6+20020909cvs" - "Version number for this version of Tamago.") - - (eval-when-compile -diff --git a/Makefile.in b/Makefile.in -index b469e87..b424c72 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -55,6 +55,7 @@ TOPSRCS = \ - menudiag.el \ - its.el \ - its-keydef.el \ -+ leim-list.el \ - - # - EGGSRCS = \ -@@ -74,6 +75,7 @@ ITSSRCS = \ - its/hankata.el \ - its/hira.el \ - its/jeonkak.el \ -+ its/greek.el \ - its/pinyin.el \ - its/hangul.el \ - its/kata.el \ diff -Nru egg-4.1.8/debian/patches/series egg-4.2.0/debian/patches/series --- egg-4.1.8/debian/patches/series 2014-11-05 07:15:25.000000000 +0000 +++ egg-4.2.0/debian/patches/series 2015-04-30 00:24:11.000000000 +0000 @@ -1 +1 @@ -# No patchs are needed for 4.1.1. Thus, it's empty now. +# No patchs are needed. Thus, it's empty now. diff -Nru egg-4.1.8/debian/README.Debian egg-4.2.0/debian/README.Debian --- egg-4.1.8/debian/README.Debian 2014-11-05 07:34:32.000000000 +0000 +++ egg-4.2.0/debian/README.Debian 2015-04-30 00:22:35.000000000 +0000 @@ -10,10 +10,7 @@ * It only supports Anthy backend. -* Some Debian specific historical changes are available in the source - package under debian/patches. - - -- Niibe Yutaka , Wed, 5 Nov 2014 16:34:32 +0900 + -- Niibe Yutaka , Mon, 27 Apr 2015 12:30:23 +0900 Originally written around 2005: diff -Nru egg-4.1.8/debian/rules egg-4.2.0/debian/rules --- egg-4.1.8/debian/rules 2014-11-06 02:30:52.000000000 +0000 +++ egg-4.2.0/debian/rules 2015-04-30 00:22:35.000000000 +0000 @@ -4,8 +4,8 @@ export DH_OPTIONS PACKAGE=egg -EL_FILES=egg.el egg-com.el egg-cnv.el egg-mlh.el menudiag.el \ - its.el egg-anthy.el egg-anthyipc.el egg-sj3.el egg-sj3rpc.el \ +EL_FILES=egg.el egg-cnv.el egg-mlh.el menudiag.el \ + its.el egg-anthy.el egg-anthyipc.el \ its-ascii.el its-hankata.el its-hira.el its-jiskana.el its-kata.el \ its-zenkaku.el diff -Nru egg-4.1.8/egg-anthy.el egg-4.2.0/egg-anthy.el --- egg-4.1.8/egg-anthy.el 2014-11-10 02:03:36.000000000 +0000 +++ egg-4.2.0/egg-anthy.el 2015-04-30 00:13:12.000000000 +0000 @@ -104,9 +104,9 @@ (let ((buf (generate-new-buffer " *ANTHY*")) (process-connection-type nil)) ; avoid using pty (setq anthy-proc - (start-process "anthy-agent" buf "anthy-agent" "--egg")) + (start-process "anthy-agent" buf "anthy-agent" "--egg" "--utf8")) (set-process-query-on-exit-flag anthy-proc nil) - (set-process-coding-system anthy-proc 'euc-jp-dos 'euc-jp-dos) + (set-process-coding-system anthy-proc 'utf-8-dos 'utf-8-dos) (set-process-sentinel anthy-proc 'anthy-proc-sentinel) (set-marker-insertion-type (process-mark anthy-proc) t) (with-current-buffer buf diff -Nru egg-4.1.8/egg-com.el egg-4.2.0/egg-com.el --- egg-4.1.8/egg-com.el 2014-11-10 02:03:36.000000000 +0000 +++ egg-4.2.0/egg-com.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,328 +0,0 @@ -;;; 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: -(eval-when-compile - (setq byte-compile-warnings '(obsolete redefine callargs)); free-vars unresolved -) - -(declare-function egg-error (message &rest args) - "egg.el" nil) - -(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 - -(define-charset 'fixed-euc-jp - "Fixed EUC Japanese" - :dimension 2 - :superset '(ascii - (katakana-jisx0201 . #x80) - (japanese-jisx0208 . #x8080) - (japanese-jisx0212 . #x8000))) - -(define-coding-system 'fixed-euc-jp - "Coding System for fixed EUC Japanese" - :mnemonic ?W - :coding-type 'charset - :charset-list '(fixed-euc-jp)) - -(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. - (Note: Elisp's integer may be greater than 32 bits) -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)) - (egg-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)) - (egg-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-i32 () - (progn - (comm-require-process-output 4) - (+ (lsh (- (logxor (comm-following+forward-char) 128) 128) 24) - (lsh (comm-following+forward-char) 16) - (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-i32))) - ((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)) - (with-current-buffer buffer - (let ,euc-select - (erase-buffer) - ,send-expr - (goto-char (point-max)) - (process-send-region proc (point-min) (point-max)) - ,@receive-exprs)) - (egg-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 'egg-com) -;;; egg-com.el ends here. diff -Nru egg-4.1.8/egg.el egg-4.2.0/egg.el --- egg-4.1.8/egg.el 2014-11-10 02:03:36.000000000 +0000 +++ egg-4.2.0/egg.el 2015-04-30 00:13:12.000000000 +0000 @@ -32,7 +32,7 @@ (require 'its) -(defconst egg-version "4.1.8" +(defconst egg-version "4.2.0" "Version number for this version of Tamago.") (eval-when-compile diff -Nru egg-4.1.8/egg-mlh.el egg-4.2.0/egg-mlh.el --- egg-4.1.8/egg-mlh.el 2014-11-10 02:03:36.000000000 +0000 +++ egg-4.2.0/egg-mlh.el 2015-04-30 00:13:12.000000000 +0000 @@ -30,9 +30,6 @@ ;;; Code: -(eval-when-compile - (setq byte-compile-warnings '(obsolete redefine callargs)); free-vars unresolved -) (defvar egg-mode-preference); egg.el as custom variable (defvar egg-conversion-backend-alist); egg-cnv.el @@ -47,6 +44,16 @@ (defvar mlh-default-backend "anthy") +;;; Dynamic binding variables. + +(defvar mlh-beg nil) +(defvar mlh-candidates nil) +(defvar mlh-end-marker nil) +(defvar henkan-begin nil) +(defvar current-candidate) +(defvar number-of-candidates) +(defvar inhibit-henkan) + (defun mlh-space-bar-backward-henkan () "If the character preceding point is / (slash), Do `mlh-backward-henkan'. Then, invoke appropriate conversion, if needed. @@ -127,22 +134,22 @@ (forward-char -1) (skip-chars-backward "0-9") (mlh-backward-henkan) - (setq beg (point)) - (goto-char end-marker) + (setq mlh-beg (point)) + (goto-char mlh-end-marker) (backward-delete-char 2) - (let* ((str (buffer-substring beg (point))) + (let* ((str (buffer-substring mlh-beg (point))) (val (string-to-number str))) - (delete-region beg (point)) + (delete-region mlh-beg (point)) (if (= val 0) (setq val 1)) (while (> val 0) (insert " ") (setq val (1- val)))) (if (null henkan-begin) - (setq henkan-begin beg))) + (setq henkan-begin mlh-beg))) (defun mlh-exit () - (goto-char end-marker) + (goto-char mlh-end-marker) (backward-delete-char 2) (insert " ") (setq henkan-begin (point))) @@ -151,37 +158,37 @@ (forward-char -1) (skip-chars-backward "a-zA-Z0-9") (mlh-backward-henkan) - (setq beg (point)) - (goto-char end-marker) + (setq mlh-beg (point)) + (goto-char mlh-end-marker) (backward-delete-char 2) - (upcase-region beg (point)) + (upcase-region mlh-beg (point)) (if (null henkan-begin) - (setq henkan-begin beg))) + (setq henkan-begin mlh-beg))) (defun mlh-capitalize () (forward-char -1) (skip-chars-backward "a-zA-Z1-9") (mlh-backward-henkan) - (setq beg (point)) - (goto-char end-marker) + (setq mlh-beg (point)) + (goto-char mlh-end-marker) (backward-delete-char 2) - (capitalize-region beg (point)) + (capitalize-region mlh-beg (point)) (if (null henkan-begin) - (setq henkan-begin beg))) + (setq henkan-begin mlh-beg))) (defun mlh-jis-code () (forward-char -1) (skip-chars-backward "0-9a-fA-F") (mlh-backward-henkan) - (if (/= (- end-marker (point)) 6) + (if (/= (- mlh-end-marker (point)) 6) (error "invalid length")) - (setq beg (point)) + (setq mlh-beg (point)) (let ((val (car (read-from-string - (concat "?\\x" (buffer-substring beg (- end-marker 2))))))) + (concat "?\\x" (buffer-substring mlh-beg (- mlh-end-marker 2))))))) (insert (make-char 'japanese-jisx0208 (/ val 256) (% val 256))) - (delete-region (point) end-marker)) + (delete-region (point) mlh-end-marker)) (if (null henkan-begin) - (setq henkan-begin beg))) + (setq henkan-begin mlh-beg))) (defun mlh-lisp-expression () (forward-char -1) @@ -192,20 +199,20 @@ (forward-sexp -1)) (set-syntax-table stab))) (mlh-backward-henkan) - (setq beg (point)) - (goto-char end-marker) + (setq mlh-beg (point)) + (goto-char mlh-end-marker) (backward-delete-char 2) (let* ((exp-str - (buffer-substring beg (point))) + (buffer-substring mlh-beg (point))) (exp (car (read-from-string exp-str))) (result (eval exp))) - (delete-region beg (point)) + (delete-region mlh-beg (point)) (insert (format "%s" result))) (if (null henkan-begin) - (setq henkan-begin beg))) + (setq henkan-begin mlh-beg))) (defun mlh-quit () - (goto-char end-marker) + (goto-char mlh-end-marker) (backward-delete-char 2) (setq henkan-begin (point))) @@ -213,11 +220,11 @@ (forward-char -1) (skip-chars-backward "\041-\056\060-\176") (mlh-backward-henkan) - (setq beg (point)) - (goto-char end-marker) + (setq mlh-beg (point)) + (goto-char mlh-end-marker) (backward-delete-char 2) (if (null henkan-begin) - (setq henkan-begin beg))) + (setq henkan-begin mlh-beg))) (fset 'mlh-small-letter (symbol-function 'mlh-no-conversion)) @@ -225,28 +232,28 @@ (forward-char -1) (skip-chars-backward "0-9") (mlh-backward-henkan) - (setq beg (point)) - (goto-char end-marker) + (setq mlh-beg (point)) + (goto-char mlh-end-marker) (backward-delete-char 2) - (let* ((str (buffer-substring beg (point))) + (let* ((str (buffer-substring mlh-beg (point))) (val (string-to-number str))) - (delete-region beg (point)) + (delete-region mlh-beg (point)) (if (= val 0) (setq val 1)) (insert (make-string val ?\ ))) (if (null henkan-begin) - (setq henkan-begin beg))) + (setq henkan-begin mlh-beg))) (defun mlh-execute () (forward-char -1) (if (fboundp 'mlh-userdef-function) (mlh-userdef-function) (mlh-backward-henkan) - (setq beg (point)) - (goto-char end-marker) + (setq mlh-beg (point)) + (goto-char mlh-end-marker) (backward-delete-char 2) (if (null henkan-begin) - (setq henkan-begin beg)))) + (setq henkan-begin mlh-beg)))) (defun mlh-backward-henkan () "For each words seperated by / (slash), do conversion. @@ -274,10 +281,10 @@ OTHERWISE Convert to KANJI " (if (eq (preceding-char) ?/) - (let ((end-marker (point-marker)) + (let ((mlh-end-marker (point-marker)) (char nil) - (beg nil)) - (set-marker-insertion-type end-marker t) + (mlh-beg nil)) + (set-marker-insertion-type mlh-end-marker t) (unwind-protect (let (scheme) (backward-char 1) @@ -286,13 +293,13 @@ ((setq scheme (assq char mlh-conversion-scheme-table)) (funcall (cdr scheme))) (t - (goto-char end-marker))) - (if beg + (goto-char mlh-end-marker))) + (if mlh-beg (progn - (goto-char beg) + (goto-char mlh-beg) (mlh-do-spacing) - (goto-char end-marker)))) - (set-marker end-marker nil))))) + (goto-char mlh-end-marker)))) + (set-marker mlh-end-marker nil))))) (defvar mlh-syntax-table nil @@ -380,8 +387,8 @@ )) (defun mlh-select-insert-candidate (n) - (delete-region beg (point)) - (insert (nth n candidates))) + (delete-region mlh-beg (point)) + (insert (nth n mlh-candidates))) (defun mlh-select-prev-candidate () (interactive) @@ -397,11 +404,11 @@ (setq current-candidate 0)) (mlh-select-insert-candidate current-candidate)) -(defun mlh-recursive-edit-select (beg end candidates) +(defun mlh-recursive-edit-select () (mlh-select-insert-candidate 0) (and (boundp 'disable-undo) (setq disable-undo t)) (let ((old-local-map (current-local-map)) - (number-of-candidates (length candidates)) + (number-of-candidates (length mlh-candidates)) (current-candidate 0)) (use-local-map mlh-select-mode-map) (recursive-edit) @@ -421,22 +428,23 @@ (forward-char -1) (skip-chars-backward "-a-zA-Z") (mlh-backward-henkan) - (setq beg (point)) - (goto-char end-marker) + (setq mlh-beg (point)) + (goto-char mlh-end-marker) (backward-delete-char 2) - (let* ((str (buffer-substring beg (point))) + (let* ((str (buffer-substring mlh-beg (point))) (userdef (mlh-userdef<==string str))) (cond ((stringp userdef) - (delete-region beg (point)) + (delete-region mlh-beg (point)) (insert userdef)) ((null userdef) - (delete-region beg (point)) + (delete-region mlh-beg (point)) ;; (add-userdef) (insert new-userdef) (insert "?udef?")) ((consp userdef) - (mlh-recursive-edit-select beg (point) userdef)))) + (let ((mlh-candidates userdef)) + (mlh-recursive-edit-select))))) (if (null henkan-begin) - (setq henkan-begin beg))) + (setq henkan-begin mlh-beg))) (defvar mlh-userdef-table nil "Convertion table of words(string) to another words(string).") @@ -454,59 +462,59 @@ (skip-chars-backward "-a-z,.'N[]") (mlh-backward-henkan) (setq inhibit-henkan nil) - (setq beg (point)) - (goto-char end-marker) + (setq mlh-beg (point)) + (goto-char mlh-end-marker) (forward-char -1) - (its-translate-region-internal beg (point)) - (delete-region (point) end-marker) + (its-translate-region-internal mlh-beg (point)) + (delete-region (point) mlh-end-marker) (if (null henkan-begin) - (setq henkan-begin beg))) + (setq henkan-begin mlh-beg))) (defun mlh-hiragana () (forward-char -1) (skip-chars-backward "-a-z,.'N[]") (mlh-backward-henkan) - (setq beg (point)) - (goto-char end-marker) + (setq mlh-beg (point)) + (goto-char mlh-end-marker) (forward-char -2) - (its-translate-region-internal beg (point)) - (delete-region (point) end-marker) + (its-translate-region-internal mlh-beg (point)) + (delete-region (point) mlh-end-marker) (setq henkan-begin (point))) (defun mlh-hiragana-to-kanji () (forward-char -1) (skip-chars-backward "ぁ-んー") (mlh-backward-henkan) - (setq beg (point)) + (setq mlh-beg (point)) (setq inhibit-henkan nil) - (goto-char end-marker) + (goto-char mlh-end-marker) (backward-delete-char 2) (if (null henkan-begin) - (setq henkan-begin beg))) + (setq henkan-begin mlh-beg))) (defun mlh-katakana () (forward-char -1) (skip-chars-backward "-a-z,.'N[]") (mlh-backward-henkan) - (setq beg (point)) - (goto-char end-marker) + (setq mlh-beg (point)) + (goto-char mlh-end-marker) (forward-char -2) - (its-translate-region-internal beg (point)) - (japanese-katakana-region beg (point)) - (delete-region (point) end-marker) + (its-translate-region-internal mlh-beg (point)) + (japanese-katakana-region mlh-beg (point)) + (delete-region (point) mlh-end-marker) (if (null henkan-begin) - (setq henkan-begin beg))) + (setq henkan-begin mlh-beg))) (defun mlh-zenkaku () (forward-char -1) (skip-chars-backward "\041-\056\060-\176") (mlh-backward-henkan) - (setq beg (point)) - (goto-char end-marker) + (setq mlh-beg (point)) + (goto-char mlh-end-marker) (backward-delete-char 2) - (japanese-zenkaku-region beg (point)) + (japanese-zenkaku-region mlh-beg (point)) (if (null henkan-begin) - (setq henkan-begin beg))) + (setq henkan-begin mlh-beg))) (provide 'egg-mlh) ;;; egg-mlh.el ends here. diff -Nru egg-4.1.8/egg-sj3.el egg-4.2.0/egg-sj3.el --- egg-4.1.8/egg-sj3.el 2014-11-10 02:03:36.000000000 +0000 +++ egg-4.2.0/egg-sj3.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,407 +0,0 @@ -;;; egg-sj3.el --- SJ3 Support (high level interface) -*- coding: utf-8 -*- -;;; in Egg Input Method Architecture - -;; Copyright (C) 1999, 2000 Free Software Foundation, Inc - -;; Author: NIIBE Yutaka - -;; Maintainer: TOMURA Satoru - -;; Keywords: 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 'egg) -(require 'egg-sj3rpc) - -(defgroup sj3 nil - "SJ3 interface for Tamago 4." - :group 'egg) - -(defcustom sj3-hostname "localhost" - "Hostname of SJ3 server" - :group 'sj3 :type 'string) - -(defcustom sj3-server-port 3086 - "Port number of SJ3 server" - :group 'sj3 :type 'integer) - -(defmacro SJ3-const (c) - (cond ((eq c 'FileNotExist) 35) - )) - -(defvar sj3-hinshi-menu - '(("名詞" . - (menu "品詞:名詞:" - (("名詞" . 1) - ("名詞(お…)" . 2) - ("名詞(ご…)" . 3) - ("名詞(…的/化)" . 4) - ("名詞(お…する)" . 5) - ("名詞(…する)" . 6) - ("名詞(ご…する)" . 7) - ("名詞(…な/に)" . 8) - ("名詞(お…な/に)" . 9) - ("名詞(ご…な/に)" . 10) - ("名詞(副詞)" . 11)))) - ("代名詞" . 12) - ("苗字" . 21) - ("名前" . 22) - ("地名" . 24) - ("県/区名" . 25) - ("動詞" . - (menu "品詞:動詞:" - (("サ変語幹" . 80) - ("ザ変語幹" . 81) - ("一段不変化部" . 90) - ("カ行五段語幹" . 91) - ("ガ行五段語幹" . 92) - ("サ行五段語幹" . 93) - ("タ行五段語幹" . 94) - ("ナ行五段語幹" . 95) - ("バ行五段語幹" . 96) - ("マ行五段語幹" . 97) - ("ラ行五段語幹" . 98) - ("ワ行五段語幹" . 99)))) - ("連体詞" . 26) - ("接続詞" . 27) - ("助数詞" . 29) - ("数詞" . 30) - ("接頭語" . 31) - ("接尾語" . 36) - ("副詞" . 45) - ("副詞2" . 46) - ("形容詞語幹" . 60) - ("形容動詞語幹" . 71) - ("単漢字" . 189)) - "Menu data for a hinshi (a part of speech) selection.") - -(defun sj3-hinshi-name (id &optional menu alist) - "Return a hinshi (a part of speech) name corresponding to ID. -If ID is nil, return a flattened alist from `sj3-hinshi-menu'. -Don't specify the optional arguments in normal use." - (let ((menu (or menu sj3-hinshi-menu))) - (if (consp menu) - (if (consp (cdr menu)) - (mapc (lambda (elem) - (setq alist (sj3-hinshi-name nil elem alist))) - menu) - (setq alist (nconc alist (list (cons (cdr menu) (car menu))))))) - (if id - (cdr (assq id alist)) - alist))) - -(setplist 'sj3-conversion-backend - '(egg-start-conversion sj3-start-conversion - egg-get-bunsetsu-source sj3-get-bunsetsu-source - egg-get-bunsetsu-converted sj3-get-bunsetsu-converted - egg-list-candidates sj3-list-candidates - egg-decide-candidate sj3-decide-candidate - egg-change-bunsetsu-length sj3-change-bunsetsu-length - egg-end-conversion sj3-end-conversion - egg-word-registration sj3-word-registration)) - -(defconst sj3-backend-alist '((Japanese ((sj3-conversion-backend))))) - -(egg-set-finalize-backend '(sj3-finalize-backend)) - -(defvar sj3-stdy-size 0 "STDYSIZE of SJ3 server") - -(defvar sj3-open-message) - -(defun sj3-open (hostname) - "Establish the connection to SJ3 server. Return process object." - (let* ((buf (generate-new-buffer " *SJ3*")) - proc result) - (condition-case err - (setq proc (open-network-stream "SJ3" buf hostname sj3-server-port)) - ((error quit) - (egg-error "failed to connect sj3 server"))) - (set-process-query-on-exit-flag proc nil) - (set-process-coding-system proc 'binary 'binary) - (set-marker-insertion-type (process-mark proc) t) - (with-current-buffer buf - (erase-buffer) - (buffer-disable-undo) - (set-buffer-multibyte nil)) - ;; Initialize dictionaries - (setq result (sj3rpc-open proc (system-name) (user-login-name))) - (if (< result 0) - (let ((msg (sj3rpc-get-error-message (- result)))) - (delete-process proc) - (kill-buffer buf) - (egg-error "Can't open SJ3 session (%s): %s" hostname msg))) - (setq result (sj3rpc-get-stdy-size proc)) - (if (< result 0) - (let ((msg (sj3rpc-get-error-message (- result)))) - (delete-process proc) - (kill-buffer buf) - (egg-error "Can't get SJ3 STDYSIZE: %s"msg))) - (setq sj3-stdy-size result) - proc)) - -;; ::= [ ] -(defvar sj3-environment nil - "Environment for SJ3 kana-kanji conversion") - -(defsubst sj3env-get-proc (env) - (aref env 0)) -(defsubst sj3env-get-dictionary-list (env) - (aref env 1)) - -;; ::= -;; [ -;; -;; ] -(defsubst sj3-make-bunsetsu (env source converted rest stdy) - (egg-bunsetsu-create - 'sj3-conversion-backend - (vector env source converted rest stdy nil nil nil nil nil))) - -(defsubst sj3bunsetsu-get-env (b) - (aref (egg-bunsetsu-get-info b) 0)) -(defsubst sj3bunsetsu-get-source (b) - (aref (egg-bunsetsu-get-info b) 1)) -(defsubst sj3bunsetsu-get-converted (b) - (aref (egg-bunsetsu-get-info b) 2)) -(defsubst sj3bunsetsu-get-rest (b) - (aref (egg-bunsetsu-get-info b) 3)) -(defsubst sj3bunsetsu-get-stdy (b) - (aref (egg-bunsetsu-get-info b) 4)) - -(defsubst sj3bunsetsu-get-zenkouho (b) - (aref (egg-bunsetsu-get-info b) 5)) -(defsubst sj3bunsetsu-set-zenkouho (b z) - (aset (egg-bunsetsu-get-info b) 5 z)) - -(defsubst sj3bunsetsu-get-zenkouho-pos (b) - (aref (egg-bunsetsu-get-info b) 6)) -(defsubst sj3bunsetsu-set-zenkouho-pos (b zp) - (aset (egg-bunsetsu-get-info b) 6 zp)) - -(defsubst sj3bunsetsu-get-zenkouho-converted (b) - (aref (egg-bunsetsu-get-info b) 7)) -(defsubst sj3bunsetsu-set-zenkouho-converted (b zc) - (aset (egg-bunsetsu-get-info b) 7 zc)) - -(defsubst sj3bunsetsu-get-kugiri-changed (b) - (aref (egg-bunsetsu-get-info b) 8)) -(defsubst sj3bunsetsu-set-kugiri-changed (b s) - (aset (egg-bunsetsu-get-info b) 8 s)) - -(defun sj3-get-bunsetsu-source (b) - (sj3bunsetsu-get-source b)) - -(defun sj3-get-bunsetsu-converted (b) - (concat (sj3bunsetsu-get-converted b) (sj3bunsetsu-get-rest b))) - -(defun sj3-get-bunsetsu-stdy (b) (sj3bunsetsu-get-stdy b)) - -(defvar sj3-dictionary-specification - '(("study.dat") - ["sj3main.dic" ""] - [("private.dic") ""]) - "Dictionary specification of SJ3.") - -(defvar sj3-usr-dic-dir (concat "user/" (user-login-name)) - "*Directory of user dictionary for SJ3.") - -(defun sj3-filename (p) - "" - (cond ((consp p) (concat sj3-usr-dic-dir "/" (car p))) - (t p))) - -(defun sj3-get-environment () - "Return the backend of SJ3 environment." - (if sj3-environment - sj3-environment - (let* ((proc (sj3-open sj3-hostname)) - (freq-info-name (sj3-filename (car sj3-dictionary-specification))) - (l (cdr sj3-dictionary-specification)) - dict-list) - (sj3-open-freq-info proc freq-info-name) - (while l - (let ((dic (car l)) - dic-id) - (setq dic-id - (sj3-open-dictionary proc (sj3-filename (aref dic 0)) - (aref dic 1))) - (if (< dic-id 0) - (egg-error "Dame2") ; XXX - (setq dict-list (cons dic-id dict-list) - l (cdr l))))) - (setq sj3-environment (vector proc dict-list))))) - -(defun sj3-open-freq-info (proc name) - (let ((trying t) - ret) - (while trying - (setq ret (sj3rpc-open-stdy proc name)) - (if (= ret 0) - (setq trying nil) - (message "学習ファイル(%s)がありません" name) - (if (/= ret (SJ3-const FileNotExist)) - (egg-error "Fatal1") ; XXX - (if (and (y-or-n-p - (format "学習ファイル(%s)がありません。作りますか? " - name)) - (sj3rpc-make-directory proc - (file-name-directory name)) - ;; ignore error - (= (sj3rpc-make-stdy proc name) 0)) - (message "学習ファイル(%s)を作りました" name) - (egg-error "Fatal2"))))))) ; XXX - -(defun sj3-open-dictionary (proc name passwd) - (let ((trying t) - ret) - (while trying - (setq ret (sj3rpc-open-dictionary proc name passwd)) - (if (>= ret 0) - (setq trying nil) - (message "辞書ファイル(%s)がありません" name) - (setq ret (- ret)) ; Get error code. - (if (/= ret (SJ3-const FileNotExist)) - (egg-error "Fatal3 %d" ret) ; XXX - (if (and (y-or-n-p - (format "辞書ファイル(%s)がありません。作りますか? " - name)) - (= (sj3rpc-make-dictionary proc name) 0)) - (message "辞書ファイル(%s)を作りました" name) - (egg-error "Fatal4"))))) ; XXX - ret)) - -(defun sj3-start-conversion (backend yomi &optional context) - "Convert YOMI string to kanji, and enter conversion mode. -Return the list of bunsetsu." - (let ((env (sj3-get-environment))) - (sj3rpc-begin env yomi))) - -(defun sj3-end-conversion (bunsetsu-list abort) - (if abort - () - (let ((env (sj3bunsetsu-get-env (car bunsetsu-list))) - (l bunsetsu-list) - bunsetsu stdy kugiri-changed) - (while l - (setq bunsetsu (car l)) - (setq l (cdr l)) - (setq stdy (sj3bunsetsu-get-stdy bunsetsu)) - (if stdy - (sj3rpc-bunsetsu-stdy env stdy)) - (if (and l - (setq kugiri-changed (sj3bunsetsu-get-kugiri-changed - bunsetsu))) - (let ((yomi1 (sj3bunsetsu-get-source bunsetsu)) - (yomi2 (sj3bunsetsu-get-source (car l)))) - (if (/= kugiri-changed (length yomi1)) - (sj3rpc-kugiri-stdy env yomi1 yomi2 - (sj3bunsetsu-get-stdy (car l)))))))))) - -(defun sj3-list-candidates (bunsetsu prev-bunsetsu next-bunsetsu major) - (setq bunsetsu (car bunsetsu)) - (if (sj3bunsetsu-get-zenkouho bunsetsu) - (cons (sj3bunsetsu-get-zenkouho-pos bunsetsu) - (sj3bunsetsu-get-zenkouho-converted bunsetsu)) - (let* ((env (sj3bunsetsu-get-env bunsetsu)) - (yomi (sj3bunsetsu-get-source bunsetsu)) - (z (sj3rpc-get-bunsetsu-candidates env yomi))) - (sj3bunsetsu-set-zenkouho bunsetsu z) - (cons (sj3bunsetsu-set-zenkouho-pos bunsetsu 0) - (sj3bunsetsu-set-zenkouho-converted - bunsetsu - (mapcar 'sj3bunsetsu-get-converted z)))))) - -(defun sj3-decide-candidate (bunsetsu candidate-pos prev-b next-b) - (setq bunsetsu (car bunsetsu)) - (let* ((candidate-list (sj3bunsetsu-get-zenkouho bunsetsu)) - (candidate (nth candidate-pos candidate-list))) - (sj3bunsetsu-set-zenkouho candidate candidate-list) - (sj3bunsetsu-set-zenkouho-pos candidate candidate-pos) - (sj3bunsetsu-set-zenkouho-converted - candidate (sj3bunsetsu-get-zenkouho-converted bunsetsu)) - (list (list candidate)))) - -(defun sj3-change-bunsetsu-length (bunsetsu prev-b next-b len major) - (let ((yomi (mapconcat 'sj3bunsetsu-get-source bunsetsu nil)) - (env (sj3bunsetsu-get-env (car bunsetsu))) - (old (car bunsetsu)) - new yomi1 yomi2) - (setq yomi1 (substring yomi 0 len) - yomi2 (substring yomi len)) - (setq new (sj3rpc-tanbunsetsu-conversion env yomi1)) - ;; Only set once (memory original length of the bunsetsu). - (sj3bunsetsu-set-kugiri-changed new - (or (sj3bunsetsu-get-kugiri-changed old) - (length (sj3bunsetsu-get-source old)))) - (if (> (length yomi2) 0) - (list (list new (sj3rpc-tanbunsetsu-conversion env yomi2))) - (list (list new))))) - -(defun sj3-finalize-backend () - (if sj3-environment - (let ((proc (sj3env-get-proc sj3-environment)) - (dict-list (sj3env-get-dictionary-list sj3-environment)) - dict) - (while dict-list - (setq dict (car dict-list)) - (setq dict-list (cdr dict-list)) - (sj3rpc-close-dictionary proc dict)) ; XXX: check error - (sj3rpc-close-stdy proc) - (sj3rpc-close proc) - (setq sj3-environment nil)))) - -;;; word registration - -(defun sj3-dictionary-select () - (menudiag-select (list 'menu - (egg-get-message 'sj3-register-1) - (aref (nth 2 sj3-dictionary-specification) 0)))) - -(defun sj3-hinshi-select () - (menudiag-select (list 'menu - (egg-get-message 'sj3-register-2) - sj3-hinshi-menu))) - -(defun sj3-word-registration (backend kanji yomi) - "Register a word KANJI with a pronunciation YOMI." - (let* ((env (sj3-get-environment)) - (dic (sj3-dictionary-select)) - (hinshi-id (sj3-hinshi-select)) - (result (sj3rpc-add-word env - (car (aref env 1)) - yomi kanji hinshi-id))) - (if (>= result 0) - (list (sj3-hinshi-name hinshi-id) dic) - (egg-error (sj3rpc-get-error-message (- result)))))) - -;;; setup - -(run-hooks 'sj3-load-hook) - -;;;###autoload -(defun egg-activate-sj3 (&rest arg) - "Activate SJ3 backend of Tamago 4." - (apply 'egg-mode (append arg sj3-backend-alist))) - -;;; egg-sj3.el ends here. diff -Nru egg-4.1.8/egg-sj3rpc.el egg-4.2.0/egg-sj3rpc.el --- egg-4.1.8/egg-sj3rpc.el 2014-11-10 02:03:36.000000000 +0000 +++ egg-4.2.0/egg-sj3rpc.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,309 +0,0 @@ -;;; egg-sj3rpc.el --- SJ3 Support (low level interface) in Egg -;;; Input Method Architecture - -;; Copyright (C) 1999, 2000 Free Software Foundation, Inc - -;; Author: NIIBE Yutaka - -;; Maintainer: TOMURA Satoru - -;; Keywords: 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 'egg-com) -(defvar sj3-stdy-size) ; in egg-sj3.el -(declare-function egg-error (message &rest args) "egg.el" nil) -(declare-function sj3env-get-proc (env) "egg-sj3.el" nil) -(declare-function sj3-make-bunsetsu (env source converted rest stdy) - "egg-sj3.el" nil) - -(defvar sj3-server-version 2 - "*Major version number of SJ3 server.") - -(defvar sj3-server-coding-system 'shift_jis - "*Coding system used when decoding and encoding of I/O operation with -SJ3 server. Valid coding systems are depend on the server spec.") - -(require 'egg-com) -(defmacro sj3-sjis-p () - '(eq 'coding-category-sjis (coding-system-category - sj3-server-coding-system))) -(defmacro sj3-const (c) - (cond ((eq c 'OPEN) 1) - ((eq c 'CLOSE) 2) - ((eq c 'DICADD) 11) - ((eq c 'DICDEL) 12) - ((eq c 'OPENSTDY) 21) - ((eq c 'CLOSESTDY) 22) - ((eq c 'STDYSIZE) 23) - ((eq c 'LOCK) 31) - ((eq c 'UNLOCK) 32) - ((eq c 'BEGIN) '(if (sj3-sjis-p) 41 111)) - ((eq c 'TANCONV) '(if (sj3-sjis-p) 51 112)) - ((eq c 'KOUHO) '(if (sj3-sjis-p) 54 115)) - ((eq c 'KOUHOSU) '(if (sj3-sjis-p) 55 116)) - ((eq c 'STDY) 61) - ((eq c 'CLSTDY) '(if (sj3-sjis-p) 62 117)) - ((eq c 'WREG) '(if (sj3-sjis-p) 71 118)) - ((eq c 'WDEL) '(if (sj3-sjis-p) 72 119)) - ((eq c 'MKDIC) 81) - ((eq c 'MKSTDY) 82) - ((eq c 'MKDIR) 83) - ((eq c 'ACCESS) 84) - ((eq c 'WSCH) '(if (sj3-sjis-p) 91 120)) - ((eq c 'WNSCH) '(if (sj3-sjis-p) 92 121)) - ((eq c 'VERSION) 103) - (t (error "No such constant")))) - -;; XXX -(defconst sj3rpc-error-message (vector )) - -(defun sj3rpc-get-error-message (errno) - (or (and (>= errno 0) - (< errno (length sj3rpc-error-message)) - (aref sj3rpc-error-message errno)) - (format "#%d" errno))) - -(defmacro sj3rpc-call-with-environment (e vlist send-expr &rest receive-exprs) - (let ((v (append - `((proc (sj3env-get-proc ,e))) - vlist))) - (list - 'let v - (append - `(with-current-buffer (process-buffer proc) - (erase-buffer) - ,send-expr - (process-send-region proc (point-min) (point-max)) - (goto-char (prog1 (point) (accept-process-output proc)))) - receive-exprs)))) - -(defmacro sj3rpc-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))) - sj3-server-coding-system))) - -(defun sj3rpc-open (proc myhostname username) - "Open the session. Return 0 on success, error code on failure." - (comm-call-with-proc proc (result) - (comm-format (u u s s s) (sj3-const OPEN) sj3-server-version - myhostname username - ;; program name - (format "%d.emacs-egg" (emacs-pid))) - (comm-unpack (i) result) - (if (= result -2) - 0 - result))) - -(defun sj3rpc-close (proc) - (comm-call-with-proc proc (result) - (comm-format (u) (sj3-const CLOSE)) - (comm-unpack (i) result) - result)) - -(defun sj3rpc-get-stdy-size (proc) - "Return STDYSIZE of SJ3 server. On failure, return error code." - (comm-call-with-proc proc (result) - (comm-format (u) (sj3-const STDYSIZE)) - (comm-unpack (u) result) - (if (/= result 0) - (- result) ; failure - (comm-unpack (u) result) - result))) - -(defsubst sj3rpc-get-stdy (proc) - (let (r - (n 0) - (stdy (make-vector sj3-stdy-size 0))) - (while (< n sj3-stdy-size) - (comm-unpack (b) r) - (aset stdy n r) - (setq n (1+ n))) - stdy)) - -(defun sj3rpc-begin (env yomi) - "Begin conversion." - (let ((yomi-ext (encode-coding-string yomi sj3-server-coding-system)) - (p 0) - len source converted stdy bunsetsu-list bl result) - (sj3rpc-call-with-environment env (result) - (comm-format (u s) (sj3-const BEGIN) yomi-ext) - (comm-unpack (u) result) - (if (/= result 0) - (- result) ; failure - (comm-unpack (u) result) ; skip - (while (progn - (comm-unpack (b) len) - (> len 0)) - (setq stdy (sj3rpc-get-stdy proc)) - (setq converted (sj3rpc-unpack-mb-string)) - (setq source (decode-coding-string (substring yomi-ext p (+ p len)) - sj3-server-coding-system) - p (+ p len)) - (let ((bl1 (cons (sj3-make-bunsetsu env - source converted nil stdy) nil))) - (if bl - (setq bl (setcdr bl bl1)) - (setq bunsetsu-list (setq bl bl1))))) - bunsetsu-list)))) - -(defun sj3rpc-open-dictionary (proc dict-file-name password) - (comm-call-with-proc proc (result) - (comm-format (u s s) (sj3-const DICADD) dict-file-name password) - (comm-unpack (u) result) - (if (/= result 0) - (- result) ; failure - (comm-unpack (u) result) - result))) - -(defun sj3rpc-close-dictionary (proc dict-no) - (comm-call-with-proc proc (result) - (comm-format (u u) (sj3-const DICDEL) dict-no) - (comm-unpack (i) result) - result)) - -(defun sj3rpc-make-dictionary (proc dict-name) - (comm-call-with-proc proc (result) - (comm-format (u s u u u) (sj3-const MKDIC) dict-name - 2048 ; Index length - 2048 ; Length - 256 ; Number - ) - (comm-unpack (i) result) - result)) - -(defun sj3rpc-open-stdy (proc stdy-name) - (comm-call-with-proc proc (result) - (comm-format (u s s) (sj3-const OPENSTDY) stdy-name "") - (comm-unpack (i) result) - result)) - -(defun sj3rpc-close-stdy (proc) - (comm-call-with-proc proc (result) - (comm-format (u) (sj3-const CLOSESTDY)) - (comm-unpack (i) result) - result)) - -(defun sj3rpc-make-stdy (proc stdy-name) - (comm-call-with-proc proc (result) - (comm-format (u s u u u) (sj3-const MKSTDY) stdy-name - 2048 ; Number - 1 ; Step - 2048 ; Length - ) - (comm-unpack (i) result) - result)) - -(defun sj3rpc-make-directory (proc name) - (comm-call-with-proc proc (result) - (comm-format (u s) (sj3-const MKDIR) name) - (comm-unpack (i) result) - result)) - -(defun sj3rpc-get-bunsetsu-candidates-sub (proc env yomi yomi-ext len n) - (let ((i 0) - stdy converted bunsetsu bl bunsetsu-list cylen rest) - (comm-call-with-proc-1 proc (result) - (comm-format (u u s) (sj3-const KOUHO) len yomi-ext) - (comm-unpack (u) result) - (if (/= result 0) - (- result) ; failure - (while (< i n) - (comm-unpack (u) cylen) - (setq stdy (sj3rpc-get-stdy proc)) - (setq converted (sj3rpc-unpack-mb-string)) - (setq rest (decode-coding-string (substring yomi-ext cylen) - sj3-server-coding-system)) - (setq bunsetsu (sj3-make-bunsetsu env yomi converted rest stdy)) - (if bl - (setq bl (setcdr bl (cons bunsetsu nil))) - (setq bunsetsu-list (setq bl (cons bunsetsu nil)))) - (setq i (1+ i))) - (setq bunsetsu (sj3-make-bunsetsu env yomi yomi nil nil)) - (setq bl (setcdr bl (cons bunsetsu nil))) - (setq bunsetsu - (sj3-make-bunsetsu env yomi (japanese-katakana yomi) nil nil)) - (setq bl (setcdr bl (cons bunsetsu nil))) - bunsetsu-list)))) - -(defun sj3rpc-get-bunsetsu-candidates (env yomi) - (let* ((yomi-ext (encode-coding-string yomi sj3-server-coding-system)) - (len (length yomi-ext))) - (sj3rpc-call-with-environment env (result) - (comm-format (u u s) (sj3-const KOUHOSU) len yomi-ext) - (comm-unpack (u) result) - (if (/= result 0) - (- result) ; failure - (comm-unpack (u) result) - (if (= result 0) - (list (sj3-make-bunsetsu env yomi yomi nil nil)) ; XXX - (sj3rpc-get-bunsetsu-candidates-sub proc env - yomi yomi-ext len result)))))) - -(defun sj3rpc-tanbunsetsu-conversion (env yomi) - (let* ((yomi-ext (encode-coding-string yomi sj3-server-coding-system)) - (len (length yomi-ext)) cylen stdy converted rest bunsetsu) - (sj3rpc-call-with-environment env (result) - (comm-format (u u s) (sj3-const TANCONV) len yomi-ext) - (comm-unpack (u) result) - (if (/= result 0) - (- result) - (comm-unpack (u) cylen) - (setq stdy (sj3rpc-get-stdy proc)) - (setq converted (sj3rpc-unpack-mb-string)) - (setq rest (decode-coding-string (substring yomi-ext cylen) - sj3-server-coding-system)) - (setq bunsetsu (sj3-make-bunsetsu env yomi converted rest stdy)))))) - -(defun sj3rpc-bunsetsu-stdy (env stdy) - (sj3rpc-call-with-environment env (result) - (comm-format (u v) (sj3-const STDY) stdy (length stdy)) - (comm-unpack (u) result) - (- result))) - -(defun sj3rpc-kugiri-stdy (env yomi1 yomi2 stdy) - (sj3rpc-call-with-environment env (result) - (comm-format (u s s v) (sj3-const CLSTDY) - (encode-coding-string yomi1 sj3-server-coding-system) - (encode-coding-string yomi2 sj3-server-coding-system) - stdy (length stdy)) - (comm-unpack (u) result) - (- result))) - -(defun sj3rpc-add-word (env dictionary yomi kanji hinshi) - "Register a word KANJI into DICTIONARY with a pronunciation YOMI and -a part of speech HINSHI. Where DICTIONARY should be an integer." - (sj3rpc-call-with-environment env (result) - (comm-format (u u s s u) (sj3-const WREG) dictionary - (encode-coding-string yomi sj3-server-coding-system) - (encode-coding-string kanji sj3-server-coding-system) - hinshi) - (comm-unpack (u) result) - (- result))) - -(provide 'egg-sj3rpc) - -;;; egg-sj3rpc.el ends here. diff -Nru egg-4.1.8/README egg-4.2.0/README --- egg-4.1.8/README 2014-11-10 02:03:36.000000000 +0000 +++ egg-4.2.0/README 2015-04-30 00:13:12.000000000 +0000 @@ -1,9 +1,10 @@ -Egg version 4.1.8 +Egg version 4.2.0 NIIBE Yutaka - 2014-11-10 + 2015-04-30 -This is another Egg V4 release by the original author. +This is another Egg V4 release by the original author. This release +requires newer Anthy (than version 0.3). The official maintainer at AIST has no interest about maintenance of this software. Official Mailing list, homepage, and FTP site are all @@ -11,13 +12,14 @@ Until the official maintainer will work again for the real release (as he once primised to me), for the time being, I keep this package -running on newer Emacs. +running on newer Emacs and newer Anthy. + +This release only supports Anthy backend and it's Japanese-only. Old files are moved to the ATTIC directory. It will be removed in the -next release, perhaps. +next release, perhaps. In those files, SJ3 support would work, but I +don't have SJ3 at hand, so, it's not guaranteed. -This only supports Anthy backend and Japanese-only. SJ3 support would -work, but I don't have SJ3 at hand. If you need other features than -that, please ask the official maintainer or use old software with old -Emacs. +If you need other features than that, please ask the official +maintainer or use old software with old Emacs. --