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 ;; Maintainer: TOMURA Satoru <tomura@etl.go.jp>
11 ;; Keywords: mule, multilingual, input method
13 ;; This file is part of EGG.
15 ;; EGG is free software; you can redistribute it and/or modify
16 ;; it under the terms of the GNU General Public License as published by
17 ;; the Free Software Foundation; either version 2, or (at your option)
20 ;; EGG is distributed in the hope that it will be useful,
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;; GNU General Public License for more details.
25 ;; You should have received a copy of the GNU General Public License
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the
27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
28 ;; Boston, MA 02111-1307, USA.
38 (defmacro wnn-file-string ()
39 (string-as-unibyte (decode-coding-string "
\e$B#W#n#n$N%U%!%$%k
\e(B" 'euc-jp)))
41 (string-to-number n 16))
42 (defmacro wnn-const (c)
43 "Macro for WNN constants."
44 (cond ((eq c 'JS_VERSION) 0)
47 ((eq c 'JS_CONNECT) 5)
48 ((eq c 'JS_DISCONNECT) 6)
49 ((eq c 'JS_ENV_EXIST) 7)
50 ((eq c 'JS_ENV_STICKY) 8)
51 ((eq c 'JS_ENV_UNSTICKY) 9)
52 ((eq c 'JS_KANREN) 17)
53 ((eq c 'JS_KANTAN_SHO) 18)
54 ((eq c 'JS_KANZEN_SHO) 19)
55 ((eq c 'JS_KANTAN_DAI) 20)
56 ((eq c 'JS_KANZEN_DAI) 21)
57 ((eq c 'JS_HINDO_SET) 24)
58 ((eq c 'JS_DIC_ADD) 33)
59 ((eq c 'JS_DIC_DELETE) 34)
60 ((eq c 'JS_DIC_USE) 35)
61 ((eq c 'JS_DIC_LIST) 36)
62 ((eq c 'JS_DIC_INFO) 37)
63 ((eq c 'JS_FUZOKUGO_SET) 41)
64 ((eq c 'JS_FUZOKUGO_GET) 48)
65 ((eq c 'JS_WORD_ADD) 49)
66 ((eq c 'JS_WORD_DELETE) 50)
67 ((eq c 'JS_WORD_SEARCH) 51)
68 ((eq c 'JS_WORD_SEARCH_BY_ENV) 52)
69 ((eq c 'JS_WORD_INFO) 53)
70 ((eq c 'JS_WORD_COMMENT_SET) 54)
71 ((eq c 'JS_PARAM_SET) 65)
72 ((eq c 'JS_PARAM_GET) 66)
74 ((eq c 'JS_ACCESS) 82)
76 ((eq c 'JS_ENV_LIST) 85)
77 ((eq c 'JS_FILE_LIST_ALL) 86)
78 ((eq c 'JS_DIC_LIST_ALL) 87)
79 ((eq c 'JS_FILE_READ) 97)
80 ((eq c 'JS_FILE_WRITE) 98)
81 ((eq c 'JS_FILE_SEND) 99)
82 ((eq c 'JS_FILE_RECEIVE) 100)
83 ((eq c 'JS_HINDO_FILE_CREATE) 101)
84 ((eq c 'JS_DIC_FILE_CREATE) 102)
85 ((eq c 'JS_FILE_REMOVE) 103)
86 ((eq c 'JS_FILE_LIST) 104)
87 ((eq c 'JS_FILE_INFO) 105)
88 ((eq c 'JS_FILE_LOADED) 106)
89 ((eq c 'JS_FILE_LOADED_LOCAL) 107)
90 ((eq c 'JS_FILE_DISCARD) 108)
91 ((eq c 'JS_FILE_COMMENT_SET) 109)
92 ((eq c 'JS_FILE_PASSWORD_SET) 110)
93 ((eq c 'JS_FILE_STAT) 111)
95 ((eq c 'JS_HINSI_LIST) 114)
96 ((eq c 'JS_HINSI_NAME) 115)
97 ((eq c 'JS_HINSI_NUMBER) 116)
98 ((eq c 'JS_HINSI_DICTS) 117)
99 ((eq c 'JS_HINSI_TABLE_SET) 118)
100 ((eq c 'JS_ACCESS_ADD_HOST) (wnn-hex "f00011"))
101 ((eq c 'JS_ACCESS_ADD_USER) (wnn-hex "f00012"))
102 ((eq c 'JS_ACCESS_REMOVE_HOST) (wnn-hex "f00013"))
103 ((eq c 'JS_ACCESS_REMOVE_USER) (wnn-hex "f00014"))
104 ((eq c 'JS_ACCESS_ENABLE) (wnn-hex "f00015"))
105 ((eq c 'JS_ACCESS_DISABLE) (wnn-hex "f00016"))
106 ((eq c 'JS_ACCESS_GET_INFO) (wnn-hex "f00017"))
107 ((eq c 'JS_TEMPORARY_DIC_ADD) (wnn-hex "f00021"))
108 ((eq c 'JS_TEMPORARY_DIC_DELETE) (wnn-hex "f00022"))
109 ((eq c 'JS_AUTOLEARNING_WORD_ADD) (wnn-hex "f00023"))
110 ((eq c 'JS_SET_AUTOLEARNING_DIC) (wnn-hex "f00024"))
111 ((eq c 'JS_GET_AUTOLEARNING_DIC) (wnn-hex "f00025"))
112 ((eq c 'JS_IS_LOADED_TEMPORARY_DIC) (wnn-hex "f00026"))
113 ((eq c 'JS_TEMPORARY_WORD_ADD) (wnn-hex "f00027"))
114 ((eq c 'JS_SET_HENKAN_ENV) (wnn-hex "f00031"))
115 ((eq c 'JS_GET_HENKAN_ENV) (wnn-hex "f00032"))
116 ((eq c 'JS_SET_HENKAN_HINSI) (wnn-hex "f00033"))
117 ((eq c 'JS_GET_HENKAN_HINSI) (wnn-hex "f00034"))
118 ((eq c 'JS_HENKAN_WITH_DATA) (wnn-hex "f00035"))
119 ((eq c 'JS_FI_DIC_ADD) (wnn-hex "f00061"))
120 ((eq c 'JS_FI_HINDO_FILE_CREATE) (wnn-hex "f00062"))
121 ((eq c 'JS_FI_KANREN) (wnn-hex "f00065"))
122 ((eq c 'JS_SET_FI_PRIORITY) (wnn-hex "f00066"))
123 ((eq c 'JS_OPTIMIZE_FI) (wnn-hex "f00067"))
124 ((eq c 'JS_HENKAN_IKEIJI) (wnn-hex "f0006f"))
125 ((eq c 'JS_LOCK) (wnn-hex "f00071"))
126 ((eq c 'JS_UNLOCK) (wnn-hex "f00072"))
127 ((eq c 'JS_FI_DIC_LIST) (wnn-hex "f00081"))
128 ((eq c 'JS_FI_DIC_LIST_ALL) (wnn-hex "f00082"))
129 ((eq c 'JS_FUZOKUGO_LIST) (wnn-hex "f00083"))
131 ((eq c 'JLIB_VERSION) (wnn-hex "4003"))
132 ((eq c 'JLIB_VERSION_WNN6) (wnn-hex "4f00"))
134 ((eq c 'WNN_C_LOCAL) "!")
135 ((eq c 'WNN_FT_DICT_FILE) 1)
136 ((eq c 'WNN_FT_HINDO_FILE) 2)
137 ((eq c 'WNN_FILE_STRING) (encode-coding-string
138 "
\e$B#W#n#n$N%U%!%$%k
\e(B" 'euc-jp))
139 ((eq c 'WNN_FILE_STRING_LEN) 16)
140 ((eq c 'WNN_PASSWD_LEN) 16)
141 ((eq c 'WNN_HOST_LEN) 16)
142 ((eq c 'WNN_UNIQ_LEN) 28)
143 ((eq c 'WNN_FILE_HEADER_LEN) 128)
144 ((eq c 'WNN_FILE_HEADER_PAD) 36)
145 ((eq c 'WNN_FILE_BODY_PAD) 116)
146 ((eq c 'WNN_ENVNAME_LEN) 32)
147 ((eq c 'WNN_MAX_ENV_OF_A_CLIENT) 32)
148 ((eq c 'WNN_MAX_DIC_OF_AN_ENV) 30)
149 ((eq c 'WNN_MAX_FILE_OF_AN_ENV) 60)
154 ((eq c 'WNN_NO_EXIST) 1)
155 ((eq c 'WNN_OPENF_ERR) 16)
156 ((eq c 'WNN_JSERVER_DEAD) 70)
157 ((eq c 'WNN_BAD_VERSION) 73)
158 ((eq c 'WNN_FILE_READ_ERROR) 90)
159 ((eq c 'WNN_FILE_WRITE_ERROR) 91)
160 ((eq c 'WNN_INCORRECT_PASSWD) 94)
161 ((eq c 'WNN_FILE_IN_USE) 95)
162 ((eq c 'WNN_UNLINK) 96)
163 ((eq c 'WNN_FILE_CREATE_ERROR) 97)
164 ((eq c 'WNN_NOT_A_FILE) 98)
165 ((eq c 'WNN_INODE_CHECK_ERROR) 99)
167 ((eq c 'WNN_UD_DICT) 2)
168 ((eq c 'WNN_REV_DICT) 3)
169 ((eq c 'CWNN_REV_DICT) (wnn-hex "103"))
170 ((eq c 'BWNN_REV_DICT) (wnn-hex "203"))
171 ((eq c 'WNN_COMPACT_DICT) 5)
172 ((eq c 'WNN_FI_SYSTEM_DICT) 6)
173 ((eq c 'WNN_FI_USER_DICT) 7)
174 ((eq c 'WNN_FI_HINDO_FILE) 8)
175 ((eq c 'WNN_GROUP_DICT) 9)
176 ((eq c 'WNN_MERGE_DICT) 10)
177 ((eq c 'WNN_VECT_NO) -1)
178 ((eq c 'WNN_VECT_BUNSETSU) 2)
179 ((eq c 'WNN_VECT_KANREN) 0)
180 ((eq c 'WNN_VECT_KANZEN) 1)
181 ((eq c 'WNN_VECT_KANTAN) 1))))
183 (defconst wnnrpc-error-message
187 "
\e$B%U%!%$%k$,B8:_$7$^$;$s
\e(B"
189 "
\e$B%a%b%j
\e(B allocation
\e$B$G<:GT$7$^$7$?
\e(B"
191 "
\e$B<-=q$G$O$"$j$^$;$s
\e(B"
192 "
\e$BIQEY%U%!%$%k$G$O$"$j$^$;$s
\e(B"
193 "
\e$BIUB08l%U%!%$%k$G$O$"$j$^$;$s
\e(B"
195 "
\e$B<-=q%F!<%V%k$,0lGU$G$9
\e(B"
196 "
\e$BIQEY%U%!%$%k$,;XDj$5$l$?<-=q$NIQEY%U%!%$%k$G$O$"$j$^$;$s
\e(B"
202 "
\e$B%U%!%$%k$,%*!<%W%s$G$-$^$;$s
\e(B"
203 "
\e$B@5$7$$IQEY%U%!%$%k$G$O$"$j$^$;$s
\e(B"
204 "
\e$B@5$7$$IUB08l%U%!%$%k$G$O$"$j$^$;$s
\e(B"
205 "
\e$BIUB08l$N8D?t
\e(B,
\e$B%Y%/%?D9$5$J$I$,B?2a$.$^$9
\e(B"
206 "
\e$B$=$NHV9f$N<-=q$O;H$o$l$F$$$^$;$s
\e(B"
210 "
\e$BIUB08l%U%!%$%k$NFbMF$,@5$7$/$"$j$^$;$s
\e(B"
211 "
\e$B5?;wIJ;lHV9f$,0[>o$G$9
\e(B(hinsi.data
\e$B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y
\e(B"
661 "
\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"
662 "
\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"
664 "Array of WNN error messages. Indexed by error code.")
666 (defvar wnnrpc-timeout 10)
668 (defun wnnrpc-message-language (lang)
669 (or (cdr (assq lang egg-message-language-alist)) lang))
671 (defun wnnrpc-get-error-message (errno)
672 "Return error message string specified by ERRNO."
673 (let ((msg (cdr (or (assq (wnnrpc-message-language egg-default-language)
674 wnnrpc-error-message)
675 (assq (wnnrpc-message-language its-current-language)
676 wnnrpc-error-message)
677 (assq 'Japanese wnnrpc-error-message)))))
678 (or (and (< errno (length msg)) (aref msg errno))
679 (format "#%d" errno))))
681 (defmacro wnnrpc-call-with-proc (proc vlist send-expr &rest receive-exprs)
682 `(comm-call-with-proc ,proc
684 (comm-accept-timeout wnnrpc-timeout)
686 ,send-expr ,@receive-exprs))
688 (defmacro wnnrpc-call-with-environment (env vlist send-expr &rest rcv-exprs)
689 `(comm-call-with-proc (wnnenv-get-proc ,env)
691 (comm-accept-timeout wnnrpc-timeout)
692 (env-id (wnnenv-get-env-id ,env))
694 ,send-expr ,@rcv-exprs))
696 (defmacro wnnrpc-get-result (&rest body)
698 (comm-unpack (i) result)
701 (comm-unpack (i) result)
703 ,@(or body '(result)))))
705 (defun wnnrpc-open-internal (proc version myhostname username)
706 "Open the session. Return 0 on success, error code on failure."
707 (comm-call-with-proc proc ()
708 (comm-format (u u s s)
710 version myhostname username)
711 (wnnrpc-get-result)))
713 (defun wnnrpc-open (proc myhostname username)
714 "Open the session. Return wnn4 or wnn6 on success, NIL on failure."
715 (let ((type-list `((wnn6 . ,(wnn-const JLIB_VERSION_WNN6))
716 (wnn4 . ,(wnn-const JLIB_VERSION))))
717 (result (- (wnn-const WNN_BAD_VERSION)))
719 (while (and type-list (= result (- (wnn-const WNN_BAD_VERSION))))
720 (setq type (caar type-list)
721 version (cdar type-list)
722 type-list (cdr type-list)
723 result (wnnrpc-open-internal proc version myhostname username)))
728 (defun wnnrpc-connect (proc envname)
729 "Establish new `connection' and make an environment.
730 Return the identitifation of the environment on success,
731 or negative error code on failure."
732 (comm-call-with-proc proc ()
733 (comm-format (u s) (wnn-const JS_CONNECT) envname)
734 (wnnrpc-get-result)))
736 (defun wnnrpc-file-read (env filename)
737 "Read the file FILENAME on the environment ENV
738 Return non-negative file ID on success, or negative error code on failure."
739 (wnnrpc-call-with-environment env ()
740 (comm-format (u u s) (wnn-const JS_FILE_READ) env-id filename)
741 (wnnrpc-get-result)))
743 (defun wnnrpc-set-fuzokugo-file (env fid)
744 "For PROC, on environment ENV-ID,
745 Set Fuzokugo file specified by FID.
746 Return 0 on success, negate-encoded error code on failure."
747 (wnnrpc-call-with-environment env ()
748 (comm-format (u u i) (wnn-const JS_FUZOKUGO_SET) env-id fid)
749 (wnnrpc-get-result)))
751 (defun wnnrpc-set-dictionary (env dic-id freq-id priority dic-rw freq-rw
752 dic-passwd freq-passwd reverse)
753 "Set dictionary on server.
754 Return dictionary number on success, negate-encoded error code on faiulure."
755 (wnnrpc-call-with-environment env ()
756 (comm-format (u u i i i u u s s u) (wnn-const JS_DIC_ADD)
757 env-id dic-id freq-id
759 (if (numberp dic-rw) dic-rw (if dic-rw 0 1))
760 (if (numberp freq-rw) freq-rw (if freq-rw 0 1))
761 dic-passwd freq-passwd
763 (wnnrpc-get-result)))
765 (defun wnnrpc-set-fi-dictionary (env dic-id freq-id sys dic-rw freq-rw
766 dic-passwd freq-passwd)
767 "Set FI dictionary on the server.
768 Return 0 on success, negate-encoded error code on faiulure."
769 (wnnrpc-call-with-environment env ()
770 (comm-format (u u i i u u u s s) (wnn-const JS_FI_DIC_ADD)
771 env-id dic-id freq-id
773 (wnn-const WNN_FI_SYSTEM_DICT)
774 (wnn-const WNN_FI_USER_DICT))
775 (if (numberp dic-rw) dic-rw (if dic-rw 0 1))
776 (if (numberp freq-rw) freq-rw (if freq-rw 0 1))
777 dic-passwd freq-passwd)
778 (wnnrpc-get-result)))
780 (defun wnnrpc-get-autolearning-dic (env type)
781 "Get id of auto learning dictionary on the server.
782 Return dictionary id + 1 on success, 0 on no dictionary, negate-encoded
783 error code on faiulure."
784 (wnnrpc-call-with-environment env (result)
785 (comm-format (u u u) (wnn-const JS_GET_AUTOLEARNING_DIC)
788 (comm-unpack (i) result)
791 (defun wnnrpc-set-autolearning-dic (env type dic-id)
792 "Set auto learning dictionary on the server.
793 Return 0 on success, negate-encoded error code on faiulure."
794 (wnnrpc-call-with-environment env ()
795 (comm-format (u u u i) (wnn-const JS_SET_AUTOLEARNING_DIC)
797 (wnnrpc-get-result)))
799 (defun wnnrpc-version (proc)
800 "Return the version number of WNN server."
801 (comm-call-with-proc proc (result)
802 (comm-format (u) (wnn-const JS_VERSION))
803 (comm-unpack (i) result)
806 (defun wnnrpc-access (env path mode)
807 "Check the accessibility of file in the environment ENV.
808 Return 0 when the remote file (dictionary/frequency) of PATH on server
809 can be accessed in mode MODE. Return Non-zero otherwise."
810 (wnnrpc-call-with-environment env (result)
811 (comm-format (u u u s) (wnn-const JS_ACCESS) env-id mode path)
812 (comm-unpack (i) result)
815 (defun wnnrpc-mkdir (env path)
816 "Create directory specified by PATH."
817 (wnnrpc-call-with-environment env ()
818 (comm-format (u u s) (wnn-const JS_MKDIR) env-id path)
819 (wnnrpc-get-result)))
821 (defun wnnrpc-writable-dic-type (env fi rw)
822 (let ((server (wnnenv-get-server-type env)))
823 (cond (fi (wnn-const WNN_FI_USER_DICT))
824 ((or (eq server 'cserver)
825 (eq server 'tserver)) (wnn-const CWNN_REV_DICT))
826 ((eq rw 3) (wnn-const WNN_GROUP_DICT))
827 ((eq rw 4) (wnn-const WNN_MERGE_DICT))
828 (t (wnn-const WNN_REV_DICT)))))
830 (defun wnnrpc-dic-file-create (env dicname type comment passwd hpasswd)
831 "Create a dictionary on the server."
832 (wnnrpc-call-with-environment env ()
833 (comm-format (u u s S s s u) (wnn-const JS_DIC_FILE_CREATE)
834 env-id dicname comment
836 (wnnrpc-get-result)))
838 (defun wnnrpc-hindo-file-create (env fi dic-id freqname comment passwd)
839 "Create a frequency file on the server."
840 (wnnrpc-call-with-environment env ()
841 (comm-format (u u u s S s)
843 (wnn-const JS_FI_HINDO_FILE_CREATE)
844 (wnn-const JS_HINDO_FILE_CREATE))
845 env-id dic-id freqname comment passwd)
846 (wnnrpc-get-result)))
848 (defun wnnrpc-file-discard (env fid)
849 "Discard a file specified by FID. Call this for already-opened file
850 before remove and create new file."
851 (wnnrpc-call-with-environment env ()
852 (comm-format (u u i) (wnn-const JS_FILE_DISCARD)
854 (wnnrpc-get-result)))
856 (defun wnnrpc-file-remove (proc filename passwd)
858 (comm-call-with-proc proc ()
859 (comm-format (u s s) (wnn-const JS_FILE_REMOVE)
860 filename (or passwd ""))
861 (wnnrpc-get-result)))
863 (defun wnnrpc-set-conversion-parameter (env v)
864 "Set conversion parameter."
865 (wnnrpc-call-with-environment env ()
866 (comm-format (u u i i i i i i i i i i i i i i i i i)
867 (wnn-const JS_PARAM_SET)
869 (aref v 0) (aref v 1) (aref v 2) (aref v 3) (aref v 4)
870 (aref v 5) (aref v 6) (aref v 7) (aref v 8) (aref v 9)
871 (aref v 10) (aref v 11) (aref v 12) (aref v 13) (aref v 14)
872 (aref v 15) (aref v 16))
873 (wnnrpc-get-result)))
875 (defun wnnrpc-set-conversion-env-param (env mask v)
876 "Set Wnn6 conversion parameter."
877 (wnnrpc-call-with-environment env ()
878 (comm-format (u u u i i i i i i i i i i i i i i i i i i)
879 (wnn-const JS_SET_HENKAN_ENV)
881 (aref v 0) (aref v 1) (aref v 2) (aref v 3) (aref v 4)
882 (aref v 5) (aref v 6) (aref v 7) (aref v 8) (aref v 9)
883 (aref v 10) (aref v 11) (aref v 12) (aref v 13) (aref v 14)
884 (aref v 15) (aref v 16) (aref v 17))
885 (wnnrpc-get-result)))
887 (defun wnnrpc-temporary-dic-loaded (env)
888 "Ask to the server whether the temporary dictionary is loaded or not.
889 Return positive if loaded, zero if not, negative on failure."
890 (wnnrpc-call-with-environment env ()
891 (comm-format (u u) (wnn-const JS_IS_LOADED_TEMPORARY_DIC)
893 (wnnrpc-get-result)))
895 (defun wnnrpc-temporary-dic-add (env reverse)
896 "Add temporary dictionary on the server."
897 (wnnrpc-call-with-environment env ()
898 (comm-format (u u u) (wnn-const JS_TEMPORARY_DIC_ADD)
899 env-id (if reverse 1 0))
900 (wnnrpc-get-result)))
902 (defun wnnrpc-receive-sho-bunsetsu-list (env n-bunsetsu)
903 (let ((proc (wnnenv-get-proc env))
905 end start jiritsugo-end dic-no entry freq right-now
906 hinshi status status-backward kangovect evaluation
907 result source fuzokugo)
908 (while (> n-bunsetsu 0)
909 (comm-unpack (i i i i i i i i i i i i)
910 end start jiritsugo-end
911 dic-no entry freq right-now hinshi
912 status status-backward kangovect evaluation)
915 (wnn-bunsetsu-create env (1+ (- jiritsugo-end start))
916 dic-no entry freq right-now hinshi
917 status status-backward kangovect evaluation)
919 (setq n-bunsetsu (1- n-bunsetsu)))
921 (setq slist (nreverse slist))
923 (comm-unpack (S S S) result source fuzokugo)
924 (wnn-bunsetsu-set-converted (car slist) result)
925 (wnn-bunsetsu-set-yomi (car slist) source)
926 (wnn-bunsetsu-set-fuzokugo (car slist) fuzokugo)
927 (setq slist (cdr slist))))))
929 (defun wnnrpc-receive-dai-bunsetsu-list (env n-dai separate)
930 (let ((proc (wnnenv-get-proc env))
931 n-bunstsu kanji-length dlist slist
932 end start n-sho evaluation
934 (comm-unpack (i i) n-bunstsu kanji-length)
936 (comm-unpack (i i i i) end start n-sho evaluation)
937 (setq dlist (cons (cons n-sho evaluation) dlist)
939 (setq dlist (nreverse dlist)
940 slist (wnnrpc-receive-sho-bunsetsu-list env n-bunstsu))
945 (setq n (caar dlist))
947 (wnn-bunsetsu-set-dai-evaluation (car slist) (cdar dlist))
948 (wnn-bunsetsu-set-dai-continue (car slist) (> n 1))
949 (setq slist (cdr slist)
951 (setq dlist (cdr dlist))))
953 (setq retval (cons slist retval)
956 (wnn-bunsetsu-set-dai-evaluation (car slist) (cdar dlist))
957 (wnn-bunsetsu-set-dai-continue (car slist) t)
958 (setq slist (cdr slist)
960 (wnn-bunsetsu-set-dai-evaluation (car slist) (cdar dlist))
961 (wnn-bunsetsu-set-dai-continue (car slist)
962 (wnn-bunsetsu-connect-next (car slist)))
963 (setq slist (prog1 (cdr slist) (setcdr slist nil))
967 (defun wnnrpc-renbunsetsu-conversion (env yomi hinshi fuzokugo v)
968 "Convert YOMI string into Kanji.
969 HINSHI and FUZOKUGO are information of preceding bunsetsu."
970 (wnnrpc-call-with-environment env ()
971 (comm-format (u u S i S i i i) (wnn-const JS_KANREN)
972 env-id yomi hinshi fuzokugo
973 (or v (wnn-const WNN_VECT_KANREN))
974 (if v (wnn-const WNN_VECT_KANREN) (wnn-const WNN_VECT_NO))
975 (wnn-const WNN_VECT_BUNSETSU))
977 (wnnrpc-receive-dai-bunsetsu-list env result nil))))
979 (defun wnnrpc-fi-renbunsetsu-conversion (env yomi hinshi fuzokugo v context)
980 "Convert YOMI string into Kanji.
981 HINSHI and FUZOKUGO are information of preceding bunsetsu."
982 (wnnrpc-call-with-environment env (result)
983 (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)
984 env-id yomi hinshi fuzokugo
985 (or v (wnn-const WNN_VECT_KANREN))
986 (if v (wnn-const WNN_VECT_KANREN) (wnn-const WNN_VECT_NO))
987 (wnn-const WNN_VECT_BUNSETSU)
988 (wnn-context-dic-no (car context))
989 (wnn-context-entry (car context))
990 (wnn-context-jirilen (car context))
991 (wnn-context-hinshi (car context))
992 (wnn-context-fuzokugo (car context))
993 (wnn-context-dic-no (nth 1 context))
994 (wnn-context-entry (nth 1 context))
995 (wnn-context-jirilen (nth 1 context))
996 (wnn-context-hinshi (nth 1 context))
997 (wnn-context-fuzokugo (nth 1 context)))
998 (setq result (wnnrpc-get-result
999 (wnnrpc-receive-dai-bunsetsu-list env result nil)))
1002 (unless (numberp result)
1003 (wnn-bunsetsu-set-fi-rel (car result)
1004 (wnnrpc-get-fi-relation-data env))
1006 (wnn-bunsetsu-set-context (car result) context)
1007 (setq result (cdr result)))))))
1009 (defun wnnrpc-get-fi-relation-data (env)
1010 "Receive FI relation data from the server."
1011 (let ((proc (wnnenv-get-proc env))
1012 fi-dic dic entry offset num result)
1013 (comm-unpack (i) num)
1015 (comm-unpack (i i i i) fi-dic dic entry offset)
1016 (setq result (cons (vector fi-dic dic entry offset -2 -4) result)
1020 (defun wnnrpc-tanbunsetsu-conversion (env yomi hinshi fuzoku v)
1022 (wnnrpc-call-with-environment env (kanji-length)
1023 (comm-format (u u S i S i i) (wnn-const JS_KANTAN_SHO)
1024 env-id yomi hinshi fuzoku
1025 (or v (wnn-const WNN_VECT_KANTAN))
1026 (if v (wnn-const WNN_VECT_KANTAN) (wnn-const WNN_VECT_NO)))
1028 (comm-unpack (u) kanji-length) ; ignore kanji-length
1029 (wnnrpc-receive-sho-bunsetsu-list env result))))
1031 (defun wnnrpc-get-bunsetsu-candidates (env yomi hinshi fuzoku v)
1033 (wnnrpc-call-with-environment env (kanji-length)
1034 (comm-format (u u S i S i i) (wnn-const JS_KANZEN_SHO)
1035 env-id yomi hinshi fuzoku
1036 (or v (wnn-const WNN_VECT_KANZEN))
1037 (if v (wnn-const WNN_VECT_KANZEN) (wnn-const WNN_VECT_NO)))
1039 (comm-unpack (u) kanji-length) ; ignore kanji-length
1041 (wnn-bunsetsu-set-dai-continue b (wnn-bunsetsu-connect-next b))
1043 (wnnrpc-receive-sho-bunsetsu-list env result)))))
1045 (defun wnnrpc-daibunsetsu-conversion (env yomi hinshi fuzoku v)
1047 (wnnrpc-call-with-environment env (n-sho-bunsetsu kanji-size)
1048 (comm-format (u u S i S i i) (wnn-const JS_KANTAN_DAI)
1049 env-id yomi hinshi fuzoku
1050 (or v (wnn-const WNN_VECT_KANTAN))
1051 (if v (wnn-const WNN_VECT_KANTAN) (wnn-const WNN_VECT_NO)))
1053 (wnnrpc-receive-dai-bunsetsu-list env result nil))))
1055 (defun wnnrpc-get-daibunsetsu-candidates (env yomi hinshi fuzoku v)
1057 (wnnrpc-call-with-environment env (n-sho-bunsetsu kanji-size)
1058 (comm-format (u u S i S i i) (wnn-const JS_KANZEN_DAI)
1059 env-id yomi hinshi fuzoku
1060 (or v (wnn-const WNN_VECT_KANZEN))
1061 (if v (wnn-const WNN_VECT_KANZEN) (wnn-const WNN_VECT_NO)))
1063 (wnnrpc-receive-dai-bunsetsu-list env result t))))
1065 (defun wnnrpc-set-frequency (env dicno entry ima hindo)
1067 (wnnrpc-call-with-environment env ()
1068 (comm-format (u u i i i i) (wnn-const JS_HINDO_SET)
1069 env-id dicno entry ima hindo)
1070 (wnnrpc-get-result)))
1072 (defun wnnrpc-set-fi-priority (env fi-rel)
1074 (wnnrpc-call-with-environment env ()
1076 (comm-format (u u u) (wnn-const JS_SET_FI_PRIORITY)
1077 env-id (length fi-rel))
1079 (comm-format (i i i i i i)
1080 (aref (car fi-rel) 0) (aref (car fi-rel) 1)
1081 (aref (car fi-rel) 2) (aref (car fi-rel) 3)
1082 (aref (car fi-rel) 4) (aref (car fi-rel) 5))
1083 (setq fi-rel (cdr fi-rel))))
1084 (wnnrpc-get-result)))
1086 (defun wnnrpc-optimize-fi (env context)
1088 (wnnrpc-call-with-environment env (c)
1090 (comm-format (u u u) (wnn-const JS_OPTIMIZE_FI)
1091 env-id (length context))
1093 (setq c (car context)
1094 context (cdr context))
1095 (comm-format (i i i i i S)
1096 (wnn-context-dic-no c)
1097 (wnn-context-entry c)
1098 (wnn-context-right-now c)
1099 (wnn-context-freq c)
1100 (wnn-context-length c)
1101 (concat (wnn-context-converted c)
1102 (wnn-context-fuzokugo c)))))
1103 (wnnrpc-get-result)))
1105 (defun wnnrpc-close (proc)
1107 (comm-call-with-proc proc ()
1108 (comm-format (u) (wnn-const JS_CLOSE))
1109 (wnnrpc-get-result)))
1111 (defun wnnrpc-env-exist (proc envname)
1113 (comm-call-with-proc proc (result)
1114 (comm-format (u s) (wnn-const JS_ENV_EXIST) envname)
1115 (comm-unpack (i) result)
1118 (defun wnnrpc-make-env-sticky (env)
1120 (wnnrpc-call-with-environment env ()
1121 (comm-format (u u) (wnn-const JS_ENV_STICKY) env-id)
1122 (wnnrpc-get-result)))
1124 (defun wnnrpc-make-env-unsticky (env)
1126 (wnnrpc-call-with-environment env ()
1127 (comm-format (u u) (wnn-const JS_ENV_UNSTICKY) env-id)
1128 (wnnrpc-get-result)))
1130 (defun wnnrpc-disconnect (env)
1132 (wnnrpc-call-with-environment env ()
1133 (comm-format (u u) (wnn-const JS_DISCONNECT) env-id)
1134 (wnnrpc-get-result)))
1136 (defun wnnrpc-add-word (env dictionary yomi kanji comment hinshi initial-freq)
1138 (wnnrpc-call-with-environment env ()
1139 (comm-format (u u u S S S u u) (wnn-const JS_WORD_ADD)
1140 env-id dictionary yomi kanji comment hinshi initial-freq)
1141 (wnnrpc-get-result)))
1143 (defun wnnrpc-auto-learning (env type yomi kanji comment hinshi initial-freq)
1145 (wnnrpc-call-with-environment env ()
1146 (comm-format (u u u S S S u u) (wnn-const JS_AUTOLEARNING_WORD_ADD)
1147 env-id type yomi kanji comment hinshi initial-freq)
1148 (wnnrpc-get-result)))
1150 (defun wnnrpc-temporary-learning (env yomi kanji comment hinshi initial-freq)
1152 (wnnrpc-call-with-environment env ()
1153 (comm-format (u u S S S u u) (wnn-const JS_AUTOLEARNING_WORD_ADD)
1154 env-id yomi kanji comment hinshi initial-freq)
1155 (wnnrpc-get-result)))
1157 (defun wnnrpc-get-dictionary-list-with-environment (env)
1159 (wnnrpc-call-with-environment env (n-dic)
1160 (comm-format (u u) (wnn-const JS_DIC_LIST) env-id)
1161 (comm-unpack (i) n-dic)
1162 (wnnrpc-receive-dictionary-list proc n-dic)))
1164 (defun wnnrpc-get-fi-dictionary-list-with-environment (env mask)
1166 (wnnrpc-call-with-environment env (n-dic)
1167 (comm-format (u u u) (wnn-const JS_FI_DIC_LIST) env-id mask)
1168 (comm-unpack (i) n-dic)
1169 (wnnrpc-receive-dictionary-list proc n-dic)))
1171 (defun wnnrpc-receive-dictionary-list (proc n-dic)
1172 (let (entry dic freq dic-mode freq-mode enable-flag nice
1173 rev comment dicname freqname dic-passwd freq-passwd
1174 type gosuu dic-local-flag freq-local-flag retval)
1176 (comm-unpack (i i i i i i i i S s s s s i i i i)
1177 entry dic freq dic-mode freq-mode enable-flag nice
1178 rev comment dicname freqname dic-passwd freq-passwd
1179 type gosuu dic-local-flag freq-local-flag)
1181 (vector entry dic freq dic-mode freq-mode enable-flag nice
1182 rev comment dicname freqname dic-passwd freq-passwd
1183 type gosuu dic-local-flag freq-local-flag)
1188 (defsubst wnndic-get-id (dic) (aref dic 0))
1189 (defsubst wnndic-get-comment (dic) (aref dic 8))
1190 (defsubst wnndic-get-dictname (dic) (aref dic 9))
1192 (defun wnnrpc-get-writable-dictionary-id-list (env)
1194 (wnnrpc-call-with-environment env (dic-list dic)
1195 (comm-format (u u i) (wnn-const JS_HINSI_DICTS) env-id -1)
1198 (comm-unpack (i) dic)
1199 (setq dic-list (nconc dic-list (list dic))
1200 result (1- result)))
1203 (defun wnnrpc-get-hinshi-list (env dic name)
1205 (wnnrpc-call-with-environment env (hinshi hinshi-list str-size)
1206 (comm-format (u u u S) (wnn-const JS_HINSI_LIST) env-id dic name)
1208 (comm-unpack (u) str-size) ; ignore
1210 (comm-unpack (S) hinshi)
1211 (setq hinshi-list (nconc hinshi-list (list hinshi))
1212 result (1- result)))
1215 (defun wnnrpc-hinshi-number (proc name)
1217 (wnnrpc-call-with-proc proc ()
1218 (comm-format (u S) (wnn-const JS_HINSI_NUMBER) name)
1219 (wnnrpc-get-result)))
1221 (defun wnnrpc-get-conversion-parameter (env)
1223 (wnnrpc-call-with-environment env (n nsho p1 p2 p3 p4 p5 p6 p7 p8 p9
1224 p10 p11 p12 p13 p14 p15)
1225 (comm-format (u u) (wnn-const JS_PARAM_GET) env-id)
1227 (comm-unpack (i i i i i i i i i i i i i i i i i)
1228 n nsho p1 p2 p3 p4 p5 p6 p7 p8 p9
1229 p10 p11 p12 p13 p14 p15)
1230 (vector n nsho p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15))))
1232 (defun wnnrpc-get-conversion-env-param (env)
1234 (wnnrpc-call-with-environment env (p1 p2 p3 p4 p5 p6 p7 p8 p9
1235 p10 p11 p12 p13 p14 p15 p16 p17 p18)
1236 (comm-format (u u) (wnn-const JS_GET_HENKAN_ENV) env-id)
1238 (comm-unpack (i i i i i i i i i i i i i i i i i i)
1239 p1 p2 p3 p4 p5 p6 p7 p8 p9
1240 p10 p11 p12 p13 p14 p15 p16 p17 p18)
1241 (vector p1 p2 p3 p4 p5 p6 p7 p8 p9
1242 p10 p11 p12 p13 p14 p15 p16 p17 p18))))
1244 (defun wnnrpc-file-loaded (proc path)
1246 (comm-call-with-proc proc (result)
1247 (comm-format (u s) (wnn-const JS_FILE_LOADED) path)
1248 (comm-unpack (i) result)
1251 (defun wnnrpc-write-file (env fid filename)
1252 (wnnrpc-call-with-environment env ()
1253 (comm-format (u u u s) (wnn-const JS_FILE_WRITE) env-id fid filename)
1254 (wnnrpc-get-result)))
1256 (defun wnnrpc-get-fuzokugo-file (env)
1258 (wnnrpc-call-with-environment env ()
1259 (comm-format (u u) (wnn-const JS_FUZOKUGO_GET) env-id)
1260 (wnnrpc-get-result)))
1262 (defsubst wnnrpc-receive-file-list (proc)
1265 nfiles fid local ref-count type name)
1266 (comm-unpack (i) nfiles)
1268 (comm-unpack (i i i i s) fid local ref-count type name)
1269 (setq flist (nconc flist (list (vector fid local ref-count type name)))
1270 nfiles (1- nfiles)))
1273 (defun wnnrpc-get-file-list (proc)
1275 (comm-call-with-proc proc ()
1276 (comm-format (u) (wnn-const JS_FILE_LIST_ALL))
1277 (wnnrpc-receive-file-list proc)))
1279 (defun wnnrpc-get-file-list-with-env (env)
1281 (wnnrpc-call-with-environment env ()
1282 (comm-format (u u) (wnn-const JS_FILE_LIST) env-id)
1283 (wnnrpc-receive-file-list proc)))
1285 (defun wnnrpc-file-attribute (env path)
1286 "3: dictionary, 4: hindo file, 5: fuzokugo-file"
1287 (wnnrpc-call-with-environment env (result)
1288 (comm-format (u u s) (wnn-const JS_FILE_STAT) env-id path)
1289 (comm-unpack (i) result)
1292 (defun wnnrpc-get-file-info (env fid)
1294 (wnnrpc-call-with-environment env (name local ref-count type)
1295 (comm-format (u u u) (wnn-const JS_FILE_INFO) env-id fid)
1297 (comm-unpack (s i i i) name local ref-count type)
1298 (vector name local ref-count type))))
1300 (defmacro wnnrpc-receive-vector (n)
1301 `(let ((v (make-vector ,n -1))
1310 (defun wnnrpc-who (proc)
1312 (comm-call-with-proc proc (who socket username hostname)
1313 (comm-format (u) (wnn-const JS_WHO))
1316 (comm-unpack (i s s) socket username hostname)
1317 (setq who (nconc who
1318 (list (vector socket username hostname
1319 (wnnrpc-receive-vector
1320 (wnn-const WNN_MAX_ENV_OF_A_CLIENT)))))
1321 result (1- result)))
1324 (defun wnnrpc-get-env-list (proc)
1325 (comm-call-with-proc proc (envs id name count fuzokugo dic-max)
1326 (comm-format (u) (wnn-const JS_ENV_LIST))
1329 (comm-unpack (i s i i i) id name count fuzokugo dic-max)
1330 (setq envs (nconc envs
1331 (list (vector id name count fuzokugo dic-max
1332 (wnnrpc-receive-vector
1333 (wnn-const WNN_MAX_DIC_OF_AN_ENV))
1334 (wnnrpc-receive-vector
1335 (wnn-const WNN_MAX_FILE_OF_AN_ENV)))))
1336 result (1- result)))
1339 (defun wnnrpc-kill (proc)
1341 (comm-call-with-proc proc (result)
1342 (comm-format (u) (wnn-const JS_KILL))
1343 (comm-unpack (i) result)
1346 (defun wnnrpc-delete-dictionary (env dic)
1348 (wnnrpc-call-with-environment env ()
1349 (comm-format (u u u) (wnn-const JS_DIC_DELETE) env-id dic)
1350 (wnnrpc-get-result)))
1352 (defun wnnrpc-set-flag-on-dictionary (env dic flag)
1354 (wnnrpc-call-with-environment env ()
1355 (comm-format (u u u u) (wnn-const JS_DIC_USE) env-id dic flag)
1356 (wnnrpc-get-result)))
1358 (defun wnnrpc-get-dictionary-list (proc)
1360 (wnnrpc-call-with-proc proc (n-dic)
1361 (comm-format (u) (wnn-const JS_DIC_LIST_ALL))
1362 (comm-unpack (i) n-dic)
1363 (wnnrpc-receive-dictionary-list proc n-dic)))
1365 (defun wnnrpc-delete-word (env dic entry)
1367 (wnnrpc-call-with-environment env ()
1368 (comm-format (u u u u) (wnn-const JS_WORD_DELETE) env-id dic entry)
1369 (wnnrpc-get-result)))
1371 (defun wnnrpc-receive-word (proc yomi)
1372 (let (dic serial hinshi hindo right-now internal-hindo internal-right-now
1374 (comm-unpack (i) dic)
1376 (comm-unpack (i i i i i i) serial hinshi hindo right-now
1377 internal-hindo internal-right-now)
1378 (setq l (cons (vector dic serial hinshi hindo right-now
1379 internal-hindo internal-right-now
1382 (comm-unpack (i) dic))
1383 (setq l (nreverse l)
1386 (comm-unpack (S S) kanji comment)
1387 (aset (car l1) 8 kanji)
1388 (aset (car l1) 9 comment)
1392 (defun wnnrpc-search-word-in-dictionary (env dic yomi)
1394 (wnnrpc-call-with-environment env (n-entries len)
1395 (comm-format (u u u S) (wnn-const JS_WORD_SEARCH) env-id dic yomi)
1396 (comm-unpack (u u) n-entries len) ; ignore
1397 (wnnrpc-receive-word proc yomi)))
1399 (defun wnnrpc-search-word (env yomi)
1401 (wnnrpc-call-with-environment env (n-entries len)
1402 (comm-format (u u S) (wnn-const JS_WORD_SEARCH_BY_ENV) env-id yomi)
1403 (comm-unpack (u u) n-entries len) ; ignore
1404 (wnnrpc-receive-word proc yomi)))
1406 (defun wnnrpc-get-word-info (env dic entry)
1408 (wnnrpc-call-with-environment env (n-entries len yomi)
1409 (comm-format (u u u u) (wnn-const JS_WORD_INFO) env-id dic entry)
1411 (comm-unpack (S) yomi)
1412 (comm-unpack (u u) n-entries len) ; ignore
1413 (wnnrpc-receive-word proc yomi))))
1415 (defun wnnrpc-set-comment-on-word (env dic entry comment)
1417 (wnnrpc-call-with-environment env ()
1418 (comm-format (u u u u S) (wnn-const JS_WORD_COMMENT_SET)
1419 env-id dic entry comment)
1420 (wnnrpc-get-result)))
1422 (defun wnnrpc-get-dictionary-info (env dic)
1424 (wnnrpc-call-with-environment env ()
1425 (comm-format (u u u) (wnn-const JS_DIC_INFO) env-id dic)
1427 (wnnrpc-receive-dictionary-list proc 1))))
1429 (defun wnnrpc-set-file-comment (env fid comment)
1431 (wnnrpc-call-with-environment env ()
1432 (comm-format (u u u S) (wnn-const JS_FILE_COMMENT_SET) env-id fid comment)
1433 (wnnrpc-get-result)))
1435 (defun wnnrpc-hinshi-name (proc hinshi)
1437 (wnnrpc-call-with-proc proc ()
1438 (comm-format (u u) (wnn-const JS_HINSI_NAME) hinshi)
1440 (comm-unpack (S) result)
1443 (defun wnnrpc-set-file-password (env fid which old new)
1444 "WHICH: 1: DIC, 2: HINDO, 3(0): Both"
1445 (wnnrpc-call-with-environment env ()
1446 (comm-format (u u u u s s) (wnn-const JS_FILE_PASSWORD_SET)
1447 env-id fid which old new)
1448 (wnnrpc-get-result)))
1450 (defun wnnrpc-set-hinshi-table (env dic hinshi-table)
1452 (wnnrpc-call-with-environment env ()
1453 (comm-format (u u u S) (wnn-const JS_HINSI_TABLE_SET)
1454 env-id dic hinshi-table)
1455 (wnnrpc-get-result)))
1457 (defmacro wnnrpc-with-temp-buffer (&rest body)
1459 (let ((coding-system-for-read 'binary)
1460 (coding-system-for-write 'binary))
1461 (set-buffer-multibyte nil)
1464 (defmacro wnnrpc-with-write-file (filename error-handler &rest body)
1465 `(condition-case error
1466 (with-temp-file ,filename
1467 (let ((coding-system-for-read 'binary)
1468 (coding-system-for-write 'binary))
1469 (set-buffer-multibyte nil)
1471 (file-error ,error-handler)))
1473 (defmacro wnnrpc-terminate-current-command (errno)
1475 (comm-call-with-proc-1 proc ()
1476 (comm-format (i) (wnn-const WNN_NAK)))
1477 (- (wnn-const ,errno))))
1479 (defun wnnrpc-get-local-filename (name)
1480 (if (and (string-match (wnn-const WNN_C_LOCAL) name)
1481 (string= (substring name 0 (match-beginning 0)) wnn-system-name))
1482 (substring name (match-end 0))
1485 ;; <header> ::= (<type> <uniq> <uniq> <passwd>)
1486 ;; <uniq> ::= string
1487 ;; <passwd> ::= string
1489 (defun wnnrpc-scan-file-header ()
1491 type uniq1 uniq2 passwd)
1492 (if (and (> (point-max) (wnn-const WNN_FILE_HEADER_LEN))
1493 (equal (buffer-substring 1 (1+ (wnn-const WNN_FILE_STRING_LEN)))
1494 (wnn-const WNN_FILE_STRING)))
1496 (goto-char (1+ (wnn-const WNN_FILE_STRING_LEN)))
1497 (comm-unpack (i v v v)
1499 uniq1 (wnn-const WNN_UNIQ_LEN)
1500 uniq2 (wnn-const WNN_UNIQ_LEN)
1501 passwd (wnn-const WNN_PASSWD_LEN))
1502 (list type uniq1 uniq2 passwd)))))
1504 (defun wnnrpc-get-file-header (filename)
1505 (wnnrpc-with-temp-buffer
1506 (if (null (file-readable-p filename))
1507 (list nil (make-string (wnn-const WNN_UNIQ_LEN) 0) "" "")
1508 (insert-file-contents filename nil 0 (wnn-const WNN_FILE_HEADER_LEN))
1509 (wnnrpc-scan-file-header))))
1511 (defun wnnrpc-check-local-file (path &optional preserve)
1512 (let ((header (wnnrpc-get-file-header path)))
1513 (cond ((null header)
1514 (- (wnn-const WNN_NOT_A_FILE)))
1515 ((null (car header))
1516 (if (file-exists-p path)
1517 (- (wnn-const WNN_OPENF_ERR))
1518 (- (wnn-const WNN_NO_EXIST))))
1520 (if (wnnrpc-check-inode header path)
1523 (- (wnn-const WNN_INODE_CHECK_ERROR))
1524 (wnnrpc-change-file-uniq header path)
1525 (wnnrpc-check-local-file path t)))))))
1527 (defsubst wnnrpc-get-inode (uniq)
1528 (+ (lsh (aref uniq 8) 24)
1529 (lsh (aref uniq 9) 16)
1530 (lsh (aref uniq 10) 8)
1533 (defun wnnrpc-check-inode (header path)
1534 (let ((inode (nth 10 (file-attributes path))))
1535 (and inode (= inode (wnnrpc-get-inode (nth 1 header))))))
1537 (defun wnnrpc-make-uniq (attributes)
1538 (wnnrpc-with-temp-buffer
1539 (let ((ctime (nth 6 attributes))
1540 (ino (nth 10 attributes))
1541 (devno (nth 11 attributes)))
1543 (comm-format (U i u V)
1545 wnn-system-name (wnn-const WNN_HOST_LEN))
1546 ;; Emacs 21 returns returns negative devno as 16 bits uint pair
1547 (comm-format (U U u V)
1548 ctime (list (car devno) (cdr devno)) ino
1549 wnn-system-name (wnn-const WNN_HOST_LEN)))
1552 (defun wnnrpc-change-file-uniq (header path &optional new)
1553 (wnnrpc-with-write-file path
1555 (insert-file-contents path)
1556 (if (wnnrpc-scan-file-header)
1557 (let ((uniq (wnnrpc-make-uniq (file-attributes path))))
1558 (goto-char (1+ (wnn-const WNN_FILE_STRING_LEN)))
1559 (delete-region (point) (1+ (wnn-const WNN_FILE_HEADER_LEN)))
1560 (comm-format (u v v v v)
1562 uniq (wnn-const WNN_UNIQ_LEN)
1563 (if new uniq (nth 1 header)) (wnn-const WNN_UNIQ_LEN)
1564 (nth 3 header) (wnn-const WNN_PASSWD_LEN)
1565 "" (wnn-const WNN_FILE_HEADER_PAD))
1568 (defun wnnrpc-check-passwd (proc passwd header)
1571 (if (< (setq env-id (wnnrpc-connect proc "")) 0)
1573 (wnnrpc-call-with-environment (wnnenv-create proc env-id)
1575 (comm-format (u u v) (wnn-const JS_FILE_SEND)
1577 (nth 1 header) (wnn-const WNN_UNIQ_LEN))
1578 (comm-unpack (i) file-id)
1581 (wnnrpc-get-result) ; ignore result code
1582 (- (wnn-const WNN_FILE_IN_USE)))
1584 (comm-call-with-proc-1 proc ()
1586 (concat wnn-system-name "!TEMPFILE")
1587 (wnnrpc-make-dummy-dictionary header))
1589 (let ((egg-fixed-euc (list egg-fixed-euc egg-fixed-euc)))
1590 (wnnrpc-set-dictionary (wnnenv-create proc env-id)
1592 passwd "" nil))))))))
1594 (wnnrpc-disconnect (wnnenv-create proc env-id))))))
1596 (defun wnnrpc-make-dummy-dictionary (header)
1597 (wnnrpc-with-temp-buffer
1598 (comm-format (v u v v v v u v)
1599 (wnn-const WNN_FILE_STRING) (wnn-const WNN_FILE_STRING_LEN)
1600 (wnn-const WNN_FT_DICT_FILE)
1601 (nth 1 header) (wnn-const WNN_UNIQ_LEN)
1602 (nth 1 header) (wnn-const WNN_UNIQ_LEN)
1603 (nth 3 header) (wnn-const WNN_PASSWD_LEN)
1604 "" (wnn-const WNN_FILE_HEADER_PAD)
1605 (wnn-const WNN_REV_DICT)
1606 "" (wnn-const WNN_FILE_BODY_PAD))
1609 (defun wnnrpc-file-loaded-local (proc path &optional preserve)
1611 (let ((header (wnnrpc-check-local-file path preserve)))
1612 (if (numberp header)
1614 (comm-call-with-proc proc (result)
1615 (comm-format (u v) (wnn-const JS_FILE_LOADED_LOCAL)
1616 (nth 1 header) (wnn-const WNN_UNIQ_LEN))
1617 (comm-unpack (i) result)
1620 (defun wnnrpc-file-receive (env fid local-filename)
1623 (wnnrpc-call-with-environment env (filename)
1624 (comm-format (u u u) (wnn-const JS_FILE_RECEIVE)
1626 (comm-unpack (s) filename)
1627 (if (null local-filename)
1628 (setq local-filename (wnnrpc-get-local-filename filename)))
1629 (let ((header (wnnrpc-get-file-header local-filename))
1632 (wnnrpc-terminate-current-command WNN_NOT_A_FILE)
1633 (comm-call-with-proc-1 proc ()
1634 (comm-format (u v) (wnn-const WNN_ACK)
1635 (nth 1 header) (wnn-const WNN_UNIQ_LEN)))
1639 ((null (file-writable-p local-filename))
1640 (wnnrpc-terminate-current-command WNN_FILE_WRITE_ERROR))
1642 (wnnrpc-with-write-file local-filename
1643 (- (wnn-const WNN_FILE_WRITE_ERROR))
1644 (comm-call-with-proc proc ()
1645 (comm-format (u) (wnn-const WNN_ACK))
1646 (comm-unpack (B) contents))
1649 (insert-file-contents local-filename nil (1- (point))))
1651 (set-buffer (process-buffer proc))
1652 (wnnrpc-get-result)))))))))
1654 (wnnrpc-call-with-environment env ()
1655 (comm-format (i) (wnn-const WNN_NAK)))
1656 (signal (car err) (cdr err)))))
1658 (defun wnnrpc-file-send (env filename)
1660 (let ((header (wnnrpc-check-local-file filename)))
1661 (if (numberp header)
1664 (wnnrpc-call-with-environment env (file-id)
1665 (comm-format (u u v) (wnn-const JS_FILE_SEND)
1667 (nth 1 header) (wnn-const WNN_UNIQ_LEN))
1668 (comm-unpack (i) file-id)
1671 (wnnenv-set-client-file env filename)
1674 (comm-call-with-proc-1 proc ()
1676 (concat wnn-system-name "!" filename)
1677 (wnnrpc-with-temp-buffer
1678 (insert-file-contents filename)
1681 (wnnenv-set-client-file env filename)
1684 (wnnrpc-call-with-environment env ()
1685 (comm-format (s B B B B B B) "" "" "" "" "" "" ""))
1686 (signal (car err) (cdr err)))))))
1688 (defun wnnrpc-file-remove-client (proc name passwd)
1691 ((/= (wnnrpc-file-loaded-local proc name) -1)
1692 (- (wnn-const WNN_FILE_IN_USE)))
1693 ((null (file-readable-p name))
1694 (- (wnn-const WNN_FILE_READ_ERROR)))
1695 ((null (numberp (car (setq header (wnnrpc-get-file-header name)))))
1696 (- (wnn-const WNN_NOT_A_FILE)))
1697 ((< (wnnrpc-check-passwd proc passwd header) 0)
1698 (- (wnn-const WNN_INCORRECT_PASSWD)))
1704 (error (- (wnn-const WNN_UNLINK))))))))
1706 (defun wnnrpc-dic-file-create-client (env dicname type comment passwd hpasswd)
1707 (if (and (null (file-exists-p dicname))
1708 (file-writable-p dicname)
1709 (or (eq type (wnn-const WNN_REV_DICT))
1710 (eq type (wnn-const CWNN_REV_DICT))
1711 (eq type (wnn-const BWNN_REV_DICT))
1712 (eq type (wnn-const WNN_UD_DICT))
1713 (and (wnnenv-is-wnn6 env)
1714 (eq type (wnn-const WNN_FI_USER_DICT))))
1715 (wnnrpc-create-and-move-to-client env nil dicname type
1716 comment passwd hpasswd))
1718 (- (wnn-const WNN_FILE_CREATE_ERROR))))
1721 (defun wnnrpc-hindo-file-create-client (env fi dic-id freqname comment passwd)
1722 (if (and (null (file-exists-p freqname))
1723 (file-writable-p freqname)
1724 (wnnrpc-create-and-move-to-client env dic-id freqname fi
1725 comment passwd nil))
1727 (- (wnn-const WNN_FILE_CREATE_ERROR))))
1729 (defun wnnrpc-make-temp-name (env)
1731 (temp-form "usr/temp"))
1732 (while (= (wnnrpc-access env (concat temp-form (number-to-string n)) 0) 0)
1734 (concat temp-form (number-to-string n))))
1736 (defun wnnrpc-create-and-move-to-client (env dic-id filename type
1737 comment passwd hpasswd)
1738 (let ((tempfile (wnnrpc-make-temp-name env))
1744 (setq created (wnnrpc-dic-file-create env tempfile type
1745 comment passwd hpasswd))
1746 (setq created (wnnrpc-hindo-file-create env type dic-id tempfile
1748 (if (and (>= created 0)
1749 (>= (setq fid (wnnrpc-file-read env tempfile)) 0)
1750 (>= (wnnrpc-file-receive env fid filename) 0))
1751 (wnnrpc-change-file-uniq (wnnrpc-get-file-header filename)
1753 (condition-case nil (delete-file filename) (error))
1756 (wnnrpc-file-discard env fid))
1758 (wnnrpc-file-remove (wnnenv-get-proc env) tempfile passwd)))))
1760 (defun wnnrpc-read-passwd-file (filename)
1762 ((null filename) "")
1763 ((null (file-readable-p filename)) (- (wnn-const WNN_FILE_READ_ERROR)))
1765 (wnnrpc-with-temp-buffer
1766 (insert-file-contents filename nil 0 (1- (wnn-const WNN_PASSWD_LEN)))
1768 (if (and (search-forward-regexp "[\0\n]" nil 0)
1769 (= (preceding-char) 0))
1771 (buffer-substring 1 (point))))))
1773 ;;; egg/wnnrpc.el ends here.