--- egg-4.0.6+0.20041122cvs.orig/its.el +++ egg-4.0.6+0.20041122cvs/its.el @@ -1561,25 +1561,23 @@ ;; 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) --- egg-4.0.6+0.20041122cvs.orig/Makefile.in +++ egg-4.0.6+0.20041122cvs/Makefile.in @@ -55,6 +55,7 @@ menudiag.el \ its.el \ its-keydef.el \ + leim-list.el \ # EGGSRCS = \ @@ -74,6 +75,7 @@ its/hankata.el \ its/hira.el \ its/jeonkak.el \ + its/greek.el \ its/pinyin.el \ its/hangul.el \ its/kata.el \ --- egg-4.0.6+0.20041122cvs.orig/egg.el +++ egg-4.0.6+0.20041122cvs/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 --- egg-4.0.6+0.20041122cvs.orig/eggrc +++ egg-4.0.6+0.20041122cvs/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-boin-kabusoku t) -;; (wnn-set-shiin-choka t) -;; (wnn-set-n-choka t) -;; (wnn-set-nihongo-kosei 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-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 --- egg-4.0.6+0.20041122cvs.orig/egg-com.el +++ egg-4.0.6+0.20041122cvs/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))))))))) +(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)))) -(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)) +(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 @@ (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 @@ (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 @@ `(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) --- egg-4.0.6+0.20041122cvs.orig/egg-anthy.readme +++ egg-4.0.6+0.20041122cvs/egg-anthy.readme @@ -0,0 +1,325 @@ +『自家製 egg-anthy』について + +1. 自家製 egg-anthy について + この tar ball は白井秀行(*1)が個人的に Anthy(*2) を Tamago Ver.4(*3) か + ら *ちゃんと* 使おう!と思いたちでっちあげた elisp 群です。ぼくは、Meadow + や Zaurus 上の Emacs で egg-anthy を使ってめちゃくちゃ幸せになりました。 + + 私は + + (1) Meadow な NotePC で持ち歩くから、サーバに繋げられないので Meadow から + も MS-IME で悲しい。だけど、anthy って cygwin で make できるなぁ。 + + (2) Zaurus の Emacs で FreeWnn を egg-wnn で使っているけど、ちょっと辞書 + を増やすとメモリは食うわ、遅くなるわで、大変。 + + (3) Anthy 付属の anthy.el でも良いのだけど、どうしても指と頭が egg な動き + のままだ。 + + という問題に悩まされていました。同じ悩みをお持ちの方には有効だと思います。 + また、egg-remix(*4) と組み合わせても順調に動いています。 + + (*1) shirai@meadowy.org <= 要望/バグ報告等はこちらまでどうぞ + (*2) http://anthy.sourceforge.jp/ + (*3) http://www.m17n.org/tamago/ + (*4) http://www.extipl.jp/~payashi/remix/ + + +2. anthy のインストール + http://anthy.sourceforge.jp/ からどうぞ。2005年02月28日 現在では + anthy-6131 に対応しています。anthy-5900(またはそれ以前) でも動作すると思 + われますが、辞書登録時にサポートしている品詞にミスマッチが生じるため、 + egg-anthy がサポートしているすべての品詞を使うことはできません。 + + +3. Tamago Ver.4 + 自家製 egg-anthy のインストール + リリース版の Tamago 4.0.6 では動作しませんので注意してください。 + +3.1 まだ Tamago をインストールしていない人 +(1) CVS Head な Tamago を http://cvs.m17n.org/viewcvs/tamago/tamago/ など + から貰ってきます。Tamago Ver.4 はいろいろなパッチが出ているので、必要な + 人は漁ってください。http://www.asahi-net.or.jp/~mu6k-ski/tamago.html も + 参考になるでしょう。 + +(2) 同梱の anthy.el, anthyipc.el を上記の tamago 一式を展開した + tamago/egg/ 以下の同名のファイルに上書きします。 + +(3) 普通に tamago をインストールします。 + +3.2 すでに Tamago をインストールしている人 + egg-anthy 付きのバージョンか否かで、方法が変わります。 + +3.2.1 "C-uC-\" で "japanese-egg-anthy" が出てこない人 + 2.1 を参考にして、一から Tamago をインストールしてください。 + +3.2.2 "C-uC-\" で "japanese-egg-anthy" が出てくる人 + (環境によって違うと思いますが)/usr/local/local/share/emacs/site-lisp/egg/egg + 以下に同梱の anthy.el, anthyipc.el をコピーして byte-compile してください。 + + +4. 使い方 + 普通に C-uC-\ で "japanese-egg-anthy" を選択すれば OK です。 + + (setq default-input-method "japanese-egg-anthy") + + とか ~/.emacs に書いておけばすぐ egg-anthy が使える状態になります。 + + +5. 自家製 egg-anthy の中身 + http://anthy.sourceforge.jp/cgi-bin/hiki/hiki.cgi?Emacs%A4%AB%A4%E9 のパッ + チを使わせていただきました。だけどこれだけだと、変換して C-h で取り消しっ + て 16回やったら破綻しますよね。 + +5.1 制限事項 +(1) Tamago Ver.4 の特徴の一つであるマルチフェンスは同時に 16個までしかオー + プンできません。 + + これは、anthy-agent を -egg 付きで動かした場合の anthy-agent の制限事項で + す。15個を越えるとシツコクメッセージを出します。自分で改造すればそれ以上 + のフェンスをオープンできますが、通常必要ないと思います。もし、間違って + 17個以上のフェンスをオープンして破綻したときは、 + "M-x anthy-egg-recover" と打ってください。 + +(2) egg-abort-conversion(), egg-decide-before-point() の二つの関数に + advice をかけていますので、注意してください。 + + tamago 本体に手を加えたくないため、advice で逃げました。 + +5.2 気のきいている点 +(1) Anthy 付属の anthy.el と同時に使用することができます。 + + そのときは、 + (locate-library "anthy") + => "/usr/local/share/emacs/site-lisp/anthy/anthy.elc" + というふうに、Anthy 付属の anthy.el が load-path のはじめに出てくるように + 調整してください。 + + (locate-libraries "anthy") + => ("/usr/local/share/emacs/site-lisp/anthy/anthy.elc" + "/usr/local/share/emacs/site-lisp/egg/egg/anthy.elc") + となれば OK です。 + +(2) anthy-6131 付属の anthy-dic-tool がサポートしている品詞はすべて egg か + ら登録することが出来ます。 + + 今後 anthy-dic-tool がサポートする品詞が増えたときの対応はそのときに考え + ますが、/usr/local/share/anthy/typetab を自動で解析しないとだめかなぁ。。。 + + また、動詞の登録は癖があります。例えば「焼き込む」を登録するときは、 + 漢字:『書き込』、読み:『やきこ』、活用:『マ行五段活用』 + の様に活用語尾を外して登録します。 + +(3) オリジナルの egg-anthy が対応していなかった、ひらがな変換(M-h)、カタカ + ナ変換(M-k) に対応しています。 + + +6. UTF-8 対応 + 最近の Anthy では、Anthy 内部が UNICODE 化し、安定版では anthy-8700 以降 + の anthy-agent, anthy-dic-tool でも "--utf8" というオプションを使えば + UTF-8 で通信することができます。お使いの Emacs が Emacs-22 または + Emacs-21 + Mule-UCS のときは、Anthy と UTF-8 で通信することができます。 + +6.1 設定 + egg-anthy を使う前に + + (setq anthy-egg-use-utf8 t) + + とします。デフォルトは nil です。 + + また、leim に登録されている egg-anthy の input-method 名が標準の + "japanese-egg-anthy" でないとき、または複数持つときは、 + anthy-egg-input-method-list に以下のように設定します。 + + (setq anthy-egg-input-method-list '("japanese-egg-anthy" "anthy")) + +6.2 注意点 その一 + 日本語(?)以外の単語を Anthy の辞書に登録可能にする点と、日本語(?)以外を + リージョンに指定しての "M-x egg-convert-region" でエラーを出さないように + するため、egg-toroku-bunsetsu, egg-toroku-region, egg-convert-region, + egg-separate-languages の各関数に advice をかけています。 + + この機能は + + (setq anthy-egg-use-chinese-korean-server t) + + とすると無効になり、kWnn, cWnn と utf-8 な Anthy が共存できます。デフォル + トは nil です。 + +6.3 注意点 その二 + UTF-8 を用いて Anthy から文字が出て来たときに Emacs がその文字がどの + charset set に割り当てるかは、その Emacs 次第です。例えば、Mule-UCS を使っ + ていても Emacs-22 の utf-translate-cjk-mode() を使っても、デフォルトでは + 『α』が japanese-jisx0208 ではなく greek-iso8859-7 として扱われます。 + + おそらく大抵の人は japanese-jisx0208 として扱ってほしいと思われるので、以 + 下のように文字セット変更の設定が必要です。なお、下記の例はわたしのもので、 + 間違っている可能性もありますし、各人の趣味の問題もありますので、ご参考ま + でにどうぞ。 + +(cond + ((featurep 'jisx0213) + ;; Mule-UCS + JISX0213 の設定 + (setq unicode-basic-translation-charset-order-list + '(ascii + japanese-jisx0208 ;; 移動 + japanese-jisx0213-1 ;; 移動 + japanese-jisx0213-2 ;; 移動 + japanese-jisx0212 ;; 移動 + 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 + ;; もとはここ + 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 の設定 + (setq unicode-basic-translation-charset-order-list + '(ascii + japanese-jisx0208 ;; 移動 + japanese-jisx0212 ;; 移動 + 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 + ;; もとはここ + 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 の utf-translate-cjk-mode の設定例 (mule-ja ML より) +(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)))) + + +●変更履歴 + 2005年 2月28日 + 新規 + + 2005年 3月 9日 + * egg/anthyipc.el (anthyipc-get-greeting): anthy-agent の '6300d' 形式の + バージョン番号に対応。 + + 2005年 5月10日 + * 前回の変更が思いっきり間違っていた ^^;;; ので修正。 + + 2005年 8月 4日 + * 郵便番号を簡単に引くための対応(add-hook)。 + + 2006年 2月13日 + * 単語登録した語句にスペースが含まれていると破綻していたのを修正。 + => Anthy-7100b で動作確認。それ以降(現時点では Anthy-7411)は Anthy 側が + おかしな感じなので、本体側の修正待ち。 + * 郵便番号対応は Anthy-7100b 以降本体に含まれたので意味が無くなったため外 + した。 + + 2006年 5月19日 + * "nihonngoto[SPC][RET][SPC]qalphabet[SPC][C-g]nokonnzai[SPC][RET]" 対応。 + anthyipc-read-string-type1(), anthyipc-read-string-type2() を変更。 + + 2006年 5月24日 + * 前回の対応の修正。anthyipc-read-string-type1() の書き直し。 + + 2006年 5月25日 + * よくよく考えたら、split-string の挙動が Emacs-22 と Emacs-20,21 とは違 + うことを思い出したので、対応。 + + 2006年 6月 6日 + * 動詞の単語登録を間違っていたので修正。活用形を anthy-dic-tool に渡して + いなかったが、どうやら最初からのようだ。 + * 前回の修正で間違え見付け。二文節め以降をひらがな、カタカナにできなかった。 + + 2007年 4月19日 + * Anthy の utf-8 対応。Readme の追記。 + * elisp の Version の付け方を変えた。 + +以上! + + +Local Variables: +mode: outline +mode: numbered-outline +numbered-outline-begin-number: 1 +mode: auto-fill +fill-column: 74 +End: --- egg-4.0.6+0.20041122cvs.orig/helper/egg-helper.c +++ egg-4.0.6+0.20041122cvs/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); +} --- egg-4.0.6+0.20041122cvs.orig/debian/emacsen-remove +++ egg-4.0.6+0.20041122cvs/debian/emacsen-remove @@ -0,0 +1,40 @@ +#!/bin/sh +# /usr/lib/emacsen-common/packages/remove/foo +# [ This particular script hasn't been tested either, so be careful. ] +set -e + +FLAVOR=$1 +PACKAGE="egg" + +if [ "X${FLAVOR}" = "X" ]; then + echo Need argument to determin FLAVOR of emacs; + exit 1 +fi + +if [ "X${PACKAGE}" = "X" ]; then + echo Internal error: need package name; + exit 1; +fi + +ELDIR=/usr/share/emacs/site-lisp/${PACKAGE} +ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} +STARTDIR=/etc/${FLAVOR}/site-start.d +STARTFILE="${PACKAGE}-init.el"; + +SITELISP=/usr/share/${FLAVOR}/site-lisp + +case "${FLAVOR}" in + emacs) + + ;; + emacs2*|emacs-snapshot) + echo -n "remove/${PACKAGE}: Handling removal of emacsen flavor ${FLAVOR} ..." + rm -rf ${ELCDIR} + rm -f ${STARTDIR}/50${STARTFILE}*; + echo " done." + ;; + *) + ;; +esac + +exit 0; --- egg-4.0.6+0.20041122cvs.orig/debian/rules +++ egg-4.0.6+0.20041122cvs/debian/rules @@ -0,0 +1,61 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 +PACKAGE=egg + +build: build-stamp +build-stamp: + dh_testdir + + ./configure + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + -$(MAKE) distclean + rm -f `pwd`/helper/egg-helper + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + cp -r eggrc *.el egg its Makefile \ + `pwd`/debian/$(PACKAGE)/usr/share/emacs/site-lisp/egg/ + rm -rf `pwd`/debian/$(PACKAGE)/usr/share/emacs/site-lisp/egg/its/CVS + rm -rf `pwd`/debian/$(PACKAGE)/usr/share/emacs/site-lisp/egg/egg/CVS + + install -m 644 debian/egg-init.el \ + `pwd`/debian/$(PACKAGE)/usr/share/emacs/site-lisp/egg/ + +# Build architecture-dependent files here. +binary-arch: build install + +# Build architecture-dependent files here. +binary-indep: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installemacsen + dh_installinfo + dh_installchangelogs ChangeLog ChangeLog.0 + dh_link + dh_compress + dh_fixperms + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- egg-4.0.6+0.20041122cvs.orig/debian/changelog +++ egg-4.0.6+0.20041122cvs/debian/changelog @@ -0,0 +1,360 @@ +egg (4.0.6+0.20041122cvs-18) unstable; urgency=low + + * Emacs23 support code cleanup + + -- ISHIKAWA Mutsumi Mon, 09 Nov 2009 19:13:43 +0900 + +egg (4.0.6+0.20041122cvs-17) unstable; urgency=low + + * fixed byte compile problem on emacs22 (emacs22 support is now re-enabled) + * replace emacs23-gtk to emacs23-lucid on dependency + + -- ISHIKAWA Mutsumi Tue, 03 Nov 2009 19:23:36 +0900 + +egg (4.0.6+0.20041122cvs-16) unstable; urgency=low + + * fix emacses-install script to fix emacs22 or before byte compile + problem (emacs 22 or before support is dropped) + * fix wnnrpc problem on 64bit plathome (enbugged on Wnn7 integration + perhaps since 2002...), closes: #492539, #501802 + + -- ISHIKAWA Mutsumi Mon, 26 Oct 2009 22:01:44 +0900 + +egg (4.0.6+0.20041122cvs-15) unstable; urgency=low + + * fix Wnn support on Emacs23 to apply patch from + http://www.m17n.org/mlarchive/mule-ja/200703/msg00018.html + closes: #543254 + * drop emacs22 support (because of above patch only works on + emacs23 or later). + + -- ISHIKAWA Mutsumi Mon, 26 Oct 2009 19:09:32 +0900 + +egg (4.0.6+0.20041122cvs-14) unstable; urgency=low + + * add emacs23 support + * bump Standerd-Version to 3.8.2.0 + + -- ISHIKAWA Mutsumi Sun, 02 Aug 2009 14:57:00 +0900 + +egg (4.0.6+0.20041122cvs-13) unstable; urgency=low + + * oops, Makefile called from emacsen-install script is broken, + can not byte compile *.elc on all environment (expect on my machine..) + Thanks reporing this problem, masy :-) + + -- ISHIKAWA Mutsumi Fri, 21 Nov 2008 02:22:03 +0900 + +egg (4.0.6+0.20041122cvs-12) unstable; urgency=low + + * drop emacs21 support + - drop UNIX domain socket connect helper utility(this is only needed on + emacs21 environment) + - change architecture: any -> all + * bump Standerd-Version to 3.8.0.1 + + -- ISHIKAWA Mutsumi Tue, 18 Nov 2008 23:30:44 +0900 + +egg (4.0.6+0.20041122cvs-11) unstable; urgency=low + + * merge anthy support enhancements/fixes written by SHIRAI-san, + (version 20070419 from http://www.meadowy.org/~shirai/), + closes: #365415 + * update FSF's address in copyright + + -- ISHIKAWA Mutsumi Thu, 24 May 2007 13:57:16 +0900 + +egg (4.0.6+0.20041122cvs-10) unstable; urgency=low + + * adapt emacs22 + * fix debian/rules to clean up helper/egg-helper + * cleanup debian/rules + * bump Standerd-Version to 3.7.2.2 + + -- ISHIKAWA Mutsumi Tue, 15 May 2007 14:41:55 +0900 + +egg (4.0.6+0.20041122cvs-9) unstable; urgency=low + + * add emacs-snapshot support + + -- ISHIKAWA Mutsumi Sun, 7 Aug 2005 01:33:26 +0900 + +egg (4.0.6+0.20041122cvs-8) unstable; urgency=low + + * add missing dependency + Pre-Depends: make + + -- ISHIKAWA Mutsumi Fri, 29 Apr 2005 14:03:43 +0900 + +egg (4.0.6+0.20041122cvs-7) unstable; urgency=low + + * update README.Debian + + -- ISHIKAWA Mutsumi Tue, 29 Mar 2005 18:27:00 +0900 + +egg (4.0.6+0.20041122cvs-6) unstable; urgency=low + + * description typo fix, thanks Tagoh... + + -- ISHIKAWA Mutsumi Wed, 23 Mar 2005 22:26:53 +0900 + +egg (4.0.6+0.20041122cvs-5) unstable; urgency=low + + * eggrc typo fix + + -- ISHIKAWA Mutsumi Mon, 28 Feb 2005 09:04:38 +0900 + +egg (4.0.6+0.20041122cvs-4) unstable; urgency=low + + * add egg-helper to connect IM server via UNIX domain socket + * Architecture: all -> any (because egg-helper is architecture depend binary) + * canna backend change to use egg-helper instead of icanna (of yc-el) + * drop Suggests: yc-el + + -- ISHIKAWA Mutsumi Thu, 24 Feb 2005 03:11:27 +0900 + +egg (4.0.6+0.20041122cvs-3) unstable; urgency=low + + * fix canna inet connection error on Emacs 21.3, + thanks Hajimu UMEMOTO :-) + + -- ISHIKAWA Mutsumi Thu, 24 Feb 2005 00:19:06 +0900 + +egg (4.0.6+0.20041122cvs-2) unstable; urgency=low + + * fix eggrc wnn7 entry + * fix Wnn server connect error from client running on 64bit environment + to server running on 32bit environment. + * add Wnn8 support + + -- ISHIKAWA Mutsumi Wed, 23 Feb 2005 01:58:15 +0900 + +egg (4.0.6+0.20041122cvs-1) unstable; urgency=low + + * import changeset from unofficial tar archive([tamago:00643]) + - Add kana input support + - Makefile.in cleanup + * canna backend UNIX domain socket support + (written by Tagoh, Ukai and me) + * cleanup orig.tar.gz + + -- ISHIKAWA Mutsumi Thu, 10 Feb 2005 20:07:23 +0900 + +egg (4.0.6+0.20020909cvs-6) unstable; urgency=low + + * change dependency from `Depends: emacs21' to `Depends: emacs21-nox | + emacs21' to solve tasksel Japanese problem (requested from Kenshi Muto) + + -- ISHIKAWA Mutsumi Mon, 2 Aug 2004 15:01:12 +0900 + +egg (4.0.6+0.20020909cvs-5) unstable; urgency=low + + * anthy support fix ([tamago:00639]) + + -- ISHIKAWA Mutsumi Sun, 18 Jul 2004 02:46:21 +0900 + +egg (4.0.6+0.20020909cvs-4) unstable; urgency=low + + * remove Depends: emacs20 (emacs20 was removed from Debian tree) + + -- ISHIKAWA Mutsumi Fri, 20 Feb 2004 00:11:29 +0900 + +egg (4.0.6+0.20020909cvs-3) unstable; urgency=low + + * remove Depends: emacs20-dl (emacs20-dl was removed from Debian tree) + closes: #190828 + + -- ISHIKAWA Mutsumi Sat, 26 Apr 2003 19:25:11 +0900 + +egg (4.0.6+0.20020909cvs-2) unstable; urgency=low + + * change maintainer's email address + * adapt policy 3.5.8.0 + * add suggects: canna|freewnn-jserver|freewnn-cserver|freewnn-kserver|anthy + + -- ISHIKAWA Mutsumi Sun, 5 Jan 2003 14:29:37 +0900 + +egg (4.0.6+0.20020909cvs-1) unstable; urgency=low + + * update to current CVS (20020909) + * emacsen-install cleanup + + -- ISHIKAWA Mutsumi Sat, 14 Sep 2002 14:51:20 +0900 + +egg (4.0.6+0.20020814cvs-1) unstable; urgency=low + + * update to current CVS (20020814) + - add Anthy support + + -- ISHIKAWA Mutsumi Wed, 14 Aug 2002 00:44:32 +0900 + +egg (4.0.6+0.20020802cvs-1) unstable; urgency=low + + * update to current CVS (20020802) + - its.el (its-previous-line): point-mim -> point-min (typo) + + -- ISHIKAWA Mutsumi Fri, 2 Aug 2002 12:49:43 +0900 + +egg (4.0.6+0.20020722cvs-1) unstable; urgency=low + + * update to current CVS (20020722) + + -- ISHIKAWA Mutsumi Tue, 23 Jul 2002 00:23:52 +0900 + +egg (4.0.6+0.20020720cvs-1) unstable; urgency=low + + * update to current CVS (20020720) + + -- ISHIKAWA Mutsumi Sat, 20 Jul 2002 22:06:04 +0900 + +egg (4.0.6+0.20011201cvs-3.8) unstable; urgency=low + + * add wnn-set param functions for Wnn7 + + -- ISHIKAWA Mutsumi Sat, 1 Jun 2002 02:41:39 +0900 + +egg (4.0.6+0.20011201cvs-3.7) unstable; urgency=low + + * Now Wnn7 jserver will be auto detected. + but code is very very and very ad-hoc, (wara + * update README.Debian about Wnn7 + + -- ISHIKAWA Mutsumi Wed, 29 May 2002 02:14:12 +0900 + +egg (4.0.6+0.20011201cvs-3.6) unstable; urgency=low + + * fix wnn7 detection code (not complete yet) + + -- ISHIKAWA Mutsumi Mon, 27 May 2002 22:12:32 +0900 + +egg (4.0.6+0.20011201cvs-3.5) unstable; urgency=low + + * replace wnn7rpc-call-with-environment -> wnnrpc-call-with-environment + * replace wnn7rpc-get-result -> wnnrpc-get-result + + -- ISHIKAWA Mutsumi Fri, 24 May 2002 02:15:25 +0900 + +egg (4.0.6+0.20011201cvs-3.4) unstable; urgency=low + + * import some functions and modification from wnn7egg-rpc.el + + -- ISHIKAWA Mutsumi Thu, 23 May 2002 03:54:49 +0900 + +egg (4.0.6+0.20011201cvs-3.3) unstable; urgency=low + + * wnn7 protocol command is added in wnnrpc.el + + -- ISHIKAWA Mutsumi Thu, 23 May 2002 03:21:00 +0900 + +egg (4.0.6+0.20011201cvs-3.2) unstable; urgency=low + + * more bit of wnn7 support + + -- ISHIKAWA Mutsumi Thu, 23 May 2002 03:13:02 +0900 + +egg (4.0.6+0.20011201cvs-3.1) unstable; urgency=low + + * change these functions in egg/wnn.el: + (defsubst wnnenv-is-wnn6 (env) (or (eq (wnnenv-get-wnn-version env) 'wnn7) + (eq (wnnenv-get-wnn-version env) 'wnn6))) + (defsubst wnnenv-is-wnn7 (env) (eq (wnnenv-get-wnn-version env) 'wnn7)) + + * add ((eq c 'JLIB_VERSION_WNN7) ?\x4f01) in egg/wnnrpc.el + + -- ISHIKAWA Mutsumi Thu, 23 May 2002 02:57:55 +0900 + +egg (4.0.6+0.20011201cvs-3) unstable; urgency=low + + * add computer.dic entry in eggrc and add description about this + in README.Debian + * cleanup startup elisp file + * change Priority: from optional to extra (adapt override file) + + -- ISHIKAWA Mutsumi Thu, 23 May 2002 02:40:28 +0900 + +egg (4.0.6+0.20011201cvs-2) unstable; urgency=low + + * add Wnn7 support (does not support full functions yet, please + read README.Debian) + + -- ISHIKAWA Mutsumi Thu, 23 May 2002 01:00:48 +0900 + +egg (4.0.6+0.20011201cvs-1) unstable; urgency=low + + * update to current CVS (2002/12/1) + * import various patches from Tamago ML + [tamago:00546] [tamago:00534] [tamago:00468] + * import wnn7egg eggrc defines based on [tamago:00504] + * import patch from Mule-ja ML + [mule-ja:08306] + * adapt emacsen-install to these update + + -- ISHIKAWA Mutsumi Tue, 21 May 2002 22:16:36 +0900 + +egg (4.0.6+0.20010522cvs-4) unstable; urgency=low + + * cleanup description + + -- ISHIKAWA Mutsumi Tue, 7 May 2002 18:29:14 +0900 + +egg (4.0.6+0.20010522cvs-3) unstable; urgency=low + + * add README.Debian, note about ``egg does not support XEmacs'' + ``egg with canna'', closes: #143227, #143229 + + -- ISHIKAWA Mutsumi Fri, 19 Apr 2002 12:06:06 +0900 + +egg (4.0.6+0.20010522cvs-2) unstable; urgency=low + + * update emacs-install file (cleanup .el directory after install) + * fix typo in init.el + + -- ISHIKAWA Mutsumi Thu, 11 Oct 2001 23:02:46 +0900 + +egg (4.0.6+0.20010522cvs-1) unstable; urgency=low + + * Update to current CVS (20010522) + + -- ISHIKAWA Mutsumi Wed, 10 Oct 2001 06:45:22 +0900 + +egg (4.0.6-5) unstable; urgency=low + + * New maintainer (take over from Takuo KITAME) + * make distclean instead of make clean in clean target. + * add Build-Depends-Indep: debhelper + * update Standards-Version to 3.5.6.0 + + -- ISHIKAWA Mutsumi Tue, 9 Oct 2001 12:25:27 +0900 + +egg (4.0.6-4) unstable; urgency=low + + * hopefully fixed canna problem... + + -- Takuo KITAME Tue, 10 Oct 2000 08:35:39 +0900 + +egg (4.0.6-3) unstable; urgency=low + + * remove egg/canna*, it still not work. + (remove Conflicts: emacs-dl-canna) + + -- Takuo KITAME Thu, 28 Sep 2000 07:28:19 +0900 + +egg (4.0.6-2) unstable; urgency=low + + * don't require egg and its/hira in init.el. (closes: Bug#64973) + + -- Takuo KITAME Thu, 24 Aug 2000 11:32:45 +0900 + +egg (4.0.6-1) unstable; urgency=low + + * New upstream release + + -- Takuo KITAME Mon, 14 Feb 2000 10:09:38 +0900 + +egg (4.0.2-1) unstable; urgency=low + + * Initial Release. + + -- Takuo KITAME Mon, 10 Jan 2000 20:57:27 +0900 + + --- egg-4.0.6+0.20041122cvs.orig/debian/docs +++ egg-4.0.6+0.20041122cvs/debian/docs @@ -0,0 +1,5 @@ +AUTHORS +README.ja.txt +TODO +PROBLEMS +egg-anthy.readme --- egg-4.0.6+0.20041122cvs.orig/debian/compat +++ egg-4.0.6+0.20041122cvs/debian/compat @@ -0,0 +1 @@ +5 --- egg-4.0.6+0.20041122cvs.orig/debian/emacsen-install +++ egg-4.0.6+0.20041122cvs/debian/emacsen-install @@ -0,0 +1,75 @@ +#! /bin/sh -e +# /usr/lib/emacsen-common/packages/install/egg +# [ This particular script hasn't been tested, so be careful. ] + +set -e + +FLAVOR=$1 +PACKAGE="egg" + +if [ "X${FLAVOR}" = "X" ]; then + echo Need argument to determin FLAVOR of emacs; + exit 1 +fi + +if [ "X${PACKAGE}" = "X" ]; then + echo Internal error: need package name; + exit 1; +fi + +ELDIR=/usr/share/emacs/site-lisp/${PACKAGE} +ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} + +STARTDIR=/etc/${FLAVOR}/site-start.d +STARTFILE="${PACKAGE}-init.el"; + +SITELISP=/usr/share/${FLAVOR}/site-lisp + +EFLAGS="-batch -q --no-site-file --no-init-file -l ./docomp.el -l./jisx0213.el -f batch-byte-compile" +COMPILE="-batch -q -f batch-byte-compile" + +case "${FLAVOR}" in + emacs) + ;; + emacs20) + AYNU_BUILD= + ;; + emacs21|emacs22|emacs23|emacs-snapshot) + AYNU_BUILD=its/aynu.el + ;; +esac + +case "${FLAVOR}" in + emacs) + ;; + emacs22|emacs23|emacs-snapshot) + + echo -n "install/${PACKAGE}: Byte-compiling for ${FLAVOR} ..." + + rm -rf ${ELCDIR} + install -m 755 -d ${ELCDIR} + + # Copy the temp .el files (and Makefile or so) + # cp -par ${ELDIR}/* ${ELCDIR}/ + + # Byte compile them + (cd ${ELDIR} + make AYNU=${AYNU_BUILD} EMACS=${FLAVOR} lispdir=${SITELISP} install clean > CompilationLog 2>&1 + ) + + mv ${ELDIR}/CompilationLog ${ELCDIR}/ + gzip -9 ${ELCDIR}/CompilationLog + + if [ ! -d ${STARTDIR} ]; then + install -m 755 -d ${STARTDIR} + fi + + cp ${ELDIR}/${STARTFILE} ${STARTDIR}/50${STARTFILE}; + + echo " done." + ;; + *) + ;; +esac + +exit 0; --- egg-4.0.6+0.20041122cvs.orig/debian/control +++ egg-4.0.6+0.20041122cvs/debian/control @@ -0,0 +1,18 @@ +Source: egg +Section: utils +Priority: extra +Maintainer: ISHIKAWA Mutsumi +Build-Depends: debhelper (>> 5.0.0) +Standards-Version: 3.8.3 + +Package: egg +Architecture: all +Pre-Depends: make +Depends: emacs23 | emacs23-lucid | emacs23-nox | emacs22 | emacs22-gtk | emacs22-nox | emacs-snapshot-gtk | emacs-snapshot-lucid |emacs-snapshot | emacs-snapshot-nox +Conflicts: emacs-dl-wnn +Suggests: canna, freewnn-jserver, freewnn-cserver, freewnn-kserver, anthy +Description: Tamago Ver. 4 -- EGG Input Method Architecture for Emacsen + Tamago version 4 (aka egg4) is Input Method Architecture for + emacsen. All of these is written by elisp (you don't need to modify emacsen). + It can use with FreeWnn (jserver, cserver, tserver), Wnn6/Wnn7/Wnn8 jserver, + Canna server and Anthy server. --- egg-4.0.6+0.20041122cvs.orig/debian/egg-init.el +++ egg-4.0.6+0.20041122cvs/debian/egg-init.el @@ -0,0 +1,22 @@ +;; +;; egg-init.el +;; +;; Takuo KITAME +;; ISHIKAWA Mutsumi +;; + +(setq load-path + (cons + (concat "/usr/share/" (symbol-name debian-emacs-flavor) + "/site-lisp/egg") + load-path)) + +(setq egg-canna-helper-path "/usr/lib/egg/egg-helper") + +;; (set-language-info "Japanese" 'input-method "japanese-egg-wnn") + +;;; Try M-x customize-group hira + +;;(set-language-info "Chinese-GB" 'input-method "chinese-gb-egg-wnn-py") +;;(set-language-info "Chinese-CNS" 'input-method "chinese-cns-egg-wnn-py") +;;(set-language-info "Korean" 'input-method "korean-egg-wnn") --- egg-4.0.6+0.20041122cvs.orig/debian/README.Debian +++ egg-4.0.6+0.20041122cvs/debian/README.Debian @@ -0,0 +1,19 @@ +egg for DEBIAN +---------------------- + + - Egg4 does not support XEmacs*. Only for Emacs20.5 or later. + + - If you want to use egg4 with Canna. + Egg4 canna backend connect to cannaserver using UNIX domain + socket per default. On emacs 21.4 (or earlier) canna backend + use `egg-helper' helper program to connect cannaserver. + + - If you want to use egg4 with Wnn7/Wnn8 + + Some Wnn7/Wnn8 functions (e.g YOSOKU henkan) are not supported yet. + + Default eggrc setting uses computer.dic. It is not included in + Wnn7 1.00. Please update Wnn7 1.01(or above), or comment out + computer.dic entry in eggrc. + +ISHIKAWA Mutsumi --- egg-4.0.6+0.20041122cvs.orig/debian/dirs +++ egg-4.0.6+0.20041122cvs/debian/dirs @@ -0,0 +1,3 @@ +usr/lib/egg +usr/share/emacs/site-lisp/egg +etc/emacs/site-start.d --- egg-4.0.6+0.20041122cvs.orig/debian/copyright +++ egg-4.0.6+0.20041122cvs/debian/copyright @@ -0,0 +1,41 @@ +This package was debianized by Takuo KITAME on +Mon, 10 Jan 2000 18:14:38 +0900. + +And Taken over this package by ISHIKAWA Mutsumi + +It was downloaded from + +Upstream Authors: see the AUTHORS file +anthy.el and anthyipc.el is enhanced by Hideyuki SHIRAI + +Copyright: + + Please refer /usr/share/common-licenses/GPL-2 about detail of GPL version 2 + +;;; egg.el --- EGG Input Method Architecture + +;; Copyright (C) 1999, 2000 Free Software Foundation, Inc + +;; Author: NIIBE Yutaka +;; KATAYAMA Yoshio + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; EGG is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +;; MA 02110-1301, USA. --- egg-4.0.6+0.20041122cvs.orig/egg/canna.el +++ egg-4.0.6+0.20041122cvs/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 @@ (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 @@ (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 @@ (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 @@ (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)) --- egg-4.0.6+0.20041122cvs.orig/egg/anthyipc.el +++ egg-4.0.6+0.20041122cvs/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") + ;; スペースがひとつ + ;; 変換後(スペース)読みがな の一般的なパターン (高速化のため) + (prog1 + (cons (match-string-no-properties 1) (match-string-no-properties 2)) + (end-of-line))) + ((not (looking-at ".* .*$")) + ;; スペースがひとつも無かったらエラー + (egg-error "protocol error: %s" + (buffer-substring-no-properties (point) (line-end-position)))) + (t + ;; 複数個のスペースがあるので解析 + (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)) + ;; 偶数個のスペースは変換後にスペースが入っているときだけなので、 + ;; 最後のスペース以降を読みがなにする <= 自信無し + (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 " ")) + ;; 奇数個のスペースは + ;; alphabet/alphabet+スペース, スペースのみの変換の結果 + ;; 読みと変換後でスペースの数が変わることはない <= 自信無し + (if (string= conv yomi) + (prog1 + (cons conv yomi) + (end-of-line)) + ;; 変換後の単語にスペースが偶数個含まれたときは最後のスペース以降 + ;; を読みがなにする <= 自信無し + (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)))) --- egg-4.0.6+0.20041122cvs.orig/egg/wnn.el +++ egg-4.0.6+0.20041122cvs/egg/wnn.el @@ -384,6 +384,8 @@ (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 @@ (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 @@ (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 @@ `((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 @@ `((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 @@ `(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 @@ 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 @@ (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 @@ (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 @@ (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 @@ (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 @@ (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 @@ (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 @@ (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 @@ (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 @@ (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 @@ 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 @@ (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 @@ (cond ((eq (wnnenv-get-server-type env) 'jserver) (wnn-set-hinshi env 'noun "名詞") - (when (wnnenv-is-wnn6 env) + (when (or (wnnenv-is-wnn6 env) (wnnenv-is-wnn7 env) (wnnenv-is-wnn8 env)) (wnn-set-hinshi env 'settou "接頭語(お)") (wnn-set-hinshi env 'rendaku "連濁"))) ((eq (wnnenv-get-server-type env) 'cserver) @@ -2008,7 +2075,7 @@ (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))) --- egg-4.0.6+0.20041122cvs.orig/egg/wnnrpc.el +++ egg-4.0.6+0.20041122cvs/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 @@ (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 @@ (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 @@ (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 @@ (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))) --- egg-4.0.6+0.20041122cvs.orig/egg/anthy.el +++ egg-4.0.6+0.20041122cvs/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 はいくつが良いのか? 1, 10, 100, 1000? 選択? +(defvar anthy-egg-hinshi-menu '(("一般名詞" . NOUN) + ("固有名詞" . PROPER_NOUN) + ("形容詞" . ADJECTIVE) + ("副詞" . ADV) + ("動詞" . VERB)) + "*Anthy の辞書登録用品詞.") + +(defvar anthy-egg-hinshi-proper-menu '("人名" "地名") + "*Anthy の固有名詞") + +(defvar anthy-egg-hinshi-verb-menu '(("カ行五段活用" . "カ行五段") + ("ガ行五段活用" . "ガ行五段") + ("サ行五段活用" . "サ行五段") + ("タ行五段活用" . "タ行五段") + ("ナ行五段活用" . "ナ行五段") + ("バ行五段活用" . "バ行五段") + ("マ行五段活用" . "マ行五段") + ("ラ行五段活用" . "ラ行五段") + ("ワ行五段活用" . "ワ行五段")) + "*Anthy の動詞活用型.") + + +(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 '(("品詞" . "名詞"))) + (na (y-or-n-p (format " 「%sな」と言いますか? " kanji))) + (sa (y-or-n-p (format " 「%sさ」と言いますか? " kanji))) + (suru (y-or-n-p (format " 「%sする」と言いますか? " kanji))) + (ind (y-or-n-p (format " 「%s」は単独で文節になりますか? " kanji))) + (kaku (y-or-n-p (format " 「%sと」と言いますか? " kanji)))) + (setq res (cons `("な接続" . ,na) res)) + (setq res (cons `("さ接続" . ,sa) res)) + (setq res (cons `("する接続" . ,suru) res)) + (setq res (cons `("語幹のみで文節" . ,ind) res)) + (setq res (cons `("格助詞接続" . ,kaku) res)) + res)) + +(defun anthy-egg-hinshi-PROPER_NOUN (kanji) + `(("品詞" . ,(menudiag-select (list 'menu + (format "(%s) 活用系:" kanji) + anthy-egg-hinshi-proper-menu))))) + +(defun anthy-egg-hinshi-PERSONAL (kanji) + '(("品詞" . "人名"))) + +(defun anthy-egg-hinshi-PLACE (kanji) + '(("品詞" . "地名"))) + +(defun anthy-egg-hinshi-ADJECTIVE (kanji) + '(("品詞" . "形容詞"))) + +(defun anthy-egg-hinshi-ADV (kanji) + (let ((res '(("品詞" . "副詞"))) + (to (y-or-n-p (format " 「%sと」と言いますか? " kanji))) + (taru (y-or-n-p (format " 「%sたる」と言いますか? " kanji))) + (suru (y-or-n-p (format " 「%sする」と言いますか? " kanji))) + (ind (y-or-n-p (format " 「%s」は単独で文節になりますか? " kanji)))) + (setq res (cons `("と接続" . ,to) res)) + (setq res (cons `("たる接続" . ,taru) res)) + (setq res (cons `("する接続" . ,suru) res)) + (setq res (cons `("語幹のみで文節" . ,ind) res)) + res)) + +(defun anthy-egg-hinshi-VERB (kanji) + (let* ((res '(("品詞" . "動詞"))) + (key (menudiag-select (list 'menu + (format "(%s) 活用系:" kanji) + anthy-egg-hinshi-verb-menu))) + (meishi (y-or-n-p (format "%s: 連体形を名詞化しますか? " kanji)))) + (setq res (cons `("活用" . ,key) res)) + (setq res (cons `("連用形の名詞化" . ,meishi) res)) + res)) + +(defun anthy-egg-hinshi-select (kanji yomi) + (let ((key (menudiag-select (list 'menu + (concat kanji"(" yomi ") " "品詞:") + 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)) "ユーザ辞書") + (message "%s (%s) の登録に失敗しました" 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.