From: kate Date: Tue, 23 Jun 1998 04:57:20 +0000 (+0000) Subject: Modified Files: X-Git-Tag: egg-980304~2^2 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f7ad70da32a806a4e0e3f8e59ce96325653bf9b;p=elisp%2Fegg.git Modified Files: docomp.el egg-cnv.el egg-com.el egg-mlh.el egg.el its-keydef.el its.el leim-list-egg.el menudiag.el egg/sj3.el egg/sj3rpc.el egg/wnn.el egg/wnnrpc.el its/ascii.el its/erpin.el its/hangul.el its/hankata.el its/hira.el its/jeonkak.el its/kata.el its/pinyin.el its/quanjiao.el its/zenkaku.el its/zhuyin.el Added Files: egg-edep.el egg-face.el egg/canna.el egg/cannarpc.el Removed Files: egg-hilit.el --- diff --git a/egg-hilit.el b/egg-hilit.el deleted file mode 100644 index b5568a5..0000000 --- a/egg-hilit.el +++ /dev/null @@ -1,33 +0,0 @@ -(defvar egg-face-color-japanese "Cyan") -(defvar egg-face-color-chinese "Pink") -(defvar egg-face-color-taiwanise "Salmon") -(defvar egg-face-color-korean "Yellow") - -(defun egg-set-fg-color (color) - (let ((face (make-face (intern (concat "fg:" color))))) - (set-face-foreground face color) - face)) - -(defun egg-set-bg-color (color) - (let ((face (make-face (intern (concat "bg:" color))))) - (set-face-background face color) - face)) - -(defun egg-make-face (color) - (list 'underline (egg-set-bg-color color))) - -(defconst its-fence-face - (and window-system - (list (cons "Japanese" (egg-make-face egg-face-color-japanese)) - (cons "Chinese-GB" (egg-make-face egg-face-color-chinese)) - (cons "Chinese-CNS" (egg-make-face egg-face-color-taiwanise)) - (cons "Korean" (egg-make-face egg-face-color-korean)) - (cons t 'underline)))) - -(defconst egg-conversion-face - (and window-system - (list (cons "Japanese" (egg-make-face egg-face-color-japanese)) - (cons "Chinese-GB" (egg-make-face egg-face-color-chinese)) - (cons "Chinese-CNS" (egg-make-face egg-face-color-taiwanise)) - (cons "Korean" (egg-make-face egg-face-color-korean)) - (cons t 'underline)))) diff --git a/egg/cannarpc.el b/egg/cannarpc.el new file mode 100644 index 0000000..fadaf05 --- /dev/null +++ b/egg/cannarpc.el @@ -0,0 +1,201 @@ +;;; egg/cannarpc.el --- Canna Support (low level interface) in +;;; Egg Input Method Architecture + +;; Copyright (C) 1997, 1998 Mule Project, +;; Powered by Electrotechnical Laboratory, JAPAN. +;; Project Leader: Satoru Tomura + +;; Author: NIIBE Yutaka +;; Maintainer: NIIBE Yutaka + +;; This file is part of EGG. + +;; EGG is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; EGG is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;;; Code: + +(eval-when-compile + (require 'egg-com) +;; (load-library "egg/canna") + (defmacro canna-const (c) + (cond ((eq c 'Initialize) 1) + ((eq c 'Finalize) 2) + ((eq c 'CreateContext) 3) + ((eq c 'CloseContext) 5) + ((eq c 'GetDictionaryList) 6) + ((eq c 'GetDirectoryList) 7) + ((eq c 'MountDictionary) 8) + ((eq c 'UnmountDictionary) 9) + ((eq c 'BeginConvert) 15) + ((eq c 'EndConvert) 16) + ((eq c 'GetCandidacyList) 17) + ((eq c 'GetYomi) 18) + ((eq c 'ResizePause) 26) + + ((eq c 'CreateDictionary) 3) + (t (error "No such constant"))))) + +(defun cannarpc-get-error-message (errno) + (or (aref cannarpc-error-message errno) (format "#%d" errno))) + +(defmacro cannarpc-call-with-environment (e vlist send-expr &rest receive-exprs) + (let ((v (append + `((proc (cannaenv-get-proc ,e)) + (context (cannaenv-get-context ,e))) + vlist))) + (list + 'let v + (append + `(save-excursion + (set-buffer (process-buffer proc)) + (erase-buffer) + ,send-expr + (process-send-region proc (point-min) (point-max)) + (goto-char (prog1 (point) (accept-process-output proc)))) + receive-exprs)))) + +(defconst canna-version-fmt "2.0:%s") + +(defun cannarpc-open (proc username) + "Open the session. Return 0 on success, error code on failure." + (let ((verusr (format canna-version-fmt username))) + (comm-call-with-proc proc (result) + (comm-format (u u v) (canna-const Initialize) (length verusr) verusr) + (comm-unpack (u) result) + result))) + +(defun cannarpc-close (proc) + (comm-call-with-proc proc (dummy result) + (comm-format (b b w) (canna-const Finalize) 0 0) + (comm-unpack (b b w b) dummy dummy dummy result) + result)) + +(defun cannarpc-create-context (proc) + (comm-call-with-proc proc (dummy result) + (comm-format (b b w) (canna-const CreateContext) 0 0) + (comm-unpack (b b w w) dummy dummy dummy result) + result)) + +(defun cannarpc-close-context (proc context) + (comm-call-with-proc proc (dummy result) + (comm-format (b b w w) (canna-const CloseContext) 0 2 context) + (comm-unpack (b b w b) dummy dummy dummy result) + result)) + +;; XXX: Not implemented fully +(defun cannarpc-get-dictionary-list (env) + (cannarpc-call-with-environment env (dymmy result) + (comm-format (b b w w w) (canna-const GetDictionaryList) 0 4 + context 1024) + (comm-unpack (u w) dummy result) + ;; follow list of dictionaries + result)) + +;; XXX: Not implemented fully +(defun cannarpc-get-directory-list (env) + (cannarpc-call-with-environment env (dymmy result) + (comm-format (b b w w w) (canna-const GetDirectoryList) 0 4 + context 1024) + (comm-unpack (u w) dummy result) + ;; follow list of directories + result)) + +(defun cannarpc-open-dictionary (env dict-file-name mode) + (cannarpc-call-with-environment env (dymmy result) + (comm-format (b b w u w s) (canna-const MountDictionary) 0 + (+ (length dict-file-name) 7) + mode context dict-file-name) + (comm-unpack (u b) dummy result) + result)) + +(defun cannarpc-close-dictionary (env dict-file-name mode) + (cannarpc-call-with-environment env (dymmy result) + (comm-format (b b w u w s) (canna-const UnmountDictionary) 0 + (+ (length dict-file-name) 6) + mode context dict-file-name) + (comm-unpack (u b) dummy result) + result)) + +(defun cannarpc-begin-conversion (env yomi) + "Begin conversion." + (let ((yomi-ext (encode-coding-string yomi 'euc-japan)) + (i 0) + converted bunsetsu-list bl) + (cannarpc-call-with-environment env (dummy result) + (comm-format (b b w u w S) (canna-const BeginConvert) 0 + (+ (length yomi-ext) 8) 0 context yomi) + (comm-unpack (u w) dummy result) + (if (= result 65535) + -1 ; failure + (while (< i result) + (comm-unpack (S) converted) + (let ((bl1 (cons (canna-make-bunsetsu env converted i) + nil))) + (if bl + (setq bl (setcdr bl bl1)) + (setq bunsetsu-list (setq bl bl1)))) + (setq i (1+ i))) + bunsetsu-list)))) + +(defun cannarpc-end-conversion (env len zenkouho-pos-vector mode) + "End conversion." + (cannarpc-call-with-environment env (dummy result) + (comm-format (b b w w w u v) (canna-const EndConvert) 0 + (+ (* len 2) 8) context len mode zenkouho-pos-vector) + (comm-unpack (u b) dummy result) + (if (= result 255) + -1 ; failure + result))) + +(defun cannarpc-make-dictionary (env dict-name) + (cannarpc-call-with-environment env (dummy result) + (comm-format (b b w u w s) (canna-const CreateDictionary) 1 + (+ (length dict-name) 7) 0 context dict-name) + (comm-unpack (u b) dummy result) + result)) + +(defun cannarpc-get-bunsetsu-source (env bunsetsu-pos) + (cannarpc-call-with-environment env (dummy result) + (comm-format (b b w w w w) (canna-const GetYomi) 0 6 context + bunsetsu-pos 1024) + (comm-unpack (u w) dummy result) + (if (= result 65535) + -1 + (comm-unpack (S) result) + result))) + +(defun cannarpc-get-bunsetsu-candidates (env bunsetsu-pos) + (let ((i 0) + converted bunsetsu-list bl) + (cannarpc-call-with-environment env (dummy result) + (comm-format (b b w w w w) (canna-const GetCandidacyList) 0 6 context + bunsetsu-pos 1024) + (comm-unpack (u w) dymmy result) + (if (= result 65535) + -1 ; failure + (while (< i result) + (comm-unpack (S) converted) + (let ((bl1 (cons (canna-make-bunsetsu env converted bunsetsu-pos) + nil))) + (if bl + (setq bl (setcdr bl bl1)) + (setq bunsetsu-list (setq bl bl1)))) + (setq i (1+ i))) + bunsetsu-list)))) + +;;; egg/cannarpc.el ends here.