1 ;;; egg/wnnrpc.el --- WNN Support (low level interface) in Egg
2 ;;; Input Method Architecture
4 ;; Copyright (C) 1999, 2000 Free Software Foundation, Inc
6 ;; Author: NIIBE Yutaka <gniibe@chroot.org>
7 ;; KATAYAMA Yoshio <kate@pfu.co.jp> ; Korean, Chinese support.
9 ;; Keywords: mule, multilingual, input method
11 ;; This file is part of EGG.
13 ;; EGG is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation; either version 2, or (at your option)
18 ;; EGG is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;; GNU General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
25 ;; Free Software Foundation, Inc.,
26 ;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
36 (defmacro wnn-file-string ()
37 (string-as-unibyte (decode-coding-string "
\e$B#W#n#n$N%U%!%$%k
\e(B" 'euc-jp)))
38 (defmacro wnn-const (c)
39 "Macro for WNN constants."
40 (cond ((eq c 'JS_VERSION) 0)
43 ((eq c 'JS_CONNECT) 5)
44 ((eq c 'JS_DISCONNECT) 6)
45 ((eq c 'JS_ENV_EXIST) 7)
46 ((eq c 'JS_ENV_STICKY) 8)
47 ((eq c 'JS_ENV_UNSTICKY) 9)
48 ((eq c 'JS_KANREN) 17)
49 ((eq c 'JS_KANTAN_SHO) 18)
50 ((eq c 'JS_KANZEN_SHO) 19)
51 ((eq c 'JS_KANTAN_DAI) 20)
52 ((eq c 'JS_KANZEN_DAI) 21)
53 ((eq c 'JS_HINDO_SET) 24)
54 ((eq c 'JS_DIC_ADD) 33)
55 ((eq c 'JS_DIC_DELETE) 34)
56 ((eq c 'JS_DIC_USE) 35)
57 ((eq c 'JS_DIC_LIST) 36)
58 ((eq c 'JS_DIC_INFO) 37)
59 ((eq c 'JS_FUZOKUGO_SET) 41)
60 ((eq c 'JS_FUZOKUGO_GET) 48)
61 ((eq c 'JS_WORD_ADD) 49)
62 ((eq c 'JS_WORD_DELETE) 50)
63 ((eq c 'JS_WORD_SEARCH) 51)
64 ((eq c 'JS_WORD_SEARCH_BY_ENV) 52)
65 ((eq c 'JS_WORD_INFO) 53)
66 ((eq c 'JS_WORD_COMMENT_SET) 54)
67 ((eq c 'JS_PARAM_SET) 65)
68 ((eq c 'JS_PARAM_GET) 66)
70 ((eq c 'JS_ACCESS) 82)
72 ((eq c 'JS_ENV_LIST) 85)
73 ((eq c 'JS_FILE_LIST_ALL) 86)
74 ((eq c 'JS_DIC_LIST_ALL) 87)
75 ((eq c 'JS_FILE_READ) 97)
76 ((eq c 'JS_FILE_WRITE) 98)
77 ((eq c 'JS_FILE_SEND) 99)
78 ((eq c 'JS_FILE_RECEIVE) 100)
79 ((eq c 'JS_HINDO_FILE_CREATE) 101)
80 ((eq c 'JS_DIC_FILE_CREATE) 102)
81 ((eq c 'JS_FILE_REMOVE) 103)
82 ((eq c 'JS_FILE_LIST) 104)
83 ((eq c 'JS_FILE_INFO) 105)
84 ((eq c 'JS_FILE_LOADED) 106)
85 ((eq c 'JS_FILE_LOADED_LOCAL) 107)
86 ((eq c 'JS_FILE_DISCARD) 108)
87 ((eq c 'JS_FILE_COMMENT_SET) 109)
88 ((eq c 'JS_FILE_PASSWORD_SET) 110)
89 ((eq c 'JS_FILE_STAT) 111)
91 ((eq c 'JS_HINSI_LIST) 114)
92 ((eq c 'JS_HINSI_NAME) 115)
93 ((eq c 'JS_HINSI_NUMBER) 116)
94 ((eq c 'JS_HINSI_DICTS) 117)
95 ((eq c 'JS_HINSI_TABLE_SET) 118)
96 ((eq c 'JS_ACCESS_ADD_HOST) ?\xf00011)
97 ((eq c 'JS_ACCESS_ADD_USER) ?\xf00012)
98 ((eq c 'JS_ACCESS_REMOVE_HOST) ?\xf00013)
99 ((eq c 'JS_ACCESS_REMOVE_USER) ?\xf00014)
100 ((eq c 'JS_ACCESS_ENABLE) ?\xf00015)
101 ((eq c 'JS_ACCESS_DISABLE) ?\xf00016)
102 ((eq c 'JS_ACCESS_GET_INFO) ?\xf00017)
103 ((eq c 'JS_TEMPORARY_DIC_ADD) ?\xf00021)
104 ((eq c 'JS_TEMPORARY_DIC_DELETE) ?\xf00022)
105 ((eq c 'JS_AUTOLEARNING_WORD_ADD) ?\xf00023)
106 ((eq c 'JS_SET_AUTOLEARNING_DIC) ?\xf00024)
107 ((eq c 'JS_GET_AUTOLEARNING_DIC) ?\xf00025)
108 ((eq c 'JS_IS_LOADED_TEMPORARY_DIC) ?\xf00026)
109 ((eq c 'JS_TEMPORARY_WORD_ADD) ?\xf00027)
110 ((eq c 'JS_SET_HENKAN_ENV) ?\xf00031)
111 ((eq c 'JS_GET_HENKAN_ENV) ?\xf00032)
112 ((eq c 'JS_SET_HENKAN_HINSI) ?\xf00033)
113 ((eq c 'JS_GET_HENKAN_HINSI) ?\xf00034)
114 ((eq c 'JS_HENKAN_WITH_DATA) ?\xf00035)
115 ((eq c 'JS_FI_DIC_ADD) ?\xf00061)
116 ((eq c 'JS_FI_HINDO_FILE_CREATE) ?\xf00062)
117 ((eq c 'JS_FI_KANREN) ?\xf00065)
118 ((eq c 'JS_SET_FI_PRIORITY) ?\xf00066)
119 ((eq c 'JS_OPTIMIZE_FI) ?\xf00067)
120 ((eq c 'JS_HENKAN_IKEIJI) ?\xf0006f)
121 ((eq c 'JS_LOCK) ?\xf00071)
122 ((eq c 'JS_UNLOCK) ?\xf00072)
123 ((eq c 'JS_FI_DIC_LIST) ?\xf00081)
124 ((eq c 'JS_FI_DIC_LIST_ALL) ?\xf00082)
125 ((eq c 'JS_FUZOKUGO_LIST) ?\xf00083)
127 ((eq c 'JS_YOSOKU_INIT) ?\xf01001)
128 ((eq c 'JS_YOSOKU_FREE) ?\xf01002)
129 ((eq c 'JS_YOSOKU_YOSOKU) ?\xf01003)
130 ((eq c 'JS_YOSOKU_TOROKU) ?\xf01004)
131 ((eq c 'JS_YOSOKU_SELECTED_CAND) ?\xf01005)
132 ((eq c 'JS_YOSOKU_DELETE_CAND) ?\xf01006)
133 ((eq c 'JS_YOSOKU_CANCEL_LATEST_TOROKU) ?\xf01007)
134 ((eq c 'JS_YOSOKU_RESET_PRE_YOSOKU) ?\xf01008)
135 ((eq c 'JS_YOSOKU_IKKATSU_TOROKU) ?\xf01009)
136 ((eq c 'JS_YOSOKU_SAVE_DATALIST) ?\xf0100a)
137 ((eq c 'JS_YOSOKU_INIT_TIME_KEYDATA) ?\xf0100b)
138 ((eq c 'JS_YOSOKU_INIT_INPUTINFO) ?\xf0100c)
139 ((eq c 'JS_YOSOKU_SET_USER_INPUTINFO) ?\xf0100d)
140 ((eq c 'JS_YOSOKU_SET_TIMEINFO) ?\xf0100e)
141 ((eq c 'JS_YOSOKU_STATUS) ?\xf0100f)
142 ((eq c 'JS_YOSOKU_SET_PARAM) ?\xf01010)
143 ((eq c 'JS_YOSOKU_IKKATSU_TOROKU_INIT) ?\xf01011)
144 ((eq c 'JS_YOSOKU_IKKATSU_TOROKU_END) ?\xf01012)
145 ((eq c 'JS_HENKAN_ASSOC) ?\xf01013)
147 ((eq c 'JLIB_VERSION) ?\x4003)
148 ((eq c 'JLIB_VERSION_WNN6) ?\x4f00)
149 ((eq c 'JLIB_VERSION_WNN7) ?\x4f01)
150 ((eq c 'JLIB_VERSION_WNN8) ?\x4f02)
152 ((eq c 'WNN_C_LOCAL) "!")
153 ((eq c 'WNN_FT_DICT_FILE) 1)
154 ((eq c 'WNN_FT_HINDO_FILE) 2)
155 ((eq c 'WNN_FILE_STRING) (encode-coding-string
156 "
\e$B#W#n#n$N%U%!%$%k
\e(B" 'euc-jp))
157 ((eq c 'WNN_FILE_STRING_LEN) 16)
158 ((eq c 'WNN_PASSWD_LEN) 16)
159 ((eq c 'WNN_HOST_LEN) 16)
160 ((eq c 'WNN_UNIQ_LEN) 28)
161 ((eq c 'WNN_FILE_HEADER_LEN) 128)
162 ((eq c 'WNN_FILE_HEADER_PAD) 36)
163 ((eq c 'WNN_FILE_BODY_PAD) 116)
164 ((eq c 'WNN_ENVNAME_LEN) 32)
165 ((eq c 'WNN_MAX_ENV_OF_A_CLIENT) 32)
166 ((eq c 'WNN_MAX_DIC_OF_AN_ENV) 30)
167 ((eq c 'WNN_MAX_FILE_OF_AN_ENV) 60)
172 ((eq c 'WNN_NO_EXIST) 1)
173 ((eq c 'WNN_OPENF_ERR) 16)
174 ((eq c 'WNN_JSERVER_DEAD) 70)
175 ((eq c 'WNN_BAD_VERSION) 73)
176 ((eq c 'WNN_FILE_READ_ERROR) 90)
177 ((eq c 'WNN_FILE_WRITE_ERROR) 91)
178 ((eq c 'WNN_INCORRECT_PASSWD) 94)
179 ((eq c 'WNN_FILE_IN_USE) 95)
180 ((eq c 'WNN_UNLINK) 96)
181 ((eq c 'WNN_FILE_CREATE_ERROR) 97)
182 ((eq c 'WNN_NOT_A_FILE) 98)
183 ((eq c 'WNN_INODE_CHECK_ERROR) 99)
185 ((eq c 'WNN_UD_DICT) 2)
186 ((eq c 'WNN_REV_DICT) 3)
187 ((eq c 'CWNN_REV_DICT) ?\x103)
188 ((eq c 'BWNN_REV_DICT) ?\x203)
189 ((eq c 'WNN_COMPACT_DICT) 5)
190 ((eq c 'WNN_FI_SYSTEM_DICT) 6)
191 ((eq c 'WNN_FI_USER_DICT) 7)
192 ((eq c 'WNN_FI_HINDO_FILE) 8)
193 ((eq c 'WNN_GROUP_DICT) 9)
194 ((eq c 'WNN_MERGE_DICT) 10)
195 ((eq c 'WNN_VECT_NO) -1)
196 ((eq c 'WNN_VECT_BUNSETSU) 2)
197 ((eq c 'WNN_VECT_KANREN) 0)
198 ((eq c 'WNN_VECT_KANZEN) 1)
199 ((eq c 'WNN_VECT_KANTAN) 1))))
201 (defconst wnnrpc-error-message
205 "
\e$B%U%!%$%k$,B8:_$7$^$;$s
\e(B"
207 "
\e$B%a%b%j
\e(B allocation
\e$B$G<:G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D0f1>2;7{
\e(B"
398 "
\e$A2;JG#c#W#n#nSC;'Iz3I5D;7>3
\e(B"
404 "
\e$AWSD?B<2;D\44=(
\e(B"
414 "
\e$AND<~2;D\6AH!
\e(B"
415 "
\e$AND<~2;D\P43v
\e(B"
416 "
\e$A2;JG#c#W#n#nSC;'?I6AH!5DND<~
\e(B"
417 "
\e$ARTIO5DND<~2;D\6AH!
\e(B"
418 "password
\e$A2;6T
\e(B"
419 "
\e$AND<~U}TZ6AH!
\e(B"
420 "
\e$AND<~2;D\O{3}
\e(B"
421 "
\e$AND<~C;SP44=(3v@4
\e(B"
422 "
\e$A2;JG#c#W#n#n5DND<~
\e(B"
423 "
\e$AND<~5D
\e(BI-node
\e$A:M
\e(BFILE_UNIQ
\e$A2;D\R;VB
\e(B"
424 "
\e$A4JPTND<~L+4s
\e(B"
425 "
\e$A4JPTND<~L+4s
\e(B"
426 "
\e$A4JPTND<~2;4fTZ
\e(B"
427 "
\e$A4JPTND<~5DDZH]2;6T
\e(B"
429 "
\e$A4JPTND<~2;D\6AH!
\e(B"
431 "
\e$A4JPT:EBk2;6T
\e(B"
433 "
\e$AUb8v2YWw2;V'3V
\e(B"
434 "password
\e$A5DJdHkND<~2;D\4r?*
\e(B"
435 "uumrc
\e$AND<~2;4fTZ
\e(B"
436 "uumrc
\e$AND<~5DPNJ=4mNs
\e(B"
437 "
\e$ARTIO;7>32;D\44=(
\e(B"
438 "
\e$AUb8v#c#W#n#nSC;'!"6AH!5DND<~C;SP
\e(B"
439 "
\e$AWV5d5DF56HND<~C;SP
\e(B"
440 "password
\e$A5DND<~C;SP44=(3v@4
\e(B"
445 "
\e$(GEFG5DbGtGc
\e(B"
447 "
\e$(GDyGt
\e(Balloc
\e$(GFBZu
\e(B"
450 "
\e$(GDbQRs"PyEFG5
\e(B"
451 "
\e$(GDbQREFNNEFG5
\e(B"
453 "
\e$(GGsL(OPV*iH
\e(B"
454 "
\e$(Gs"PyEFG5!3DbQRQ@LyN{GsL(N{s"P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(CG0;g
\e(B
\e$(C@L8'@L
\e(B
\e$(CF2834O4Y
\e(B"
671 "
\e$(CG0;g
\e(B
\e$(C9xH#0!
\e(B
\e$(CF2834O4Y
\e(B"
673 "
\e$(C1W
\e(B
\e$(CA6@[@:
\e(B
\e$(CAv?x5GAv
\e(B
\e$(C>J=@4O4Y
\e(B"
674 "
\e$(CFP=:?v5e0!
\e(B
\e$(C5i>n@V4B
\e(B
\e$(CH-@O@;
\e(B
\e$(C?-
\e(B
\e$(C<v
\e(B
\e$(C>x@>4O4Y
\e(B"
675 "uumrc
\e$(C@L
\e(B
\e$(CA8@gGOAv
\e(B
\e$(C>J=@4O4Y
\e(B"
676 "uumrc
\e$(C@G
\e(B
\e$(CG|=D@L
\e(B
\e$(CF2834O4Y
\e(B"
677 "
\e$(C@L
\e(B
\e$(C@L;s
\e(B
\e$(CH/0f@;
\e(B
\e$(C@[<:GR
\e(B
\e$(C<v
\e(B
\e$(C>x@>4O4Y
\e(B"
678 "
\e$(CE)6s@L>HF.0!
\e(B
\e$(C@P>n
\e(B
\e$(C5e80
\e(B
\e$(CH-@O@L
\e(B
\e$(C>F4U4O4Y
\e(B"
679 "
\e$(C;g@|?!
\e(B
\e$(C:s55
\e(B
\e$(CH-@O@L
\e(B
\e$(CA8@gGOAv
\e(B
\e$(C>J=@4O4Y
\e(B"
680 "
\e$(CFP=:?v5e
\e(B
\e$(CH-@O@;
\e(B
\e$(C@[<:GR
\e(B
\e$(C<v
\e(B
\e$(C>x@>4O4Y
\e(B"
682 "Array of WNN error messages. Indexed by error code.")
684 (defvar wnnrpc-timeout 10)
686 (defun wnnrpc-message-language (lang)
687 (or (cdr (assq lang egg-message-language-alist)) lang))
689 (defun wnnrpc-get-error-message (errno)
690 "Return error message string specified by ERRNO."
691 (let ((msg (cdr (or (assq (wnnrpc-message-language egg-default-language)
692 wnnrpc-error-message)
693 (assq (wnnrpc-message-language its-current-language)
694 wnnrpc-error-message)
695 (assq 'Japanese wnnrpc-error-message)))))
696 (or (and (< errno (length msg)) (aref msg errno))
697 (format "#%d" errno))))
699 (defmacro wnnrpc-call-with-proc (proc vlist send-expr &rest receive-exprs)
700 `(comm-call-with-proc ,proc
702 (comm-accept-timeout wnnrpc-timeout)
704 ,send-expr ,@receive-exprs))
706 (defmacro wnnrpc-call-with-environment (env vlist send-expr &rest rcv-exprs)
707 `(comm-call-with-proc (wnnenv-get-proc ,env)
709 (comm-accept-timeout wnnrpc-timeout)
710 (env-id (wnnenv-get-env-id ,env))
712 ,send-expr ,@rcv-exprs))
714 (defmacro wnnrpc-get-result (&rest body)
715 `(let (result resulth)
716 (comm-unpack (w w) resulth result)
717 (cond ((and (= result 65535) (= resulth 65535))
719 ((= resulth (lsh (lsh resulth 16) -16))
720 (setq result (+ (lsh resulth 16) result)))
725 (comm-unpack (i) result)
727 ,@(or body '(result)))))
729 (defun wnnrpc-open-internal (proc version myhostname username)
730 "Open the session. Return 0 on success, error code on failure."
731 (comm-call-with-proc proc ()
732 (comm-format (u u s s)
734 version myhostname username)
735 (wnnrpc-get-result)))
737 (defun wnnrpc-open (proc myhostname username)
738 "Open the session. Return wnn4/wnn6/wnn7 or wnn8 on success, NIL on failure."
739 (let ((type-list `((wnn8 . ,(wnn-const JLIB_VERSION_WNN8))
740 (wnn7 . ,(wnn-const JLIB_VERSION_WNN7))
741 (wnn6 . ,(wnn-const JLIB_VERSION_WNN6))
742 (wnn4 . ,(wnn-const JLIB_VERSION))))
743 (result (- (wnn-const WNN_BAD_VERSION)))
745 (while (and type-list (= result (- (wnn-const WNN_BAD_VERSION))))
746 (setq type (caar type-list)
747 version (cdar type-list)
748 type-list (cdr type-list)
749 result (wnnrpc-open-internal proc version myhostname username)))
754 (defun wnnrpc-connect (proc envname)
755 "Establish new `connection' and make an environment.
756 Return the identitifation of the environment on success,
757 or negative error code on failure."
758 (comm-call-with-proc proc ()
759 (comm-format (u s) (wnn-const JS_CONNECT) envname)
760 (wnnrpc-get-result)))
762 (defun wnnrpc-file-read (env filename)
763 "Read the file FILENAME on the environment ENV
764 Return non-negative file ID on success, or negative error code on failure."
765 (wnnrpc-call-with-environment env ()
766 (comm-format (u u s) (wnn-const JS_FILE_READ) env-id filename)
767 (wnnrpc-get-result)))
769 (defun wnnrpc-set-fuzokugo-file (env fid)
770 "For PROC, on environment ENV-ID,
771 Set Fuzokugo file specified by FID.
772 Return 0 on success, negate-encoded error code on failure."
773 (wnnrpc-call-with-environment env ()
774 (comm-format (u u i) (wnn-const JS_FUZOKUGO_SET) env-id fid)
775 (wnnrpc-get-result)))
777 (defun wnnrpc-set-dictionary (env dic-id freq-id priority dic-rw freq-rw
778 dic-passwd freq-passwd reverse)
779 "Set dictionary on server.
780 Return dictionary number on success, negate-encoded error code on faiulure."
781 (wnnrpc-call-with-environment env ()
782 (comm-format (u u i i i u u s s u) (wnn-const JS_DIC_ADD)
783 env-id dic-id freq-id
785 (if (numberp dic-rw) dic-rw (if dic-rw 0 1))
786 (if (numberp freq-rw) freq-rw (if freq-rw 0 1))
787 dic-passwd freq-passwd
789 (wnnrpc-get-result)))
791 (defun wnnrpc-set-fi-dictionary (env dic-id freq-id sys dic-rw freq-rw
792 dic-passwd freq-passwd)
793 "Set FI dictionary on the server.
794 Return 0 on success, negate-encoded error code on faiulure."
795 (wnnrpc-call-with-environment env ()
796 (comm-format (u u i i u u u s s) (wnn-const JS_FI_DIC_ADD)
797 env-id dic-id freq-id
799 (wnn-const WNN_FI_SYSTEM_DICT)
800 (wnn-const WNN_FI_USER_DICT))
801 (if (numberp dic-rw) dic-rw (if dic-rw 0 1))
802 (if (numberp freq-rw) freq-rw (if freq-rw 0 1))
803 dic-passwd freq-passwd)
804 (wnnrpc-get-result)))
806 (defun wnnrpc-get-autolearning-dic (env type)
807 "Get id of auto learning dictionary on the server.
808 Return dictionary id + 1 on success, 0 on no dictionary, negate-encoded
809 error code on faiulure."
810 (wnnrpc-call-with-environment env (result)
811 (comm-format (u u u) (wnn-const JS_GET_AUTOLEARNING_DIC)
814 (comm-unpack (i) result)
817 (defun wnnrpc-set-autolearning-dic (env type dic-id)
818 "Set auto learning dictionary on the server.
819 Return 0 on success, negate-encoded error code on faiulure."
820 (wnnrpc-call-with-environment env ()
821 (comm-format (u u u i) (wnn-const JS_SET_AUTOLEARNING_DIC)
823 (wnnrpc-get-result)))
825 (defun wnnrpc-version (proc)
826 "Return the version number of WNN server."
827 (comm-call-with-proc proc (result)
828 (comm-format (u) (wnn-const JS_VERSION))
829 (comm-unpack (i) result)
832 (defun wnnrpc-access (env path mode)
833 "Check the accessibility of file in the environment ENV.
834 Return 0 when the remote file (dictionary/frequency) of PATH on server
835 can be accessed in mode MODE. Return Non-zero otherwise."
836 (wnnrpc-call-with-environment env (result)
837 (comm-format (u u u s) (wnn-const JS_ACCESS) env-id mode path)
838 (comm-unpack (i) result)
841 (defun wnnrpc-mkdir (env path)
842 "Create directory specified by PATH."
843 (wnnrpc-call-with-environment env ()
844 (comm-format (u u s) (wnn-const JS_MKDIR) env-id path)
845 (wnnrpc-get-result)))
847 (defun wnnrpc-writable-dic-type (env fi rw)
848 (let ((server (wnnenv-get-server-type env)))
849 (cond (fi (wnn-const WNN_FI_USER_DICT))
850 ((or (eq server 'cserver)
851 (eq server 'tserver)) (wnn-const CWNN_REV_DICT))
852 ((eq rw 3) (wnn-const WNN_GROUP_DICT))
853 ((eq rw 4) (wnn-const WNN_MERGE_DICT))
854 (t (wnn-const WNN_REV_DICT)))))
856 (defun wnnrpc-dic-file-create (env dicname type comment passwd hpasswd)
857 "Create a dictionary on the server."
858 (wnnrpc-call-with-environment env ()
859 (comm-format (u u s S s s u) (wnn-const JS_DIC_FILE_CREATE)
860 env-id dicname comment
862 (wnnrpc-get-result)))
864 (defun wnnrpc-hindo-file-create (env fi dic-id freqname comment passwd)
865 "Create a frequency file on the server."
866 (wnnrpc-call-with-environment env ()
867 (comm-format (u u u s S s)
869 (wnn-const JS_FI_HINDO_FILE_CREATE)
870 (wnn-const JS_HINDO_FILE_CREATE))
871 env-id dic-id freqname comment passwd)
872 (wnnrpc-get-result)))
874 (defun wnnrpc-file-discard (env fid)
875 "Discard a file specified by FID. Call this for already-opened file
876 before remove and create new file."
877 (wnnrpc-call-with-environment env ()
878 (comm-format (u u i) (wnn-const JS_FILE_DISCARD)
880 (wnnrpc-get-result)))
882 (defun wnnrpc-file-remove (proc filename passwd)
884 (comm-call-with-proc proc ()
885 (comm-format (u s s) (wnn-const JS_FILE_REMOVE)
886 filename (or passwd ""))
887 (wnnrpc-get-result)))
889 (defun wnnrpc-set-conversion-parameter (env v)
890 "Set conversion parameter."
891 (wnnrpc-call-with-environment env ()
892 (comm-format (u u i i i i i i i i i i i i i i i i i)
893 (wnn-const JS_PARAM_SET)
895 (aref v 0) (aref v 1) (aref v 2) (aref v 3) (aref v 4)
896 (aref v 5) (aref v 6) (aref v 7) (aref v 8) (aref v 9)
897 (aref v 10) (aref v 11) (aref v 12) (aref v 13) (aref v 14)
898 (aref v 15) (aref v 16))
899 (wnnrpc-get-result)))
901 (defun wnnrpc-set-conversion-env-param (env mask v)
902 "Set Wnn6 conversion parameter."
903 (wnnrpc-call-with-environment env ()
904 (comm-format (u u u i i i i i i i i i i i i i i i i i i)
905 (wnn-const JS_SET_HENKAN_ENV)
907 (aref v 0) (aref v 1) (aref v 2) (aref v 3) (aref v 4)
908 (aref v 5) (aref v 6) (aref v 7) (aref v 8) (aref v 9)
909 (aref v 10) (aref v 11) (aref v 12) (aref v 13) (aref v 14)
910 (aref v 15) (aref v 16) (aref v 17))
911 (wnnrpc-get-result)))
913 (defun wnn7rpc-set-conversion-env-param (env mask v)
914 "Set Wnn7 conversion parameter."
915 (wnnrpc-call-with-environment env ()
916 (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)
917 (wnn-const JS_SET_HENKAN_ENV)
919 (aref v 0) (aref v 1) (aref v 2) (aref v 3) (aref v 4)
920 (aref v 5) (aref v 6) (aref v 7) (aref v 8) (aref v 9)
921 (aref v 10) (aref v 11) (aref v 12) (aref v 13) (aref v 14)
922 (aref v 15) (aref v 16) (aref v 17)
930 (wnnrpc-get-result)))
932 (defun wnn7rpc-set-conversion-env-param-highbit (env maskh maskl v)
933 "Set Wnn7 conversion parameter (use high bit mask)."
934 (wnnrpc-call-with-environment env ()
935 (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)
936 (wnn-const JS_SET_HENKAN_ENV)
938 (aref v 0) (aref v 1) (aref v 2) (aref v 3) (aref v 4)
939 (aref v 5) (aref v 6) (aref v 7) (aref v 8) (aref v 9)
940 (aref v 10) (aref v 11) (aref v 12) (aref v 13) (aref v 14)
941 (aref v 15) (aref v 16) (aref v 17) (aref v 18) (aref v 19)
942 (aref v 20) (aref v 21) (aref v 22) (aref v 23))
943 (wnnrpc-get-result)))
945 (defun wnnrpc-temporary-dic-loaded (env)
946 "Ask to the server whether the temporary dictionary is loaded or not.
947 Return positive if loaded, zero if not, negative on failure."
948 (wnnrpc-call-with-environment env ()
949 (comm-format (u u) (wnn-const JS_IS_LOADED_TEMPORARY_DIC)
951 (wnnrpc-get-result)))
953 (defun wnnrpc-temporary-dic-add (env reverse)
954 "Add temporary dictionary on the server."
955 (wnnrpc-call-with-environment env ()
956 (comm-format (u u u) (wnn-const JS_TEMPORARY_DIC_ADD)
957 env-id (if reverse 1 0))
958 (wnnrpc-get-result)))
960 (defun wnnrpc-receive-sho-bunsetsu-list (env n-bunsetsu)
961 (let ((proc (wnnenv-get-proc env))
963 end start jiritsugo-end dic-no entry freq right-now
964 hinshi status status-backward kangovect evaluation
965 result source fuzokugo)
966 (while (> n-bunsetsu 0)
967 (comm-unpack (i i i i i i i i i i i i)
968 end start jiritsugo-end
969 dic-no entry freq right-now hinshi
970 status status-backward kangovect evaluation)
973 (wnn-bunsetsu-create env (1+ (- jiritsugo-end start))
974 dic-no entry freq right-now hinshi
975 status status-backward kangovect evaluation)
977 (setq n-bunsetsu (1- n-bunsetsu)))
979 (setq slist (nreverse slist))
981 (comm-unpack (S S S) result source fuzokugo)
982 (wnn-bunsetsu-set-converted (car slist) result)
983 (wnn-bunsetsu-set-yomi (car slist) source)
984 (wnn-bunsetsu-set-fuzokugo (car slist) fuzokugo)
985 (setq slist (cdr slist))))))
987 (defun wnnrpc-receive-dai-bunsetsu-list (env n-dai separate)
988 (let ((proc (wnnenv-get-proc env))
989 n-bunstsu kanji-length dlist slist
990 end start n-sho evaluation
992 (comm-unpack (i i) n-bunstsu kanji-length)
994 (comm-unpack (i i i i) end start n-sho evaluation)
995 (setq dlist (cons (cons n-sho evaluation) dlist)
997 (setq dlist (nreverse dlist)
998 slist (wnnrpc-receive-sho-bunsetsu-list env n-bunstsu))
1003 (setq n (caar dlist))
1005 (wnn-bunsetsu-set-dai-evaluation (car slist) (cdar dlist))
1006 (wnn-bunsetsu-set-dai-continue (car slist) (> n 1))
1007 (setq slist (cdr slist)
1009 (setq dlist (cdr dlist))))
1011 (setq retval (cons slist retval)
1014 (wnn-bunsetsu-set-dai-evaluation (car slist) (cdar dlist))
1015 (wnn-bunsetsu-set-dai-continue (car slist) t)
1016 (setq slist (cdr slist)
1018 (wnn-bunsetsu-set-dai-evaluation (car slist) (cdar dlist))
1019 (wnn-bunsetsu-set-dai-continue (car slist)
1020 (wnn-bunsetsu-connect-next (car slist)))
1021 (setq slist (prog1 (cdr slist) (setcdr slist nil))
1023 (nreverse retval))))
1025 (defun wnnrpc-renbunsetsu-conversion (env yomi hinshi fuzokugo v)
1026 "Convert YOMI string into Kanji.
1027 HINSHI and FUZOKUGO are information of preceding bunsetsu."
1028 (wnnrpc-call-with-environment env ()
1029 (comm-format (u u S i S i i i) (wnn-const JS_KANREN)
1030 env-id yomi hinshi fuzokugo
1031 (or v (wnn-const WNN_VECT_KANREN))
1032 (if v (wnn-const WNN_VECT_KANREN) (wnn-const WNN_VECT_NO))
1033 (wnn-const WNN_VECT_BUNSETSU))
1035 (wnnrpc-receive-dai-bunsetsu-list env result nil))))
1037 (defun wnnrpc-fi-renbunsetsu-conversion (env yomi hinshi fuzokugo v context)
1038 "Convert YOMI string into Kanji.
1039 HINSHI and FUZOKUGO are information of preceding bunsetsu."
1040 (wnnrpc-call-with-environment env (result)
1041 (comm-format (u u S i S i i i i i i i S i i i i S) (wnn-const JS_FI_KANREN)
1042 env-id yomi hinshi fuzokugo
1043 (or v (wnn-const WNN_VECT_KANREN))
1044 (if v (wnn-const WNN_VECT_KANREN) (wnn-const WNN_VECT_NO))
1045 (wnn-const WNN_VECT_BUNSETSU)
1046 (wnn-context-dic-no (car context))
1047 (wnn-context-entry (car context))
1048 (wnn-context-jirilen (car context))
1049 (wnn-context-hinshi (car context))
1050 (wnn-context-fuzokugo (car context))
1051 (wnn-context-dic-no (nth 1 context))
1052 (wnn-context-entry (nth 1 context))
1053 (wnn-context-jirilen (nth 1 context))
1054 (wnn-context-hinshi (nth 1 context))
1055 (wnn-context-fuzokugo (nth 1 context)))
1056 (setq result (wnnrpc-get-result
1057 (wnnrpc-receive-dai-bunsetsu-list env result nil)))
1060 (unless (numberp result)
1061 (wnn-bunsetsu-set-fi-rel (car result)
1062 (wnnrpc-get-fi-relation-data env))
1064 (wnn-bunsetsu-set-context (car result) context)
1065 (setq result (cdr result)))))))
1067 (defun wnnrpc-get-fi-relation-data (env)
1068 "Receive FI relation data from the server."
1069 (let ((proc (wnnenv-get-proc env))
1070 fi-dic dic entry offset num result)
1071 (comm-unpack (i) num)
1073 (comm-unpack (i i i i) fi-dic dic entry offset)
1074 (setq result (cons (vector fi-dic dic entry offset -2 -4) result)
1078 (defun wnnrpc-tanbunsetsu-conversion (env yomi hinshi fuzoku v)
1080 (wnnrpc-call-with-environment env (kanji-length)
1081 (comm-format (u u S i S i i) (wnn-const JS_KANTAN_SHO)
1082 env-id yomi hinshi fuzoku
1083 (or v (wnn-const WNN_VECT_KANTAN))
1084 (if v (wnn-const WNN_VECT_KANTAN) (wnn-const WNN_VECT_NO)))
1086 (comm-unpack (u) kanji-length) ; ignore kanji-length
1087 (wnnrpc-receive-sho-bunsetsu-list env result))))
1089 (defun wnnrpc-get-bunsetsu-candidates (env yomi hinshi fuzoku v)
1091 (wnnrpc-call-with-environment env (kanji-length)
1092 (comm-format (u u S i S i i) (wnn-const JS_KANZEN_SHO)
1093 env-id yomi hinshi fuzoku
1094 (or v (wnn-const WNN_VECT_KANZEN))
1095 (if v (wnn-const WNN_VECT_KANZEN) (wnn-const WNN_VECT_NO)))
1097 (comm-unpack (u) kanji-length) ; ignore kanji-length
1099 (wnn-bunsetsu-set-dai-continue b (wnn-bunsetsu-connect-next b))
1101 (wnnrpc-receive-sho-bunsetsu-list env result)))))
1103 (defun wnnrpc-daibunsetsu-conversion (env yomi hinshi fuzoku v)
1105 (wnnrpc-call-with-environment env (n-sho-bunsetsu kanji-size)
1106 (comm-format (u u S i S i i) (wnn-const JS_KANTAN_DAI)
1107 env-id yomi hinshi fuzoku
1108 (or v (wnn-const WNN_VECT_KANTAN))
1109 (if v (wnn-const WNN_VECT_KANTAN) (wnn-const WNN_VECT_NO)))
1111 (wnnrpc-receive-dai-bunsetsu-list env result nil))))
1113 (defun wnnrpc-get-daibunsetsu-candidates (env yomi hinshi fuzoku v)
1115 (wnnrpc-call-with-environment env (n-sho-bunsetsu kanji-size)
1116 (comm-format (u u S i S i i) (wnn-const JS_KANZEN_DAI)
1117 env-id yomi hinshi fuzoku
1118 (or v (wnn-const WNN_VECT_KANZEN))
1119 (if v (wnn-const WNN_VECT_KANZEN) (wnn-const WNN_VECT_NO)))
1121 (wnnrpc-receive-dai-bunsetsu-list env result t))))
1123 (defun wnnrpc-set-frequency (env dicno entry ima hindo)
1125 (wnnrpc-call-with-environment env ()
1126 (comm-format (u u i i i i) (wnn-const JS_HINDO_SET)
1127 env-id dicno entry ima hindo)
1128 (wnnrpc-get-result)))
1130 (defun wnnrpc-set-fi-priority (env fi-rel)
1132 (wnnrpc-call-with-environment env ()
1134 (comm-format (u u u) (wnn-const JS_SET_FI_PRIORITY)
1135 env-id (length fi-rel))
1137 (comm-format (i i i i i i)
1138 (aref (car fi-rel) 0) (aref (car fi-rel) 1)
1139 (aref (car fi-rel) 2) (aref (car fi-rel) 3)
1140 (aref (car fi-rel) 4) (aref (car fi-rel) 5))
1141 (setq fi-rel (cdr fi-rel))))
1142 (wnnrpc-get-result)))
1144 (defun wnnrpc-optimize-fi (env context)
1146 (wnnrpc-call-with-environment env (c)
1148 (comm-format (u u u) (wnn-const JS_OPTIMIZE_FI)
1149 env-id (length context))
1151 (setq c (car context)
1152 context (cdr context))
1153 (comm-format (i i i i i S)
1154 (wnn-context-dic-no c)
1155 (wnn-context-entry c)
1156 (wnn-context-right-now c)
1157 (wnn-context-freq c)
1158 (wnn-context-length c)
1159 (concat (wnn-context-converted c)
1160 (wnn-context-fuzokugo c)))))
1161 (wnnrpc-get-result)))
1163 (defun wnnrpc-close (proc)
1165 (comm-call-with-proc proc ()
1166 (comm-format (u) (wnn-const JS_CLOSE))
1167 (wnnrpc-get-result)))
1169 (defun wnnrpc-env-exist (proc envname)
1171 (comm-call-with-proc proc (result)
1172 (comm-format (u s) (wnn-const JS_ENV_EXIST) envname)
1173 (comm-unpack (i) result)
1176 (defun wnnrpc-make-env-sticky (env)
1178 (wnnrpc-call-with-environment env ()
1179 (comm-format (u u) (wnn-const JS_ENV_STICKY) env-id)
1180 (wnnrpc-get-result)))
1182 (defun wnnrpc-make-env-unsticky (env)
1184 (wnnrpc-call-with-environment env ()
1185 (comm-format (u u) (wnn-const JS_ENV_UNSTICKY) env-id)
1186 (wnnrpc-get-result)))
1188 (defun wnnrpc-disconnect (env)
1190 (wnnrpc-call-with-environment env ()
1191 (comm-format (u u) (wnn-const JS_DISCONNECT) env-id)
1192 (wnnrpc-get-result)))
1194 (defun wnnrpc-add-word (env dictionary yomi kanji comment hinshi initial-freq)
1196 (wnnrpc-call-with-environment env ()
1197 (comm-format (u u u S S S u u) (wnn-const JS_WORD_ADD)
1198 env-id dictionary yomi kanji comment hinshi initial-freq)
1199 (wnnrpc-get-result)))
1201 (defun wnnrpc-auto-learning (env type yomi kanji comment hinshi initial-freq)
1203 (wnnrpc-call-with-environment env ()
1204 (comm-format (u u u S S S u u) (wnn-const JS_AUTOLEARNING_WORD_ADD)
1205 env-id type yomi kanji comment hinshi initial-freq)
1206 (wnnrpc-get-result)))
1208 (defun wnnrpc-temporary-learning (env yomi kanji comment hinshi initial-freq)
1210 (wnnrpc-call-with-environment env ()
1211 (comm-format (u u S S S u u) (wnn-const JS_AUTOLEARNING_WORD_ADD)
1212 env-id yomi kanji comment hinshi initial-freq)
1213 (wnnrpc-get-result)))
1215 (defun wnnrpc-get-dictionary-list-with-environment (env)
1217 (wnnrpc-call-with-environment env (n-dic)
1218 (comm-format (u u) (wnn-const JS_DIC_LIST) env-id)
1219 (comm-unpack (i) n-dic)
1220 (wnnrpc-receive-dictionary-list proc n-dic)))
1222 (defun wnnrpc-get-fi-dictionary-list-with-environment (env mask)
1224 (wnnrpc-call-with-environment env (n-dic)
1225 (comm-format (u u u) (wnn-const JS_FI_DIC_LIST) env-id mask)
1226 (comm-unpack (i) n-dic)
1227 (wnnrpc-receive-dictionary-list proc n-dic)))
1229 (defun wnnrpc-receive-dictionary-list (proc n-dic)
1230 (let (entry dic freq dic-mode freq-mode enable-flag nice
1231 rev comment dicname freqname dic-passwd freq-passwd
1232 type gosuu dic-local-flag freq-local-flag retval)
1234 (comm-unpack (i i i i i i i i S s s s s i i i i)
1235 entry dic freq dic-mode freq-mode enable-flag nice
1236 rev comment dicname freqname dic-passwd freq-passwd
1237 type gosuu dic-local-flag freq-local-flag)
1239 (vector entry dic freq dic-mode freq-mode enable-flag nice
1240 rev comment dicname freqname dic-passwd freq-passwd
1241 type gosuu dic-local-flag freq-local-flag)
1246 (defsubst wnndic-get-id (dic) (aref dic 0))
1247 (defsubst wnndic-get-comment (dic) (aref dic 8))
1248 (defsubst wnndic-get-dictname (dic) (aref dic 9))
1250 (defun wnnrpc-get-writable-dictionary-id-list (env)
1252 (wnnrpc-call-with-environment env (dic-list dic)
1253 (comm-format (u u i) (wnn-const JS_HINSI_DICTS) env-id -1)
1256 (comm-unpack (i) dic)
1257 (setq dic-list (nconc dic-list (list dic))
1258 result (1- result)))
1261 (defun wnnrpc-get-hinshi-list (env dic name)
1263 (wnnrpc-call-with-environment env (hinshi hinshi-list str-size)
1264 (comm-format (u u u S) (wnn-const JS_HINSI_LIST) env-id dic name)
1266 (comm-unpack (u) str-size) ; ignore
1268 (comm-unpack (S) hinshi)
1269 (setq hinshi-list (nconc hinshi-list (list hinshi))
1270 result (1- result)))
1273 (defun wnnrpc-hinshi-number (proc name)
1275 (wnnrpc-call-with-proc proc ()
1276 (comm-format (u S) (wnn-const JS_HINSI_NUMBER) name)
1277 (wnnrpc-get-result)))
1279 (defun wnnrpc-get-conversion-parameter (env)
1281 (wnnrpc-call-with-environment env (n nsho p1 p2 p3 p4 p5 p6 p7 p8 p9
1282 p10 p11 p12 p13 p14 p15)
1283 (comm-format (u u) (wnn-const JS_PARAM_GET) env-id)
1285 (comm-unpack (i i i i i i i i i i i i i i i i i)
1286 n nsho p1 p2 p3 p4 p5 p6 p7 p8 p9
1287 p10 p11 p12 p13 p14 p15)
1288 (vector n nsho p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15))))
1290 (defun wnnrpc-get-conversion-env-param (env)
1292 (wnnrpc-call-with-environment env (p1 p2 p3 p4 p5 p6 p7 p8 p9
1293 p10 p11 p12 p13 p14 p15 p16 p17 p18)
1294 (comm-format (u u) (wnn-const JS_GET_HENKAN_ENV) env-id)
1296 (comm-unpack (i i i i i i i i i i i i i i i i i i)
1297 p1 p2 p3 p4 p5 p6 p7 p8 p9
1298 p10 p11 p12 p13 p14 p15 p16 p17 p18)
1299 (vector p1 p2 p3 p4 p5 p6 p7 p8 p9
1300 p10 p11 p12 p13 p14 p15 p16 p17 p18))))
1302 (defun wnn7rpc-get-conversion-env-param (env)
1304 (wnnrpc-call-with-environment env (p1 p2 p3 p4 p5 p6 p7 p8 p9
1305 p10 p11 p12 p13 p14 p15 p16 p17 p18
1306 p19 p20 p21 p22 p23 p24)
1307 (comm-format (u u) (wnn-const JS_GET_HENKAN_ENV) env-id)
1309 (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)
1310 p1 p2 p3 p4 p5 p6 p7 p8 p9
1311 p10 p11 p12 p13 p14 p15 p16
1312 p17 p18 p19 p20 p21 p22 p23 p24)
1313 (vector p1 p2 p3 p4 p5 p6 p7 p8 p9
1314 p10 p11 p12 p13 p14 p15 p16 p17 p18
1315 p19 p20 p21 p22 p23 p24))))
1317 (defun wnnrpc-file-loaded (proc path)
1319 (comm-call-with-proc proc (result)
1320 (comm-format (u s) (wnn-const JS_FILE_LOADED) path)
1321 (comm-unpack (i) result)
1324 (defun wnnrpc-write-file (env fid filename)
1325 (wnnrpc-call-with-environment env ()
1326 (comm-format (u u u s) (wnn-const JS_FILE_WRITE) env-id fid filename)
1327 (wnnrpc-get-result)))
1329 (defun wnnrpc-get-fuzokugo-file (env)
1331 (wnnrpc-call-with-environment env ()
1332 (comm-format (u u) (wnn-const JS_FUZOKUGO_GET) env-id)
1333 (wnnrpc-get-result)))
1335 (defsubst wnnrpc-receive-file-list (proc)
1338 nfiles fid local ref-count type name)
1339 (comm-unpack (i) nfiles)
1341 (comm-unpack (i i i i s) fid local ref-count type name)
1342 (setq flist (nconc flist (list (vector fid local ref-count type name)))
1343 nfiles (1- nfiles)))
1346 (defun wnnrpc-get-file-list (proc)
1348 (comm-call-with-proc proc ()
1349 (comm-format (u) (wnn-const JS_FILE_LIST_ALL))
1350 (wnnrpc-receive-file-list proc)))
1352 (defun wnnrpc-get-file-list-with-env (env)
1354 (wnnrpc-call-with-environment env ()
1355 (comm-format (u u) (wnn-const JS_FILE_LIST) env-id)
1356 (wnnrpc-receive-file-list proc)))
1358 (defun wnnrpc-file-attribute (env path)
1359 "3: dictionary, 4: hindo file, 5: fuzokugo-file"
1360 (wnnrpc-call-with-environment env (result)
1361 (comm-format (u u s) (wnn-const JS_FILE_STAT) env-id path)
1362 (comm-unpack (i) result)
1365 (defun wnnrpc-get-file-info (env fid)
1367 (wnnrpc-call-with-environment env (name local ref-count type)
1368 (comm-format (u u u) (wnn-const JS_FILE_INFO) env-id fid)
1370 (comm-unpack (s i i i) name local ref-count type)
1371 (vector name local ref-count type))))
1373 (defmacro wnnrpc-receive-vector (n)
1374 `(let ((v (make-vector ,n -1))
1383 (defun wnnrpc-who (proc)
1385 (comm-call-with-proc proc (who socket username hostname)
1386 (comm-format (u) (wnn-const JS_WHO))
1389 (comm-unpack (i s s) socket username hostname)
1390 (setq who (nconc who
1391 (list (vector socket username hostname
1392 (wnnrpc-receive-vector
1393 (wnn-const WNN_MAX_ENV_OF_A_CLIENT)))))
1394 result (1- result)))
1397 (defun wnnrpc-get-env-list (proc)
1398 (comm-call-with-proc proc (envs id name count fuzokugo dic-max)
1399 (comm-format (u) (wnn-const JS_ENV_LIST))
1402 (comm-unpack (i s i i i) id name count fuzokugo dic-max)
1403 (setq envs (nconc envs
1404 (list (vector id name count fuzokugo dic-max
1405 (wnnrpc-receive-vector
1406 (wnn-const WNN_MAX_DIC_OF_AN_ENV))
1407 (wnnrpc-receive-vector
1408 (wnn-const WNN_MAX_FILE_OF_AN_ENV)))))
1409 result (1- result)))
1412 (defun wnnrpc-kill (proc)
1414 (comm-call-with-proc proc (result)
1415 (comm-format (u) (wnn-const JS_KILL))
1416 (comm-unpack (i) result)
1419 (defun wnnrpc-delete-dictionary (env dic)
1421 (wnnrpc-call-with-environment env ()
1422 (comm-format (u u u) (wnn-const JS_DIC_DELETE) env-id dic)
1423 (wnnrpc-get-result)))
1425 (defun wnnrpc-set-flag-on-dictionary (env dic flag)
1427 (wnnrpc-call-with-environment env ()
1428 (comm-format (u u u u) (wnn-const JS_DIC_USE) env-id dic flag)
1429 (wnnrpc-get-result)))
1431 (defun wnnrpc-get-dictionary-list (proc)
1433 (wnnrpc-call-with-proc proc (n-dic)
1434 (comm-format (u) (wnn-const JS_DIC_LIST_ALL))
1435 (comm-unpack (i) n-dic)
1436 (wnnrpc-receive-dictionary-list proc n-dic)))
1438 (defun wnnrpc-delete-word (env dic entry)
1440 (wnnrpc-call-with-environment env ()
1441 (comm-format (u u u u) (wnn-const JS_WORD_DELETE) env-id dic entry)
1442 (wnnrpc-get-result)))
1444 (defun wnnrpc-receive-word (proc yomi)
1445 (let (dic serial hinshi hindo right-now internal-hindo internal-right-now
1447 (comm-unpack (i) dic)
1449 (comm-unpack (i i i i i i) serial hinshi hindo right-now
1450 internal-hindo internal-right-now)
1451 (setq l (cons (vector dic serial hinshi hindo right-now
1452 internal-hindo internal-right-now
1455 (comm-unpack (i) dic))
1456 (setq l (nreverse l)
1459 (comm-unpack (S S) kanji comment)
1460 (aset (car l1) 8 kanji)
1461 (aset (car l1) 9 comment)
1465 (defun wnnrpc-search-word-in-dictionary (env dic yomi)
1467 (wnnrpc-call-with-environment env (n-entries len)
1468 (comm-format (u u u S) (wnn-const JS_WORD_SEARCH) env-id dic yomi)
1469 (comm-unpack (u u) n-entries len) ; ignore
1470 (wnnrpc-receive-word proc yomi)))
1472 (defun wnnrpc-search-word (env yomi)
1474 (wnnrpc-call-with-environment env (n-entries len)
1475 (comm-format (u u S) (wnn-const JS_WORD_SEARCH_BY_ENV) env-id yomi)
1476 (comm-unpack (u u) n-entries len) ; ignore
1477 (wnnrpc-receive-word proc yomi)))
1479 (defun wnnrpc-get-word-info (env dic entry)
1481 (wnnrpc-call-with-environment env (n-entries len yomi)
1482 (comm-format (u u u u) (wnn-const JS_WORD_INFO) env-id dic entry)
1484 (comm-unpack (S) yomi)
1485 (comm-unpack (u u) n-entries len) ; ignore
1486 (wnnrpc-receive-word proc yomi))))
1488 (defun wnnrpc-set-comment-on-word (env dic entry comment)
1490 (wnnrpc-call-with-environment env ()
1491 (comm-format (u u u u S) (wnn-const JS_WORD_COMMENT_SET)
1492 env-id dic entry comment)
1493 (wnnrpc-get-result)))
1495 (defun wnnrpc-get-dictionary-info (env dic)
1497 (wnnrpc-call-with-environment env ()
1498 (comm-format (u u u) (wnn-const JS_DIC_INFO) env-id dic)
1500 (wnnrpc-receive-dictionary-list proc 1))))
1502 (defun wnnrpc-set-file-comment (env fid comment)
1504 (wnnrpc-call-with-environment env ()
1505 (comm-format (u u u S) (wnn-const JS_FILE_COMMENT_SET) env-id fid comment)
1506 (wnnrpc-get-result)))
1508 (defun wnnrpc-hinshi-name (proc hinshi)
1510 (wnnrpc-call-with-proc proc ()
1511 (comm-format (u u) (wnn-const JS_HINSI_NAME) hinshi)
1513 (comm-unpack (S) result)
1516 (defun wnnrpc-set-file-password (env fid which old new)
1517 "WHICH: 1: DIC, 2: HINDO, 3(0): Both"
1518 (wnnrpc-call-with-environment env ()
1519 (comm-format (u u u u s s) (wnn-const JS_FILE_PASSWORD_SET)
1520 env-id fid which old new)
1521 (wnnrpc-get-result)))
1523 (defun wnnrpc-set-hinshi-table (env dic hinshi-table)
1525 (wnnrpc-call-with-environment env ()
1526 (comm-format (u u u S) (wnn-const JS_HINSI_TABLE_SET)
1527 env-id dic hinshi-table)
1528 (wnnrpc-get-result)))
1530 (defmacro wnnrpc-with-temp-buffer (&rest body)
1532 (let ((coding-system-for-read 'binary)
1533 (coding-system-for-write 'binary))
1534 (set-buffer-multibyte nil)
1537 (defmacro wnnrpc-with-write-file (filename error-handler &rest body)
1538 `(condition-case error
1539 (with-temp-file ,filename
1540 (let ((coding-system-for-read 'binary)
1541 (coding-system-for-write 'binary))
1542 (set-buffer-multibyte nil)
1544 (file-error ,error-handler)))
1546 (defmacro wnnrpc-terminate-current-command (errno)
1548 (comm-call-with-proc-1 proc ()
1549 (comm-format (i) (wnn-const WNN_NAK)))
1550 (- (wnn-const ,errno))))
1552 (defun wnnrpc-get-local-filename (name)
1553 (if (and (string-match (wnn-const WNN_C_LOCAL) name)
1554 (string= (substring name 0 (match-beginning 0)) wnn-system-name))
1555 (substring name (match-end 0))
1558 ;; <header> ::= (<type> <uniq> <uniq> <passwd>)
1559 ;; <uniq> ::= string
1560 ;; <passwd> ::= string
1562 (defun wnnrpc-scan-file-header ()
1564 type uniq1 uniq2 passwd)
1565 (if (and (> (point-max) (wnn-const WNN_FILE_HEADER_LEN))
1566 (equal (buffer-substring 1 (1+ (wnn-const WNN_FILE_STRING_LEN)))
1567 (wnn-const WNN_FILE_STRING)))
1569 (goto-char (1+ (wnn-const WNN_FILE_STRING_LEN)))
1570 (comm-unpack (i v v v)
1572 uniq1 (wnn-const WNN_UNIQ_LEN)
1573 uniq2 (wnn-const WNN_UNIQ_LEN)
1574 passwd (wnn-const WNN_PASSWD_LEN))
1575 (list type uniq1 uniq2 passwd)))))
1577 (defun wnnrpc-get-file-header (filename)
1578 (wnnrpc-with-temp-buffer
1579 (if (null (file-readable-p filename))
1580 (list nil (make-string (wnn-const WNN_UNIQ_LEN) 0) "" "")
1581 (insert-file-contents filename nil 0 (wnn-const WNN_FILE_HEADER_LEN))
1582 (wnnrpc-scan-file-header))))
1584 (defun wnnrpc-check-local-file (path &optional preserve)
1585 (let ((header (wnnrpc-get-file-header path)))
1586 (cond ((null header)
1587 (- (wnn-const WNN_NOT_A_FILE)))
1588 ((null (car header))
1589 (if (file-exists-p path)
1590 (- (wnn-const WNN_OPENF_ERR))
1591 (- (wnn-const WNN_NO_EXIST))))
1593 (if (wnnrpc-check-inode header path)
1596 (- (wnn-const WNN_INODE_CHECK_ERROR))
1597 (wnnrpc-change-file-uniq header path)
1598 (wnnrpc-check-local-file path t)))))))
1600 (defsubst wnnrpc-get-inode (uniq)
1601 (+ (lsh (aref uniq 8) 24)
1602 (lsh (aref uniq 9) 16)
1603 (lsh (aref uniq 10) 8)
1606 (defun wnnrpc-check-inode (header path)
1607 (let ((inode (nth 10 (file-attributes path))))
1608 (and inode (= inode (wnnrpc-get-inode (nth 1 header))))))
1610 (defun wnnrpc-make-uniq (attributes)
1611 (wnnrpc-with-temp-buffer
1612 (let ((ctime (nth 6 attributes))
1613 (ino (nth 10 attributes))
1614 (devno (nth 11 attributes)))
1616 (comm-format (U i u V)
1618 wnn-system-name (wnn-const WNN_HOST_LEN))
1619 ;; Emacs 21 returns returns negative devno as 16 bits uint pair
1620 (comm-format (U U u V)
1621 ctime (list (car devno) (cdr devno)) ino
1622 wnn-system-name (wnn-const WNN_HOST_LEN)))
1625 (defun wnnrpc-change-file-uniq (header path &optional new)
1626 (wnnrpc-with-write-file path
1628 (insert-file-contents path)
1629 (if (wnnrpc-scan-file-header)
1630 (let ((uniq (wnnrpc-make-uniq (file-attributes path))))
1631 (goto-char (1+ (wnn-const WNN_FILE_STRING_LEN)))
1632 (delete-region (point) (1+ (wnn-const WNN_FILE_HEADER_LEN)))
1633 (comm-format (u v v v v)
1635 uniq (wnn-const WNN_UNIQ_LEN)
1636 (if new uniq (nth 1 header)) (wnn-const WNN_UNIQ_LEN)
1637 (nth 3 header) (wnn-const WNN_PASSWD_LEN)
1638 "" (wnn-const WNN_FILE_HEADER_PAD))
1641 (defun wnnrpc-check-passwd (proc passwd header)
1644 (if (< (setq env-id (wnnrpc-connect proc "")) 0)
1646 (wnnrpc-call-with-environment (wnnenv-create proc env-id)
1648 (comm-format (u u v) (wnn-const JS_FILE_SEND)
1650 (nth 1 header) (wnn-const WNN_UNIQ_LEN))
1651 (comm-unpack (i) file-id)
1654 (wnnrpc-get-result) ; ignore result code
1655 (- (wnn-const WNN_FILE_IN_USE)))
1657 (comm-call-with-proc-1 proc ()
1659 (concat wnn-system-name "!TEMPFILE")
1660 (wnnrpc-make-dummy-dictionary header))
1662 (let ((egg-fixed-euc (list egg-fixed-euc egg-fixed-euc)))
1663 (wnnrpc-set-dictionary (wnnenv-create proc env-id)
1665 passwd "" nil))))))))
1667 (wnnrpc-disconnect (wnnenv-create proc env-id))))))
1669 (defun wnnrpc-make-dummy-dictionary (header)
1670 (wnnrpc-with-temp-buffer
1671 (comm-format (v u v v v v u v)
1672 (wnn-const WNN_FILE_STRING) (wnn-const WNN_FILE_STRING_LEN)
1673 (wnn-const WNN_FT_DICT_FILE)
1674 (nth 1 header) (wnn-const WNN_UNIQ_LEN)
1675 (nth 1 header) (wnn-const WNN_UNIQ_LEN)
1676 (nth 3 header) (wnn-const WNN_PASSWD_LEN)
1677 "" (wnn-const WNN_FILE_HEADER_PAD)
1678 (wnn-const WNN_REV_DICT)
1679 "" (wnn-const WNN_FILE_BODY_PAD))
1682 (defun wnnrpc-file-loaded-local (proc path &optional preserve)
1684 (let ((header (wnnrpc-check-local-file path preserve)))
1685 (if (numberp header)
1687 (comm-call-with-proc proc (result)
1688 (comm-format (u v) (wnn-const JS_FILE_LOADED_LOCAL)
1689 (nth 1 header) (wnn-const WNN_UNIQ_LEN))
1690 (comm-unpack (i) result)
1693 (defun wnnrpc-file-receive (env fid local-filename)
1696 (wnnrpc-call-with-environment env (filename)
1697 (comm-format (u u u) (wnn-const JS_FILE_RECEIVE)
1699 (comm-unpack (s) filename)
1700 (if (null local-filename)
1701 (setq local-filename (wnnrpc-get-local-filename filename)))
1702 (let ((header (wnnrpc-get-file-header local-filename))
1705 (wnnrpc-terminate-current-command WNN_NOT_A_FILE)
1706 (comm-call-with-proc-1 proc ()
1707 (comm-format (u v) (wnn-const WNN_ACK)
1708 (nth 1 header) (wnn-const WNN_UNIQ_LEN)))
1712 ((null (file-writable-p local-filename))
1713 (wnnrpc-terminate-current-command WNN_FILE_WRITE_ERROR))
1715 (wnnrpc-with-write-file local-filename
1716 (- (wnn-const WNN_FILE_WRITE_ERROR))
1717 (comm-call-with-proc proc ()
1718 (comm-format (u) (wnn-const WNN_ACK))
1719 (comm-unpack (B) contents))
1722 (insert-file-contents local-filename nil (1- (point))))
1724 (set-buffer (process-buffer proc))
1725 (wnnrpc-get-result)))))))))
1727 (wnnrpc-call-with-environment env ()
1728 (comm-format (i) (wnn-const WNN_NAK)))
1729 (signal (car err) (cdr err)))))
1731 (defun wnnrpc-file-send (env filename)
1733 (let ((header (wnnrpc-check-local-file filename)))
1734 (if (numberp header)
1737 (wnnrpc-call-with-environment env (file-id)
1738 (comm-format (u u v) (wnn-const JS_FILE_SEND)
1740 (nth 1 header) (wnn-const WNN_UNIQ_LEN))
1741 (comm-unpack (i) file-id)
1744 (wnnenv-set-client-file env filename)
1747 (comm-call-with-proc-1 proc ()
1749 (concat wnn-system-name "!" filename)
1750 (wnnrpc-with-temp-buffer
1751 (insert-file-contents filename)
1754 (wnnenv-set-client-file env filename)
1757 (wnnrpc-call-with-environment env ()
1758 (comm-format (s B B B B B B) "" "" "" "" "" "" ""))
1759 (signal (car err) (cdr err)))))))
1761 (defun wnnrpc-file-remove-client (proc name passwd)
1764 ((/= (wnnrpc-file-loaded-local proc name) -1)
1765 (- (wnn-const WNN_FILE_IN_USE)))
1766 ((null (file-readable-p name))
1767 (- (wnn-const WNN_FILE_READ_ERROR)))
1768 ((null (numberp (car (setq header (wnnrpc-get-file-header name)))))
1769 (- (wnn-const WNN_NOT_A_FILE)))
1770 ((< (wnnrpc-check-passwd proc passwd header) 0)
1771 (- (wnn-const WNN_INCORRECT_PASSWD)))
1777 (error (- (wnn-const WNN_UNLINK))))))))
1779 (defun wnnrpc-dic-file-create-client (env dicname type comment passwd hpasswd)
1780 (if (and (null (file-exists-p dicname))
1781 (file-writable-p dicname)
1782 (or (eq type (wnn-const WNN_REV_DICT))
1783 (eq type (wnn-const CWNN_REV_DICT))
1784 (eq type (wnn-const BWNN_REV_DICT))
1785 (eq type (wnn-const WNN_UD_DICT))
1786 (and (or (wnnenv-is-wnn6 env) (wnnenv-is-wnn7 env) (wnnenv-is-wnn8 env))
1787 (eq type (wnn-const WNN_FI_USER_DICT))))
1788 (wnnrpc-create-and-move-to-client env nil dicname type
1789 comment passwd hpasswd))
1791 (- (wnn-const WNN_FILE_CREATE_ERROR))))
1794 (defun wnnrpc-hindo-file-create-client (env fi dic-id freqname comment passwd)
1795 (if (and (null (file-exists-p freqname))
1796 (file-writable-p freqname)
1797 (wnnrpc-create-and-move-to-client env dic-id freqname fi
1798 comment passwd nil))
1800 (- (wnn-const WNN_FILE_CREATE_ERROR))))
1802 (defun wnnrpc-make-temp-name (env)
1804 (temp-form "usr/temp"))
1805 (while (= (wnnrpc-access env (concat temp-form (number-to-string n)) 0) 0)
1807 (concat temp-form (number-to-string n))))
1809 (defun wnnrpc-create-and-move-to-client (env dic-id filename type
1810 comment passwd hpasswd)
1811 (let ((tempfile (wnnrpc-make-temp-name env))
1817 (setq created (wnnrpc-dic-file-create env tempfile type
1818 comment passwd hpasswd))
1819 (setq created (wnnrpc-hindo-file-create env type dic-id tempfile
1821 (if (and (>= created 0)
1822 (>= (setq fid (wnnrpc-file-read env tempfile)) 0)
1823 (>= (wnnrpc-file-receive env fid filename) 0))
1824 (wnnrpc-change-file-uniq (wnnrpc-get-file-header filename)
1826 (condition-case nil (delete-file filename) (error))
1829 (wnnrpc-file-discard env fid))
1831 (wnnrpc-file-remove (wnnenv-get-proc env) tempfile passwd)))))
1833 (defun wnnrpc-read-passwd-file (filename)
1835 ((null filename) "")
1836 ((null (file-readable-p filename)) (- (wnn-const WNN_FILE_READ_ERROR)))
1838 (wnnrpc-with-temp-buffer
1839 (insert-file-contents filename nil 0 (1- (wnn-const WNN_PASSWD_LEN)))
1841 (if (and (search-forward-regexp "[\0\n]" nil 0)
1842 (= (preceding-char) 0))
1844 (buffer-substring 1 (point))))))
1846 ;;; egg/wnnrpc.el ends here.
1849 ;;; Wnn7 new function:
1850 ;;; Input Prediction
1853 (defun wnn7rpc-yosoku-init (env)
1854 "Initialize input prediction function"
1855 (wnnrpc-call-with-environment env ()
1856 (comm-format (u u) (wnn-const JS_YOSOKU_INIT) env-id)
1857 (wnnrpc-get-result)))
1859 (defun wnn7rpc-yosoku-free (env)
1860 "Free input prediction function area from server."
1861 (wnnrpc-call-with-environment env ()
1862 (comm-format (u u) (wnn-const JS_YOSOKU_FREE) env-id)
1863 (wnnrpc-get-result)))
1864 (defun wnn7rpc-yosoku-yosoku (env moji)
1865 "Execute input prediction."
1866 (wnnrpc-call-with-environment env (candnum len kouho kouho-list)
1867 (comm-format (u u E) (wnn-const JS_YOSOKU_YOSOKU) env-id moji)
1869 (comm-unpack (i) candnum)
1870 (while (> candnum 0)
1871 (comm-unpack (u s) len kouho)
1872 (setq kouho (decode-coding-string kouho 'euc-jp))
1873 (setq kouho-list (nconc kouho-list (list kouho))
1874 candnum (1- candnum)))
1877 (defun wnn7rpc-yosoku-toroku (env bun-suu yosoku-bunsetsu)
1878 "Register the input prediction candidate."
1879 (wnnrpc-call-with-environment env ()
1881 (comm-format (u u u) (wnn-const JS_YOSOKU_TOROKU) env-id bun-suu)
1882 (while yosoku-bunsetsu
1883 (comm-format (E u E u u)
1884 (aref (car yosoku-bunsetsu) 0)
1885 (aref (car yosoku-bunsetsu) 1)
1886 (aref (car yosoku-bunsetsu) 2)
1887 (aref (car yosoku-bunsetsu) 3)
1888 (aref (car yosoku-bunsetsu) 4))
1889 (setq yosoku-bunsetsu (cdr yosoku-bunsetsu))))
1890 (wnnrpc-get-result)))
1892 (defun wnn7rpc-yosoku-selected-cand (env selectpos)
1893 "Select the input prediction candidate."
1894 (wnnrpc-call-with-environment env ()
1895 (comm-format (u u u) (wnn-const JS_YOSOKU_SELECTED_CAND)
1897 (wnnrpc-get-result)))
1899 (defun wnn7rpc-yosoku-delete-cand (env selectpos)
1900 "Delete the input prediction candidate."
1901 (wnnrpc-call-with-environment env ()
1902 (comm-format (u u u) (wnn-const JS_YOSOKU_DELETE_CAND)
1904 (wnnrpc-get-result)))
1906 (defun wnn7rpc-yosoku-cancel-latest-toroku (env)
1907 "Cancel the latest registered word."
1908 (wnnrpc-call-with-environment env ()
1909 (comm-format (u u) (wnn-const JS_YOSOKU_CANCEL_LATEST_TOROKU) env-id)
1910 (wnnrpc-get-result)))
1912 (defun wnn7rpc-yosoku-reset-pre-yosoku (env)
1913 "Clear the connection information for the latest registered word."
1914 (wnnrpc-call-with-environment env ()
1915 (comm-format (u u) (wnn-const JS_YOSOKU_RESET_PRE_YOSOKU) env-id)
1916 (wnnrpc-get-result)))
1918 (defun wnn7rpc-yosoku-ikkatsu-toroku (env torokustr)
1919 "Register the input prediction candidate with phrase analysis."
1920 (wnnrpc-call-with-environment env ()
1921 (comm-format (u u S) (wnn-const JS_YOSOKU_IKKATSU_TOROKU)
1923 (wnnrpc-get-result)))
1925 (defun wnn7rpc-yosoku-save-datalist (env)
1926 "Save the input prediction data in data file."
1927 (wnnrpc-call-with-environment env ()
1928 (comm-format (u u) (wnn-const JS_YOSOKU_SAVE_DATALIST) env-id)
1929 (wnnrpc-get-result)))
1931 (defun wnn7rpc-yosoku-init-time-keydata (env)
1932 "Initialize input efficiency data about inputed key."
1933 (wnnrpc-call-with-environment env ()
1934 (comm-format (u u) (wnn-const JS_YOSOKU_INIT_TIME_KEYDATA) env-id)
1935 (wnnrpc-get-result)))
1937 (defun wnn7rpc-yosoku-init-inputinfo (env)
1938 "Initialize input efficiency data about input time."
1939 (wnnrpc-call-with-environment env ()
1940 (comm-format (u u) (wnn-const JS_YOSOKU_INIT_INPUTINFO) env-id)
1941 (wnnrpc-get-result)))
1943 (defun wnn7rpc-yosoku-set-user-inputinfo (env allkey userkey yosokuselect)
1944 "Set user input information to the input efficiency data."
1945 (wnnrpc-call-with-environment env ()
1946 (comm-format (u u u u) (wnn-const JS_YOSOKU_SET_USER_INPUTINFO)
1949 (logior userkey ?\x8000)
1951 (wnnrpc-get-result)))
1953 (defun wnn7rpc-yosoku-set-timeinfo (env yosokuselect throughyosoku inputtime
1955 "Set input-time information to the input efficiency data."
1956 (wnnrpc-call-with-environment env ()
1957 (comm-format (u u u u u u) (wnn-const JS_YOSOKU_SET_TIMEINFO)
1958 env-id yosokuselect throughyosoku inputtime keylen)
1959 (wnnrpc-get-result)))
1961 (defun wnn7rpc-yosoku-status (env)
1962 "Get input efficiency information."
1963 (wnnrpc-call-with-environment env (totalrod totalallkey totaluserkey
1964 totalrot totalalltime totalusertime
1965 stmday sthour stmin ltmday lthour ltmin
1966 totalroykinput totalallykkey nowrod
1967 nowallkey nowuserkey nowrot nowalltime
1968 nowusertime timeperonekey)
1969 (comm-format (u u) (wnn-const JS_YOSOKU_STATUS) env-id)
1970 (comm-unpack (i) totalrod)
1973 (comm-unpack (u u u u u u u u u u u u u u u u u u u u)
1974 totalallkey totaluserkey
1975 totalrot totalalltime totalusertime
1976 stmday sthour stmin ltmday lthour ltmin
1977 totalroykinput totalallykkey
1978 nowrod nowallkey nowuserkey nowrot nowalltime nowusertime
1980 (vector totalrod totalallkey totaluserkey totalrot totalalltime
1981 totalusertime stmday sthour stmin ltmday lthour ltmin
1982 totalroykinput totalallykkey nowrod nowallkey nowuserkey
1983 nowrot nowalltime nowusertime timeperonekey))))
1986 ;;; Wnn7 new function:
1987 ;;; association translation
1989 (defun wnn7rpc-assoc-with-data (env yomi hinsi fuzokugo v
1990 jilihin yomi_org jililen yomilen kanjilen
1992 "Convert YOMI string into Kanji with association."
1993 (wnnrpc-call-with-environment env (kanji-length)
1994 (comm-format (u u S i S i i u S i i i i) (wnn-const JS_HENKAN_ASSOC)
1995 env-id yomi hinsi fuzokugo
1996 (or v (wnn-const WNN_VECT_KANZEN))
1997 (if v (wnn-const WNN_VECT_KANZEN) (wnn-const WNN_VECT_NO))
1998 jilihin yomi_org jililen yomilen kanjilen real_kanjilen)
2000 (comm-unpack (u) kanji-length) ; ignore kanji-length
2002 (wnn7-bunsetsu-set-dai-continue b
2003 (wnn7-bunsetsu-connect-next b))
2005 (wnn7rpc-receive-sho-bunsetsu-list env result)))))
2008 (defun wnn7rpc-set-henkan-hinshi (env mode nhinshi hlist)
2010 (wnnrpc-call-with-environment env ()
2012 (comm-format (u u i i) (wnn-const JS_SET_HENKAN_HINSI)
2013 env-id mode nhinshi)
2015 (comm-format (u) (car hlist))
2016 (setq hlist (cdr hlist))))
2017 (wnnrpc-get-result)))