X-Git-Url: http://git.chise.org/gitweb/?p=elisp%2Fegg.git;a=blobdiff_plain;f=egg%2Fsj3rpc.el;h=9520e53b344ab1000ce7e5fed248f9f9745cf430;hp=6ae09aaafd316c33f16c5e2840db699ec9a2ce65;hb=d0114d80c7a6a1a573bb3adc0fd4a3b25fa1e27e;hpb=9ef0e51f3297eec9a1fe63c655c0aebb3c4327b4 diff --git a/egg/sj3rpc.el b/egg/sj3rpc.el index 6ae09aa..9520e53 100644 --- a/egg/sj3rpc.el +++ b/egg/sj3rpc.el @@ -1,21 +1,21 @@ -;;; egg/sj3.el --- SJ3 Support (low level interface) in Egg -;;; Input Method Architecture +;;; egg/sj3rpc.el --- SJ3 Support (low level interface) in Egg +;;; Input Method Architecture -;; Copyright (C) 1997 Mule Project, Powered by Electrotechnical -;; Laboratory, JAPAN. +;; Copyright (C) 1997, 1998 Mule Project, +;; Powered by Electrotechnical Laboratory, JAPAN. ;; Project Leader: Satoru Tomura ;; Author: NIIBE Yutaka ;; Maintainer: NIIBE Yutaka -;; This file will be part of GNU Emacs (in future). +;; This file will be part of EGG. -;; GNU Emacs is free software; you can redistribute it and/or modify +;; EGG is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. -;; GNU Emacs is distributed in the hope that it will be useful, +;; EGG is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. @@ -33,7 +33,7 @@ (eval-when-compile (require 'egg-com) - (load-library "egg/sj3") +;; (load-library "egg/sj3") (defmacro sj3-const (c) (cond ((eq c 'OPEN) 1) ((eq c 'CLOSE) 2) @@ -53,8 +53,8 @@ ((eq c 'KOUHOSU) 55) ((eq c 'KOUHOSU_EUC) 116) ((eq c 'STDY) 61) - ((eq c 'END) 62) - ((eq c 'END_EUC) 117) + ((eq c 'CLSTDY) 62) + ((eq c 'CLSTDY_EUC) 117) ((eq c 'WREG) 71) ((eq c 'WREG_EUC) 118) ((eq c 'WDEL) 72) @@ -70,8 +70,14 @@ ((eq c 'VERSION) 103) (t (error "No such constant"))))) +;; XXX +(defconst sj3rpc-error-message (vector )) + (defun sj3rpc-get-error-message (errno) - (or (aref sj3rpc-error-message errno) (format "#%d" errno))) + (or (and (>= errno 0) + (< errno (length sj3rpc-error-message)) + (aref sj3rpc-error-message errno)) + (format "#%d" errno))) (defmacro sj3rpc-call-with-environment (e vlist send-expr &rest receive-exprs) (let ((v (append @@ -100,6 +106,12 @@ 0 result))) +(defun sj3rpc-close (proc) + (comm-call-with-proc proc (result) + (comm-format (u) (sj3-const CLOSE)) + (comm-unpack (u) result) + result)) + (defun sj3rpc-get-stdy-size (proc) "Return STDYSIZE of SJ3 server. On failure, return error code." (comm-call-with-proc proc (result) @@ -167,8 +179,9 @@ 2048 ; Index length 2048 ; Length 256 ; Number + ) (comm-unpack (u) result) - result))) + result)) (defun sj3rpc-open-stdy (proc stdy-name) (comm-call-with-proc proc (result) @@ -184,10 +197,17 @@ (defun sj3rpc-make-stdy (proc stdy-name) (comm-call-with-proc proc (result) - (comm-format (u) (sj3-const MKSTDY) stdy-name "") + (comm-format (u s u u u) (sj3-const MKSTDY) stdy-name 2048 ; Number 1 ; Step 2048 ; Length + ) + (comm-unpack (u) result) + result)) + +(defun sj3rpc-make-directory (proc name) + (comm-call-with-proc proc (result) + (comm-format (u s) (sj3-const MKDIR) name) (comm-unpack (u) result) result)) @@ -210,6 +230,11 @@ (setq bl (setcdr bl (cons bunsetsu nil))) (setq bunsetsu-list (setq bl (cons bunsetsu nil)))) (setq i (1+ i))) + (setq bunsetsu (sj3-make-bunsetsu env yomi yomi nil nil)) + (setq bl (setcdr bl (cons bunsetsu nil))) + (setq bunsetsu + (sj3-make-bunsetsu env yomi (japanese-katakana yomi) nil nil)) + (setq bl (setcdr bl (cons bunsetsu nil))) bunsetsu-list)))) (defun sj3rpc-get-bunsetsu-candidates (env yomi) @@ -241,4 +266,22 @@ (substring yomi-ext cylen) 'euc-japan)) (setq bunsetsu (sj3-make-bunsetsu env yomi converted rest stdy)))))) +(defun sj3rpc-bunsetsu-stdy (env stdy) + (sj3rpc-call-with-environment env (result) + (comm-format (u v) (sj3-const STDY) stdy) + (comm-unpack (u) result) + (if (/= result 0) + (- result) + 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))) + (sj3rpc-call-with-environment env (result) + (comm-format (u s s v) (sj3-const CLSTDY_EUC) yomi1-ext yomi2-ext stdy) + (comm-unpack (u) result) + (if (/= result 0) + (- result) + 0)))) + ;;; egg/sj3rpc.el ends here.