-;;; 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 <tomura@etl.go.jp>
;; Author: NIIBE Yutaka <gniibe@mri.co.jp>
;; Maintainer: NIIBE Yutaka <gniibe@mri.co.jp>
-;; This file will be part of GNU Emacs (in future).
+;; This file will be 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
((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)
((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
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)
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)
(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))
(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)
(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.