From d332c3e5e06064f2114b0dde5f989f9dc565b5a9 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 27 Jan 2001 18:46:48 +0000 Subject: [PATCH] tamago-4.0.5 --- ChangeLog | 42 ++++++++++++++++++++++++++ Makefile.in | 4 +-- README.ja.txt | 2 +- egg.el | 2 +- egg/sj3.el | 14 ++++++++- egg/sj3rpc.el | 91 ++++++++++++++++++++++++++++----------------------------- its.el | 44 +++++----------------------- 7 files changed, 112 insertions(+), 87 deletions(-) diff --git a/ChangeLog b/ChangeLog index 76f882e..180116a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,47 @@ 2000-01-12 TOMURA Satoru + * Version 4.0.5 released. + +2000-01-13 Katsumi Yamaoka + + * egg/sj3.el (sj3-end-conversion): Restrain from overrunning. + +2000-01-13 Katsumi Yamaoka + * egg/sj3rpc.el (sj3rpc-open): Use `sj3-server-version' instead of + 2. + (sj3rpc-unpack-mb-string): New macro. + (sj3rpc-tanbunsetsu-conversion, sj3rpc-get-bunsetsu-candidates-sub, + sj3rpc-begin): Use it instead of `comm-unpack'. + + (sj3rpc-server-coding-system): New macro. + (sj3rpc-kugiri-stdy, sj3rpc-tanbunsetsu-conversion, + sj3rpc-get-bunsetsu-candidates, sj3rpc-get-bunsetsu-candidates-sub, + sj3rpc-begin, sj3rpc-unpack-mb-string): Use it. + + (sj3-const): Switch on the value of `sj3-server-version'. + (sj3rpc-kugiri-stdy, sj3rpc-tanbunsetsu-conversion, + sj3rpc-get-bunsetsu-candidates, sj3rpc-get-bunsetsu-candidates-sub, + sj3rpc-begin): Modify for it. + + * egg/sj3.el (sj3-server-coding-system-list): New user option. + (sj3-server-version): Ditto. + +2000-01-13 SAKAI Kiyotaka + + * its.el: typo + * egg.el: typo + +2000-01-13 KATAYAMA Yoshio + + * its.el(its-hiragana, its-katakana): does not work. so deleted. + +2000-01-12 NAKAJI Hiroyuki + + * README.ja.txt: typo + * Makefile.in: (clean, distclean): modified. + +2000-01-12 TOMURA Satoru + * Version 4.0.4 released. 2000-01-12 TOMURA Satoru diff --git a/Makefile.in b/Makefile.in index 0c72e3c..8240408 100644 --- a/Makefile.in +++ b/Makefile.in @@ -93,10 +93,10 @@ all: ${ELCS} ${EMACS} ${BATCHFLAGS} ${DEPS} -f batch-byte-compile $< clean: - rm -f ${ELCS} + rm -f ${ELCS} *~ */*~ \#* .\#* */\#* */.\#* distclean: - rm -f ${ELCS} config.* *~ */*~ Makefile \#* .\#* */\#* */.\#* + rm -f ${ELCS} config.* Makefile install: install-site diff --git a/README.ja.txt b/README.ja.txt index 1c9f162..8120e0a 100644 --- a/README.ja.txt +++ b/README.ja.txt @@ -1,5 +1,5 @@ - Tamago Versio 4 + Tamago Version 4 NIIBE Yutaka KATAYAMA Yoshio diff --git a/egg.el b/egg.el index 43465ba..5929fd1 100644 --- a/egg.el +++ b/egg.el @@ -34,7 +34,7 @@ (require 'egg-edep) (defgroup egg nil - "Tamagotchy --- EGG Versio 4.0") + "Tamago Version 4") (defcustom egg-mode-preference t "*Make Egg as modefull input method, if non-NIL." diff --git a/egg/sj3.el b/egg/sj3.el index 69b5aa4..37b5a42 100644 --- a/egg/sj3.el +++ b/egg/sj3.el @@ -46,6 +46,16 @@ "*Port number of SJ3 server" :group 'sj3 :type 'integer) +(defcustom sj3-server-version 2 + "Major version number of SJ3 server." + :group 'sj3 + :type '(choice (const 1) (const 2))) + +(defcustom sj3-server-coding-system-list '(shift_jis euc-japan) + "List of coding systems for SJ3 server v1 and v2." + :group 'sj3 + :type '(list (symbol :tag "v1") (symbol :tag "v2"))) + (eval-when-compile (defmacro SJ3-const (c) @@ -309,7 +319,9 @@ Return the list of bunsetsu." (setq stdy (sj3bunsetsu-get-stdy bunsetsu)) (if stdy (sj3rpc-bunsetsu-stdy env stdy)) - (if (setq kugiri-changed (sj3bunsetsu-get-kugiri-changed bunsetsu)) + (if (and l + (setq kugiri-changed (sj3bunsetsu-get-kugiri-changed + bunsetsu))) (let ((yomi1 (sj3bunsetsu-get-source bunsetsu)) (yomi2 (sj3bunsetsu-get-source (car l)))) (if (/= kugiri-changed (length yomi1)) diff --git a/egg/sj3rpc.el b/egg/sj3rpc.el index f3ad8b2..fc356eb 100644 --- a/egg/sj3rpc.el +++ b/egg/sj3rpc.el @@ -31,10 +31,6 @@ ;;; Code: - - -;; Only support SJ3 version 2. - (eval-when-compile (require 'egg-com) ;; (load-library "egg/sj3") @@ -48,29 +44,20 @@ ((eq c 'STDYSIZE) 23) ((eq c 'LOCK) 31) ((eq c 'UNLOCK) 32) - ((eq c 'BEGIN) 41) - ((eq c 'BEGIN_EUC) 111) - ((eq c 'TANCONV) 51) - ((eq c 'TANCONV_EUC) 112) - ((eq c 'KOUHO) 54) - ((eq c 'KOUHO_EUC) 115) - ((eq c 'KOUHOSU) 55) - ((eq c 'KOUHOSU_EUC) 116) + ((eq c 'BEGIN) '(if (eq 1 sj3-server-version) 41 111)) + ((eq c 'TANCONV) '(if (eq 1 sj3-server-version) 51 112)) + ((eq c 'KOUHO) '(if (eq 1 sj3-server-version) 54 115)) + ((eq c 'KOUHOSU) '(if (eq 1 sj3-server-version) 55 116)) ((eq c 'STDY) 61) - ((eq c 'CLSTDY) 62) - ((eq c 'CLSTDY_EUC) 117) - ((eq c 'WREG) 71) - ((eq c 'WREG_EUC) 118) - ((eq c 'WDEL) 72) - ((eq c 'WDEL_EUC) 119) + ((eq c 'CLSTDY) '(if (eq 1 sj3-server-version) 62 117)) + ((eq c 'WREG) '(if (eq 1 sj3-server-version) 71 118)) + ((eq c 'WDEL) '(if (eq 1 sj3-server-version) 72 119)) ((eq c 'MKDIC) 81) ((eq c 'MKSTDY) 82) ((eq c 'MKDIR) 83) ((eq c 'ACCESS) 84) - ((eq c 'WSCH) 91) - ((eq c 'WSCH_EUC) 120) - ((eq c 'WNSCH) 92) - ((eq c 'WNSCH_EUC) 121) + ((eq c 'WSCH) '(if (eq 1 sj3-server-version) 91 120)) + ((eq c 'WNSCH) '(if (eq 1 sj3-server-version) 92 121)) ((eq c 'VERSION) 103) (t (error "No such constant"))))) @@ -97,11 +84,21 @@ (process-send-region proc (point-min) (point-max)) (goto-char (prog1 (point) (accept-process-output proc)))) receive-exprs)))) + +(defmacro sj3rpc-server-coding-system () + '(nth (1- sj3-server-version) sj3-server-coding-system-list)) + +(defmacro sj3rpc-unpack-mb-string (coding-system) + `(let ((start (point))) + (while (not (search-forward "\0" nil t)) + (comm-accept-process-output)) + (decode-coding-string (buffer-substring start (1- (point))) + ,coding-system))) (defun sj3rpc-open (proc myhostname username) "Open the session. Return 0 on success, error code on failure." (comm-call-with-proc proc (result) - (comm-format (u u s s s) (sj3-const OPEN) 2 ; Server version + (comm-format (u u s s s) (sj3-const OPEN) sj3-server-version myhostname username ;; program name (format "%d.emacs-egg" (emacs-pid))) @@ -137,11 +134,12 @@ (defun sj3rpc-begin (env yomi) "Begin conversion." - (let ((yomi-ext (encode-coding-string yomi 'euc-japan)) - (p 0) - len source converted stdy bunsetsu-list bl) + (let* ((codesys (sj3rpc-server-coding-system)) + (yomi-ext (encode-coding-string yomi codesys)) + (p 0) + len source converted stdy bunsetsu-list bl) (sj3rpc-call-with-environment env (result) - (comm-format (u s) (sj3-const BEGIN_EUC) yomi-ext) + (comm-format (u s) (sj3-const BEGIN) yomi-ext) (comm-unpack (u) result) (if (/= result 0) (- result) ; failure @@ -150,10 +148,9 @@ (comm-unpack (b) len) (> len 0)) (setq stdy (sj3rpc-get-stdy proc)) - (comm-unpack (E) converted) - (setq source - (decode-coding-string (substring yomi-ext p (+ p len)) - 'euc-japan) + (setq converted (sj3rpc-unpack-mb-string codesys)) + (setq source (decode-coding-string (substring yomi-ext p (+ p len)) + codesys) p (+ p len)) (let ((bl1 (cons (sj3-make-bunsetsu env source converted nil stdy) nil))) @@ -216,19 +213,20 @@ result)) (defun sj3rpc-get-bunsetsu-candidates-sub (proc env yomi yomi-ext len n) - (let ((i 0) + (let ((codesys (sj3rpc-server-coding-system)) + (i 0) stdy converted bunsetsu bl bunsetsu-list cylen rest) (comm-call-with-proc-1 proc (result) - (comm-format (u u s) (sj3-const KOUHO_EUC) len yomi-ext) + (comm-format (u u s) (sj3-const KOUHO) len yomi-ext) (comm-unpack (u) result) (if (/= result 0) (- result) ; failure (while (< i n) (comm-unpack (u) cylen) (setq stdy (sj3rpc-get-stdy proc)) - (comm-unpack (E) converted) - (setq rest (decode-coding-string - (substring yomi-ext cylen) 'euc-japan)) + (setq converted (sj3rpc-unpack-mb-string codesys)) + (setq rest (decode-coding-string (substring yomi-ext cylen) + codesys)) (setq bunsetsu (sj3-make-bunsetsu env yomi converted rest stdy)) (if bl (setq bl (setcdr bl (cons bunsetsu nil))) @@ -242,10 +240,10 @@ bunsetsu-list)))) (defun sj3rpc-get-bunsetsu-candidates (env yomi) - (let* ((yomi-ext (encode-coding-string yomi 'euc-japan)) + (let* ((yomi-ext (encode-coding-string yomi (sj3rpc-server-coding-system))) (len (length yomi-ext))) (sj3rpc-call-with-environment env (result) - (comm-format (u u s) (sj3-const KOUHOSU_EUC) len yomi-ext) + (comm-format (u u s) (sj3-const KOUHOSU) len yomi-ext) (comm-unpack (u) result) (if (/= result 0) (- result) ; failure @@ -256,18 +254,18 @@ yomi yomi-ext len result)))))) (defun sj3rpc-tanbunsetsu-conversion (env yomi) - (let* ((yomi-ext (encode-coding-string yomi 'euc-japan)) + (let* ((codesys (sj3rpc-server-coding-system)) + (yomi-ext (encode-coding-string yomi codesys)) (len (length yomi-ext)) cylen stdy converted rest) (sj3rpc-call-with-environment env (result) - (comm-format (u u s) (sj3-const TANCONV_EUC) len yomi-ext) + (comm-format (u u s) (sj3-const TANCONV) len yomi-ext) (comm-unpack (u) result) (if (/= result 0) (- result) (comm-unpack (u) cylen) (setq stdy (sj3rpc-get-stdy proc)) - (comm-unpack (E) converted) - (setq rest (decode-coding-string - (substring yomi-ext cylen) 'euc-japan)) + (setq converted (sj3rpc-unpack-mb-string codesys)) + (setq rest (decode-coding-string (substring yomi-ext cylen) codesys)) (setq bunsetsu (sj3-make-bunsetsu env yomi converted rest stdy)))))) (defun sj3rpc-bunsetsu-stdy (env stdy) @@ -279,10 +277,11 @@ 0))) (defun sj3rpc-kugiri-stdy (env yomi1 yomi2 stdy) - (let* ((yomi1-ext (encode-coding-string yomi1 'euc-japan)) - (yomi2-ext (encode-coding-string yomi2 'euc-japan))) + (let* ((codesys (sj3rpc-server-coding-system)) + (yomi1-ext (encode-coding-string yomi1 codesys)) + (yomi2-ext (encode-coding-string yomi2 codesys))) (sj3rpc-call-with-environment env (result) - (comm-format (u s s v) (sj3-const CLSTDY_EUC) + (comm-format (u s s v) (sj3-const CLSTDY) yomi1-ext yomi2-ext stdy (length stdy)) (comm-unpack (u) result) (if (/= result 0) diff --git a/its.el b/its.el index cdfae6e..648b6ec 100644 --- a/its.el +++ b/its.el @@ -1,4 +1,4 @@ -;;; its.el --- Input Translation Systam AKA "ITS(uDekirunDa!)" +;;; its.el --- Input Translation System AKA "ITS(uDekirunDa!)" ;; Copyright (C) 1999,2000 PFU LIMITED @@ -47,7 +47,7 @@ :group 'its :type 'boolean) (defcustom its-delete-by-keystroke nil - "*Delete characters as if cancele input keystroke, if nin-NIL." + "*Delete characters as if cancel input keystroke, if nin-NIL." :group 'its :type 'boolean) (defcustom its-fence-invisible nil @@ -272,10 +272,10 @@ ;; (define-key map "\M-p" 'its-previous-map) (define-key map "\M-n" 'its-next-map) - (define-key map "\M-h" 'its-hiragana) ; hiragana-region for input-buffer - (define-key map "\M-k" 'its-katakana) - (define-key map "\M-<" 'its-hankaku) - (define-key map "\M->" 'its-zenkaku) + ;;;(define-key map "\M-h" 'its-hiragana) ; hiragana-region for input-buffer + ;;;(define-key map "\M-k" 'its-katakana) + ;;;(define-key map "\M-<" 'its-hankaku) + ;;;(define-key map "\M->" 'its-zenkaku) map) "Keymap for ITS mode.") @@ -1308,37 +1308,9 @@ Return last state." (setq its-stroke-input-alist (append alist its-stroke-input-alist)))) -(defun its-hiragana () - ;; hiragana-region for input-buffer - (interactive) - (let* ((inhibit-read-only t) - (start (if (get-text-property (1- (point)) 'its-start) - (point) - (previous-single-property-change (point) 'its-start))) - (end (if (get-text-property (point) 'its-end) - (point) - (next-single-property-change (point) 'its-end))) - (old-str (buffer-substring-no-properties start (1- end))) - (new-str (japanese-hiragana old-str))) - (delete-region start end) - (insert new-str) - (its-put-cursor t))) +;;; its-hiragana : hiragana-region for input-buffer -(defun its-katakana () - ;; katakana-region for input-buffer - (interactive) - (let* ((inhibit-read-only t) - (start (if (get-text-property (1- (point)) 'its-start) - (point) - (previous-single-property-change (point) 'its-start))) - (end (if (get-text-property (point) 'its-end) - (point) - (next-single-property-change (point) 'its-end))) - (old-str (buffer-substring-no-properties start (1- end))) - (new-str (japanese-katakana old-str))) - (delete-region start end) - (insert new-str) - (its-put-cursor t))) +;;; its-katakana : katanaka-region for input-buffer (defun its-mode () "\\{its-mode-map}" -- 1.7.10.4